<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/linux.git/drivers/md/bitmap.c, branch v4.9.74</title>
<subtitle>Linux Kernel
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v4.9.74</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v4.9.74'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/'/>
<updated>2017-12-16T15:25:47Z</updated>
<entry>
<title>md: free unused memory after bitmap resize</title>
<updated>2017-12-16T15:25:47Z</updated>
<author>
<name>Zdenek Kabelac</name>
<email>zkabelac@redhat.com</email>
</author>
<published>2017-11-08T12:44:56Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=b7d3f2b5dca97de98dddbd4992dbe49d5a7723fa'/>
<id>urn:sha1:b7d3f2b5dca97de98dddbd4992dbe49d5a7723fa</id>
<content type='text'>
[ Upstream commit 0868b99c214a3d55486c700de7c3f770b7243e7c ]

When bitmap is resized, the old kalloced chunks just are not released
once the resized bitmap starts to use new space.

This fixes in particular kmemleak reports like this one:

unreferenced object 0xffff8f4311e9c000 (size 4096):
  comm "lvm", pid 19333, jiffies 4295263268 (age 528.265s)
  hex dump (first 32 bytes):
    02 80 02 80 02 80 02 80 02 80 02 80 02 80 02 80  ................
    02 80 02 80 02 80 02 80 02 80 02 80 02 80 02 80  ................
  backtrace:
    [&lt;ffffffffa69471ca&gt;] kmemleak_alloc+0x4a/0xa0
    [&lt;ffffffffa628c10e&gt;] kmem_cache_alloc_trace+0x14e/0x2e0
    [&lt;ffffffffa676cfec&gt;] bitmap_checkpage+0x7c/0x110
    [&lt;ffffffffa676d0c5&gt;] bitmap_get_counter+0x45/0xd0
    [&lt;ffffffffa676d6b3&gt;] bitmap_set_memory_bits+0x43/0xe0
    [&lt;ffffffffa676e41c&gt;] bitmap_init_from_disk+0x23c/0x530
    [&lt;ffffffffa676f1ae&gt;] bitmap_load+0xbe/0x160
    [&lt;ffffffffc04c47d3&gt;] raid_preresume+0x203/0x2f0 [dm_raid]
    [&lt;ffffffffa677762f&gt;] dm_table_resume_targets+0x4f/0xe0
    [&lt;ffffffffa6774b52&gt;] dm_resume+0x122/0x140
    [&lt;ffffffffa6779b9f&gt;] dev_suspend+0x18f/0x290
    [&lt;ffffffffa677a3a7&gt;] ctl_ioctl+0x287/0x560
    [&lt;ffffffffa677a693&gt;] dm_ctl_ioctl+0x13/0x20
    [&lt;ffffffffa62d6b46&gt;] do_vfs_ioctl+0xa6/0x750
    [&lt;ffffffffa62d7269&gt;] SyS_ioctl+0x79/0x90
    [&lt;ffffffffa6956d41&gt;] entry_SYSCALL_64_fastpath+0x1f/0xc2

Signed-off-by: Zdenek Kabelac &lt;zkabelac@redhat.com&gt;
Signed-off-by: Shaohua Li &lt;shli@fb.com&gt;
Signed-off-by: Sasha Levin &lt;alexander.levin@verizon.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>md/bitmap: disable bitmap_resize for file-backed bitmaps.</title>
<updated>2017-09-27T12:39:21Z</updated>
<author>
<name>NeilBrown</name>
<email>neilb@suse.com</email>
</author>
<published>2017-08-31T00:23:25Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=2cee78081b97366c42bb6349be2a57f89c36df5a'/>
<id>urn:sha1:2cee78081b97366c42bb6349be2a57f89c36df5a</id>
<content type='text'>
commit e8a27f836f165c26f867ece7f31eb5c811692319 upstream.

bitmap_resize() does not work for file-backed bitmaps.
The buffer_heads are allocated and initialized when
the bitmap is read from the file, but resize doesn't
read from the file, it loads from the internal bitmap.
When it comes time to write the new bitmap, the bh is
non-existent and we crash.

The common case when growing an array involves making the array larger,
and that normally means making the bitmap larger.  Doing
that inside the kernel is possible, but would need more code.
It is probably easier to require people who use file-backed
bitmaps to remove them and re-add after a reshape.

So this patch disables the resizing of arrays which have
file-backed bitmaps.  This is better than crashing.

Reported-by: Zhilong Liu &lt;zlliu@suse.com&gt;
Fixes: d60b479d177a ("md/bitmap: add bitmap_resize function to allow bitmap resizing.")
Signed-off-by: NeilBrown &lt;neilb@suse.com&gt;
Signed-off-by: Shaohua Li &lt;shli@fb.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>md/bitmap: fix wrong cleanup</title>
<updated>2016-09-21T16:09:44Z</updated>
<author>
<name>Shaohua Li</name>
<email>shli@fb.com</email>
</author>
<published>2016-09-13T17:28:00Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=f71f1cf97c781db1be8ae0190e0983e1fceac14a'/>
<id>urn:sha1:f71f1cf97c781db1be8ae0190e0983e1fceac14a</id>
<content type='text'>
if bitmap_create fails, the bitmap is already cleaned up and the returned value
is an error number. We can't do the cleanup again.

Reported-by: Christophe JAILLET &lt;christophe.jaillet@wanadoo.fr&gt;
Signed-off-by: Shaohua Li &lt;shli@fb.com&gt;
</content>
</entry>
<entry>
<title>MD: hold mddev lock to change bitmap location</title>
<updated>2016-08-06T05:02:40Z</updated>
<author>
<name>Shaohua Li</name>
<email>shli@fb.com</email>
</author>
<published>2016-07-30T17:05:31Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=d9dd26b20cff88b45d861ec786d86b1c9bd2ee60'/>
<id>urn:sha1:d9dd26b20cff88b45d861ec786d86b1c9bd2ee60</id>
<content type='text'>
Changing the location changes a lot of things. Holding the lock to avoid race.
This makes the .quiesce called with mddev lock hold too.

Acked-by: NeilBrown &lt;neilb@suse.com&gt;
Signed-off-by: Shaohua Li &lt;shli@fb.com&gt;
</content>
</entry>
<entry>
<title>md: use bio op accessors</title>
<updated>2016-06-07T19:41:38Z</updated>
<author>
<name>Mike Christie</name>
<email>mchristi@redhat.com</email>
</author>
<published>2016-06-05T19:32:07Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=796a5cf083c2631180ad209c3ebb7d11d776cd72'/>
<id>urn:sha1:796a5cf083c2631180ad209c3ebb7d11d776cd72</id>
<content type='text'>
Separate the op from the rq_flag_bits and have md
set/get the bio using bio_set_op_attrs/bio_op.

Signed-off-by: Mike Christie &lt;mchristi@redhat.com&gt;
Reviewed-by: Christoph Hellwig &lt;hch@lst.de&gt;
Reviewed-by: Hannes Reinecke &lt;hare@suse.com&gt;
Signed-off-by: Jens Axboe &lt;axboe@fb.com&gt;
</content>
</entry>
<entry>
<title>fs: have submit_bh users pass in op and flags separately</title>
<updated>2016-06-07T19:41:38Z</updated>
<author>
<name>Mike Christie</name>
<email>mchristi@redhat.com</email>
</author>
<published>2016-06-05T19:31:43Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=2a222ca992c35aee1e83af428f3dd26a3f5d5d94'/>
<id>urn:sha1:2a222ca992c35aee1e83af428f3dd26a3f5d5d94</id>
<content type='text'>
This has submit_bh users pass in the operation and flags separately,
so submit_bh_wbc can setup the bio op and bi_rw flags on the bio that
is submitted.

Signed-off-by: Mike Christie &lt;mchristi@redhat.com&gt;
Reviewed-by: Christoph Hellwig &lt;hch@lst.de&gt;
Reviewed-by: Hannes Reinecke &lt;hare@suse.com&gt;
Signed-off-by: Jens Axboe &lt;axboe@fb.com&gt;
</content>
</entry>
<entry>
<title>md-cluster: gather resync infos and enable recv_thread after bitmap is ready</title>
<updated>2016-05-09T16:24:03Z</updated>
<author>
<name>Guoqing Jiang</name>
<email>gqjiang@suse.com</email>
</author>
<published>2016-05-04T06:17:09Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=51e453aecb267b6a99b1d2853bccd5bba7340236'/>
<id>urn:sha1:51e453aecb267b6a99b1d2853bccd5bba7340236</id>
<content type='text'>
The in-memory bitmap is not ready when node joins cluster,
so it doesn't make sense to make gather_all_resync_info()
called so earlier, we need to call it after the node's
bitmap is setup. Also, recv_thread could be wake up after
node joins cluster, but it could cause problem if node
receives RESYNCING message without persionality since
mddev-&gt;pers-&gt;quiesce is called in process_suspend_info.

This commit introduces a new cluster interface load_bitmaps
to fix above problems, load_bitmaps is called in bitmap_load
where bitmap and persionality are ready, and load_bitmaps
does the following tasks:

1. call gather_all_resync_info to load all the node's
   bitmap info.
2. set MD_CLUSTER_ALREADY_IN_CLUSTER bit to recv_thread
   could be wake up, and wake up recv_thread if there is
   pending recv event.

Then ack_bast only wakes up recv_thread after IN_CLUSTER
bit is ready otherwise MD_CLUSTER_PENDING_RESYNC_EVENT is
set.

Reviewed-by: NeilBrown &lt;neilb@suse.com&gt;
Signed-off-by: Guoqing Jiang &lt;gqjiang@suse.com&gt;
Signed-off-by: Shaohua Li &lt;shli@fb.com&gt;
</content>
</entry>
<entry>
<title>md-cluster: fix ifnullfree.cocci warnings</title>
<updated>2016-05-04T19:39:35Z</updated>
<author>
<name>kbuild test robot</name>
<email>lkp@intel.com</email>
</author>
<published>2016-05-02T15:50:16Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=bc47e84258be3e49c14be65a111f2117ecc986f6'/>
<id>urn:sha1:bc47e84258be3e49c14be65a111f2117ecc986f6</id>
<content type='text'>
drivers/md/bitmap.c:2049:6-11: WARNING: NULL check before freeing functions like kfree, debugfs_remove, debugfs_remove_recursive or usb_free_urb is not needed. Maybe consider reorganizing relevant code to avoid passing NULL values.

 NULL check before some freeing functions is not needed.

 Based on checkpatch warning
 "kfree(NULL) is safe this check is probably not required"
 and kfreeaddr.cocci by Julia Lawall.

Generated by: scripts/coccinelle/free/ifnullfree.cocci

Acked-by: Guoqing Jiang &lt;gqjiang@suse.com&gt;
Signed-off-by: Fengguang Wu &lt;fengguang.wu@intel.com&gt;
Signed-off-by: Shaohua Li &lt;shli@fb.com&gt;
</content>
</entry>
<entry>
<title>md-cluster/bitmap: unplug bitmap to sync dirty pages to disk</title>
<updated>2016-05-04T19:39:35Z</updated>
<author>
<name>Guoqing Jiang</name>
<email>gqjiang@suse.com</email>
</author>
<published>2016-05-02T15:50:15Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=c84400c89f0f98ae4a73ed89886239b67d1dcd31'/>
<id>urn:sha1:c84400c89f0f98ae4a73ed89886239b67d1dcd31</id>
<content type='text'>
This patch is doing two distinct but related things.

1. It adds bitmap_unplug() for the main bitmap (mddev-&gt;bitmap).  As bit
have been set, BITMAP_PAGE_DIRTY is set so bitmap_deamon_work() will
not write those pages out in its regular scans, only bitmap_unplug()
will.  If there are no writes to the array, bitmap_unplug() won't be
called, so we need to call it explicitly here.

2. bitmap_write_all() is a bit of a confusing interface as it doesn't
actually write anything.  The current code for writing "bitmap" works
but this change makes it a bit clearer.

Reviewed-by: NeilBrown &lt;neilb@suse.com&gt;
Signed-off-by: Guoqing Jiang &lt;gqjiang@suse.com&gt;
Signed-off-by: Shaohua Li &lt;shli@fb.com&gt;
</content>
</entry>
<entry>
<title>md-cluster/bitmap: fix wrong page num in bitmap_file_clear_bit and bitmap_file_set_bit</title>
<updated>2016-05-04T19:39:35Z</updated>
<author>
<name>Guoqing Jiang</name>
<email>gqjiang@suse.com</email>
</author>
<published>2016-05-02T15:50:14Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=23cea66a37c76dc6554b862b179a654db24fa83d'/>
<id>urn:sha1:23cea66a37c76dc6554b862b179a654db24fa83d</id>
<content type='text'>
The pnum passed to set_page_attr and test_page_attr should from
0 to storage.file_pages - 1, but bitmap_file_set_bit and
bitmap_file_clear_bit call set_page_attr and test_page_attr with
page-&gt;index parameter while page-&gt;index has already added node_offset
before.

So we need to minus node_offset in both bitmap_file_clear_bit
and bitmap_file_set_bit.

Reviewed-by: NeilBrown &lt;neilb@suse.com&gt;
Signed-off-by: Guoqing Jiang &lt;gqjiang@suse.com&gt;
Signed-off-by: Shaohua Li &lt;shli@fb.com&gt;
</content>
</entry>
</feed>
