<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/md/bitmap.c, branch v4.14.263</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v4.14.263</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v4.14.263'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2020-11-05T10:06:56+00:00</updated>
<entry>
<title>md/bitmap: md_bitmap_get_counter returns wrong blocks</title>
<updated>2020-11-05T10:06:56+00:00</updated>
<author>
<name>Zhao Heming</name>
<email>heming.zhao@suse.com</email>
</author>
<published>2020-10-05T16:00:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=e2be015d14a78d6067cc61670616e55aaf652fe2'/>
<id>urn:sha1:e2be015d14a78d6067cc61670616e55aaf652fe2</id>
<content type='text'>
[ Upstream commit d837f7277f56e70d82b3a4a037d744854e62f387 ]

md_bitmap_get_counter() has code:

```
    if (bitmap-&gt;bp[page].hijacked ||
        bitmap-&gt;bp[page].map == NULL)
        csize = ((sector_t)1) &lt;&lt; (bitmap-&gt;chunkshift +
                      PAGE_COUNTER_SHIFT - 1);
```

The minus 1 is wrong, this branch should report 2048 bits of space.
With "-1" action, this only report 1024 bit of space.

This bug code returns wrong blocks, but it doesn't inflence bitmap logic:
1. Most callers focus this function return value (the counter of offset),
   not the parameter blocks.
2. The bug is only triggered when hijacked is true or map is NULL.
   the hijacked true condition is very rare.
   the "map == null" only true when array is creating or resizing.
3. Even the caller gets wrong blocks, current code makes caller just to
   call md_bitmap_get_counter() one more time.

Signed-off-by: Zhao Heming &lt;heming.zhao@suse.com&gt;
Signed-off-by: Song Liu &lt;songliubraving@fb.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>md: Avoid namespace collision with bitmap API</title>
<updated>2020-01-29T14:02:39+00:00</updated>
<author>
<name>Andy Shevchenko</name>
<email>andriy.shevchenko@linux.intel.com</email>
</author>
<published>2020-01-28T11:49:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=e9a80d43d9b50198256eb75c92a1341c6169ec1f'/>
<id>urn:sha1:e9a80d43d9b50198256eb75c92a1341c6169ec1f</id>
<content type='text'>
commit e64e4018d572710c44f42c923d4ac059f0a23320 upstream.

bitmap API (include/linux/bitmap.h) has 'bitmap' prefix for its methods.

On the other hand MD bitmap API is special case.
Adding 'md' prefix to it to avoid name space collision.

No functional changes intended.

Signed-off-by: Andy Shevchenko &lt;andriy.shevchenko@linux.intel.com&gt;
Acked-by: Shaohua Li &lt;shli@kernel.org&gt;
Signed-off-by: Dmitry Torokhov &lt;dmitry.torokhov@gmail.com&gt;
[only take the bitmap_free change for stable - gregkh]
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>md: free unused memory after bitmap resize</title>
<updated>2017-12-17T14:08:00+00:00</updated>
<author>
<name>Zdenek Kabelac</name>
<email>zkabelac@redhat.com</email>
</author>
<published>2017-11-08T12:44:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=89a459e0d519b289c15e4da8f52ff5528c7b8a3c'/>
<id>urn:sha1:89a459e0d519b289c15e4da8f52ff5528c7b8a3c</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: forbid a RAID5 from having both a bitmap and a journal.</title>
<updated>2017-12-05T10:26:38+00:00</updated>
<author>
<name>NeilBrown</name>
<email>neilb@suse.com</email>
</author>
<published>2017-10-17T03:24:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=a67936842ba66eb229e6322856fefd2310e0b3fb'/>
<id>urn:sha1:a67936842ba66eb229e6322856fefd2310e0b3fb</id>
<content type='text'>
commit 230b55fa8d64007339319539f8f8e68114d08529 upstream.

Having both a bitmap and a journal is pointless.
Attempting to do so can corrupt the bitmap if the journal
replay happens before the bitmap is initialized.
Rather than try to avoid this corruption, simply
refuse to allow arrays with both a bitmap and a journal.
So:
 - if raid5_run sees both are present, fail.
 - if adding a bitmap finds a journal is present, fail
 - if adding a journal finds a bitmap is present, fail.

Signed-off-by: NeilBrown &lt;neilb@suse.com&gt;
Tested-by: Joshua Kinard &lt;kumba@gentoo.org&gt;
Acked-by: Joshua Kinard &lt;kumba@gentoo.org&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: revert a patch</title>
<updated>2017-11-30T08:40:47+00:00</updated>
<author>
<name>Shaohua Li</name>
<email>shli@fb.com</email>
</author>
<published>2017-10-17T02:03:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=a6ff2fb417898b57e5f81349731855763260b266'/>
<id>urn:sha1:a6ff2fb417898b57e5f81349731855763260b266</id>
<content type='text'>
commit 938b533d479e7428b7fa1b8179283646d2e2c53d upstream.

This reverts commit 8031c3ddc70a. That patches doesn't work well if PAGE_SIZE &gt;
4k. We will fix the original problem with a different approach.

Fix: 8031c3ddc70a(md/bitmap: copy correct data for bitmap super)
Reported-by: Joshua Kinard &lt;kumba@gentoo.org&gt;
Suggested-by: Neil Brown &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: disable bitmap_resize for file-backed bitmaps.</title>
<updated>2017-09-01T05:57:03+00:00</updated>
<author>
<name>NeilBrown</name>
<email>neilb@suse.com</email>
</author>
<published>2017-08-31T00:23:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=e8a27f836f165c26f867ece7f31eb5c811692319'/>
<id>urn:sha1:e8a27f836f165c26f867ece7f31eb5c811692319</id>
<content type='text'>
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.")
Cc: stable@vger.kernel.org (v3.5+).
Signed-off-by: NeilBrown &lt;neilb@suse.com&gt;
Signed-off-by: Shaohua Li &lt;shli@fb.com&gt;
</content>
</entry>
<entry>
<title>md/bitmap: copy correct data for bitmap super</title>
<updated>2017-08-24T17:04:54+00:00</updated>
<author>
<name>Shaohua Li</name>
<email>shli@fb.com</email>
</author>
<published>2017-08-17T17:35:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=8031c3ddc70ab93099e7d1814382dba39f57b43e'/>
<id>urn:sha1:8031c3ddc70ab93099e7d1814382dba39f57b43e</id>
<content type='text'>
raid5 cache could write bitmap superblock before bitmap superblock is
initialized. The bitmap superblock is less than 512B. The current code will
only copy the superblock to a new page and write the whole 512B, which will
zero the the data after the superblock. Unfortunately the data could include
bitmap, which we should preserve. The patch will make superblock read do 4k
chunk and we always copy the 4k data to new page, so the superblock write will
old data to disk and we don't change the bitmap.

Reported-by: Song Liu &lt;songliubraving@fb.com&gt;
Reviewed-by: Song Liu &lt;songliubraving@fb.com&gt;
Cc: stable@vger.kernel.org (4.10+)
Signed-off-by: Shaohua Li &lt;shli@fb.com&gt;
</content>
</entry>
<entry>
<title>md/bitmap: don't read page from device with Bitmap_sync</title>
<updated>2017-07-10T17:30:41+00:00</updated>
<author>
<name>Guoqing Jiang</name>
<email>gqjiang@suse.com</email>
</author>
<published>2017-07-04T03:20:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=4aaf7694f841edc96fe0f72958aabe59204b3611'/>
<id>urn:sha1:4aaf7694f841edc96fe0f72958aabe59204b3611</id>
<content type='text'>
The device owns Bitmap_sync flag needs recovery
to become in sync, and read page from this type
device could get stale status.

Also add comments for Bitmap_sync bit per the
suggestion from Shaohua and Neil.

Previous disscussion can be found here:
https://marc.info/?t=149760428900004&amp;r=1&amp;w=2

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: uuid debug statement now in processor byte order.</title>
<updated>2017-05-24T22:58:43+00:00</updated>
<author>
<name>Kyungchan Koh</name>
<email>kkc6196@fb.com</email>
</author>
<published>2017-05-24T17:16:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=4179bc30b2fe85f827d93e0ae7ae8f49ad3afc02'/>
<id>urn:sha1:4179bc30b2fe85f827d93e0ae7ae8f49ad3afc02</id>
<content type='text'>
Previously, the uuid debug statements were printed in little-endian
format, which wasn't consistent in machines that might not be in
little-endian byte order. With this change, the output will be
consistent for all machines with different byte-ordering.

Signed-off-by: Kyungchan Koh &lt;kkc6196@fb.com&gt;
Signed-off-by: Shaohua Li &lt;shli@fb.com&gt;
</content>
</entry>
<entry>
<title>md: fix several trivial typos in comments</title>
<updated>2017-03-24T05:54:57+00:00</updated>
<author>
<name>Zhilong Liu</name>
<email>zlliu@suse.com</email>
</author>
<published>2017-03-15T08:14:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=3560741e316b3ea52cfb27901ae284921445180f'/>
<id>urn:sha1:3560741e316b3ea52cfb27901ae284921445180f</id>
<content type='text'>
Signed-off-by: Zhilong Liu &lt;zlliu@suse.com&gt;
Signed-off-by: Shaohua Li &lt;shli@fb.com&gt;
</content>
</entry>
</feed>
