<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/md/dm-cache-metadata.c, branch linux-4.9.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.9.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.9.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2023-01-07T11:07:36Z</updated>
<entry>
<title>dm cache: Fix ABBA deadlock between shrink_slab and dm_cache_metadata_abort</title>
<updated>2023-01-07T11:07:36Z</updated>
<author>
<name>Mike Snitzer</name>
</author>
<published>2022-11-30T18:26:32Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=6e237cacda8b4e976849e7bff9fe7dff0e968586'/>
<id>urn:sha1:6e237cacda8b4e976849e7bff9fe7dff0e968586</id>
<content type='text'>
commit 352b837a5541690d4f843819028cf2b8be83d424 upstream.

Same ABBA deadlock pattern fixed in commit 4b60f452ec51 ("dm thin: Fix
ABBA deadlock between shrink_slab and dm_pool_abort_metadata") to
DM-cache's metadata.

Reported-by: Zhihao Cheng &lt;chengzhihao1@huawei.com&gt;
Cc: stable@vger.kernel.org
Fixes: 028ae9f76f29 ("dm cache: add fail io mode and needs_check flag")
Signed-off-by: Mike Snitzer &lt;snitzer@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>dm cache metadata: Avoid returning cmd-&gt;bm wild pointer on error</title>
<updated>2020-09-12T09:47:37Z</updated>
<author>
<name>Ye Bin</name>
</author>
<published>2020-09-01T06:25:42Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=1c1630436a53ebf2cec68c120f2200422d89f0b0'/>
<id>urn:sha1:1c1630436a53ebf2cec68c120f2200422d89f0b0</id>
<content type='text'>
commit d16ff19e69ab57e08bf908faaacbceaf660249de upstream.

Maybe __create_persistent_data_objects() caller will use PTR_ERR as a
pointer, it will lead to some strange things.

Signed-off-by: Ye Bin &lt;yebin10@huawei.com&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Mike Snitzer &lt;snitzer@redhat.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>dm cache metadata: ignore hints array being too small during resize</title>
<updated>2018-10-13T07:18:55Z</updated>
<author>
<name>Joe Thornber</name>
</author>
<published>2018-09-24T20:19:30Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=8bf0cc33eddc8d1c5267115f460a3bc4a714ea88'/>
<id>urn:sha1:8bf0cc33eddc8d1c5267115f460a3bc4a714ea88</id>
<content type='text'>
commit 4561ffca88c546f96367f94b8f1e4715a9c62314 upstream.

Commit fd2fa9541 ("dm cache metadata: save in-core policy_hint_size to
on-disk superblock") enabled previously written policy hints to be
used after a cache is reactivated.  But in doing so the cache
metadata's hint array was left exposed to out of bounds access because
on resize the metadata's on-disk hint array wasn't ever extended.

Fix this by ignoring that there are no on-disk hints associated with the
newly added cache blocks.  An expanded on-disk hint array is later
rewritten upon the next clean shutdown of the cache.

Fixes: fd2fa9541 ("dm cache metadata: save in-core policy_hint_size to on-disk superblock")
Cc: stable@vger.kernel.org
Signed-off-by: Joe Thornber &lt;ejt@redhat.com&gt;
Signed-off-by: Mike Snitzer &lt;snitzer@redhat.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>dm cache metadata: save in-core policy_hint_size to on-disk superblock</title>
<updated>2018-09-09T18:01:21Z</updated>
<author>
<name>Mike Snitzer</name>
</author>
<published>2018-08-02T20:08:52Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d08b58b5c3ca41fa65a03a7c11398d48bf803079'/>
<id>urn:sha1:d08b58b5c3ca41fa65a03a7c11398d48bf803079</id>
<content type='text'>
commit fd2fa95416188a767a63979296fa3e169a9ef5ec upstream.

policy_hint_size starts as 0 during __write_initial_superblock().  It
isn't until the policy is loaded that policy_hint_size is set in-core
(cmd-&gt;policy_hint_size).  But it never got recorded in the on-disk
superblock because __commit_transaction() didn't deal with transfering
the in-core cmd-&gt;policy_hint_size to the on-disk superblock.

The in-core cmd-&gt;policy_hint_size gets initialized by metadata_open()'s
__begin_transaction_flags() which re-reads all superblock fields.
Because the superblock's policy_hint_size was never properly stored, when
the cache was created, hints_array_available() would always return false
when re-activating a previously created cache.  This means
__load_mappings() always considered the hints invalid and never made use
of the hints (these hints served to optimize).

Another detremental side-effect of this oversight is the cache_check
utility would fail with: "invalid hint width: 0"

Cc: stable@vger.kernel.org
Signed-off-by: Mike Snitzer &lt;snitzer@redhat.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>dm cache metadata: fail operations if fail_io mode has been established</title>
<updated>2017-05-25T13:44:33Z</updated>
<author>
<name>Mike Snitzer</name>
</author>
<published>2017-05-05T18:40:13Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e69242436b6b086a6f342f715c68389596a9a7ac'/>
<id>urn:sha1:e69242436b6b086a6f342f715c68389596a9a7ac</id>
<content type='text'>
commit 10add84e276432d9dd8044679a1028dd4084117e upstream.

Otherwise it is possible to trigger crashes due to the metadata being
inaccessible yet these methods don't safely account for that possibility
without these checks.

Reported-by: Mikulas Patocka &lt;mpatocka@redhat.com&gt;
Signed-off-by: Mike Snitzer &lt;snitzer@redhat.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>dm cache metadata: switch to using the new cursor api for loading metadata</title>
<updated>2016-09-22T15:15:05Z</updated>
<author>
<name>Joe Thornber</name>
</author>
<published>2016-09-20T10:16:00Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f177940a80917044f0ea6fd18ea1bfbdff012050'/>
<id>urn:sha1:f177940a80917044f0ea6fd18ea1bfbdff012050</id>
<content type='text'>
This change offers a pretty significant performance improvement.

Signed-off-by: Joe Thornber &lt;ejt@redhat.com&gt;
Signed-off-by: Mike Snitzer &lt;snitzer@redhat.com&gt;
</content>
</entry>
<entry>
<title>dm cache: speed up writing of the hint array</title>
<updated>2016-09-22T15:15:02Z</updated>
<author>
<name>Joe Thornber</name>
</author>
<published>2016-09-15T13:23:46Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=4e781b498ee5008ede91362d91404a362e7a46b3'/>
<id>urn:sha1:4e781b498ee5008ede91362d91404a362e7a46b3</id>
<content type='text'>
It's far quicker to always delete the hint array and recreate with
dm_array_new() because we avoid the copying caused by mutation.

Also simplifies the policy interface, replacing the walk_hints() with
the simpler get_hint().

Signed-off-by: Joe Thornber &lt;ejt@redhat.com&gt;
Signed-off-by: Mike Snitzer &lt;snitzer@redhat.com&gt;
</content>
</entry>
<entry>
<title>dm cache metadata: fix cmd_read_lock() acquiring write lock</title>
<updated>2016-04-17T15:24:46Z</updated>
<author>
<name>Ahmed Samy</name>
</author>
<published>2016-04-17T05:37:09Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=6545b60baaf880b0cd29a5e89dbe745a06027e89'/>
<id>urn:sha1:6545b60baaf880b0cd29a5e89dbe745a06027e89</id>
<content type='text'>
Commit 9567366fefdd ("dm cache metadata: fix READ_LOCK macros and
cleanup WRITE_LOCK macros") uses down_write() instead of down_read() in
cmd_read_lock(), yet up_read() is used to release the lock in
READ_UNLOCK().  Fix it.

Fixes: 9567366fefdd ("dm cache metadata: fix READ_LOCK macros and cleanup WRITE_LOCK macros")
Cc: stable@vger.kernel.org
Signed-off-by: Ahmed Samy &lt;f.fallen45@gmail.com&gt;
Signed-off-by: Mike Snitzer &lt;snitzer@redhat.com&gt;
</content>
</entry>
<entry>
<title>dm cache metadata: fix READ_LOCK macros and cleanup WRITE_LOCK macros</title>
<updated>2016-04-14T21:34:49Z</updated>
<author>
<name>Mike Snitzer</name>
</author>
<published>2016-04-12T16:14:46Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=9567366fefddeaea4ed1d713270535d93a3b3c76'/>
<id>urn:sha1:9567366fefddeaea4ed1d713270535d93a3b3c76</id>
<content type='text'>
The READ_LOCK macro was incorrectly returning -EINVAL if
dm_bm_is_read_only() was true -- it will always be true once the cache
metadata transitions to read-only by dm_cache_metadata_set_read_only().

Wrap READ_LOCK and WRITE_LOCK multi-statement macros in do {} while(0).
Also, all accesses of the 'cmd' argument passed to these related macros
are now encapsulated in parenthesis.

A follow-up patch can be developed to eliminate the use of macros in
favor of pure C code.  Avoiding that now given that this needs to apply
to stable@.

Reported-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
Signed-off-by: Mike Snitzer &lt;snitzer@redhat.com&gt;
Fixes: d14fcf3dd79 ("dm cache: make sure every metadata function checks fail_io")
Cc: stable@vger.kernel.org
</content>
</entry>
<entry>
<title>dm cache: make sure every metadata function checks fail_io</title>
<updated>2016-03-10T22:12:12Z</updated>
<author>
<name>Joe Thornber</name>
</author>
<published>2016-03-10T16:20:58Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d14fcf3dd79c0b8a8d0ba469c44a6b04f3a1403b'/>
<id>urn:sha1:d14fcf3dd79c0b8a8d0ba469c44a6b04f3a1403b</id>
<content type='text'>
Otherwise operations may be attempted that will only ever go on to crash
(since the metadata device is either missing or unreliable if 'fail_io'
is set).

Signed-off-by: Joe Thornber &lt;ejt@redhat.com&gt;
Signed-off-by: Mike Snitzer &lt;snitzer@redhat.com&gt;
Cc: stable@vger.kernel.org
</content>
</entry>
</feed>
