<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/linux.git/drivers/md/persistent-data, branch v3.12.13</title>
<subtitle>Linux Kernel
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v3.12.13</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v3.12.13'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/'/>
<updated>2014-02-13T21:50:18Z</updated>
<entry>
<title>dm space map metadata: fix bug in resizing of thin metadata</title>
<updated>2014-02-13T21:50:18Z</updated>
<author>
<name>Joe Thornber</name>
<email>ejt@redhat.com</email>
</author>
<published>2014-01-21T11:07:32Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=f78c448024f25c7121493203a09b527ee8eeae8a'/>
<id>urn:sha1:f78c448024f25c7121493203a09b527ee8eeae8a</id>
<content type='text'>
commit fca028438fb903852beaf7c3fe1cd326651af57d upstream.

This bug was introduced in commit 7e664b3dec431e ("dm space map metadata:
fix extending the space map").

When extending a dm-thin metadata volume we:

- Switch the space map into a simple bootstrap mode, which allocates
  all space linearly from the newly added space.
- Add new bitmap entries for the new space
- Increment the reference counts for those newly allocated bitmap
  entries
- Commit changes to disk
- Switch back out of bootstrap mode.

But, the disk commit may allocate space itself, if so this fact will be
lost when switching out of bootstrap mode.

The bug exhibited itself as an error when the bitmap_root, with an
erroneous ref count of 0, was subsequently decremented as part of a
later disk commit.  This would cause the disk commit to fail, and thinp
to enter read_only mode.  The metadata was not damaged (thin_check
passed).

The fix is to put the increments + commit into a loop, running until
the commit has not allocated extra space.  In practise this loop only
runs twice.

With this fix the following device mapper testsuite test passes:
 dmtest run --suite thin-provisioning -n thin_remove_works_after_resize

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 space map metadata: fix extending the space map</title>
<updated>2014-02-13T21:50:18Z</updated>
<author>
<name>Joe Thornber</name>
<email>ejt@redhat.com</email>
</author>
<published>2014-01-07T15:49:02Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=43b9f1c8cac351b8a5f9fb923a357e276e59e9c4'/>
<id>urn:sha1:43b9f1c8cac351b8a5f9fb923a357e276e59e9c4</id>
<content type='text'>
commit 7e664b3dec431eebf0c5df5ff704d6197634cf35 upstream.

When extending a metadata space map we should do the first commit whilst
still in bootstrap mode -- a mode where all blocks get allocated in the
new area.

That way the commit overhead is allocated from the newly added space.
Otherwise we risk running out of space.

With this fix, and the previous commit "dm space map common: make sure
new space is used during extend", the following device mapper testsuite
test passes:
 dmtest run --suite thin-provisioning -n /resize_metadata_no_io/

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 space map common: make sure new space is used during extend</title>
<updated>2014-02-13T21:50:17Z</updated>
<author>
<name>Joe Thornber</name>
<email>ejt@redhat.com</email>
</author>
<published>2014-01-07T15:47:59Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=650afddad9fefe54cc3a3daf4cb7b21b172294db'/>
<id>urn:sha1:650afddad9fefe54cc3a3daf4cb7b21b172294db</id>
<content type='text'>
commit 12c91a5c2d2a8e8cc40a9552313e1e7b0a2d9ee3 upstream.

When extending a low level space map we should update nr_blocks at
the start so the new space is used for the index entries.

Otherwise extend can fail, e.g.: sm_metadata_extend call sequence
that fails:
 -&gt; sm_ll_extend
    -&gt; dm_tm_new_block -&gt; dm_sm_new_block -&gt; sm_bootstrap_new_block
    =&gt; returns -ENOSPC because smm-&gt;begin == smm-&gt;ll.nr_blocks

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 thin: allow pool in read-only mode to transition to read-write mode</title>
<updated>2013-12-20T15:49:05Z</updated>
<author>
<name>Joe Thornber</name>
<email>ejt@redhat.com</email>
</author>
<published>2013-12-04T21:58:19Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=3e9c394744efc5d872bce0762637e31d7f54cda6'/>
<id>urn:sha1:3e9c394744efc5d872bce0762637e31d7f54cda6</id>
<content type='text'>
commit 9b7aaa64f96f7ca280d75326fca42f42017b89ef upstream.

A thin-pool may be in read-only mode because the pool's data or metadata
space was exhausted.  To allow for recovery, by adding more space to the
pool, we must allow a pool to transition from PM_READ_ONLY to PM_WRITE
mode.  Otherwise, running out of space will render the pool permanently
read-only.

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 space map: disallow decrementing a reference count below zero</title>
<updated>2013-12-20T15:49:04Z</updated>
<author>
<name>Joe Thornber</name>
<email>ejt@redhat.com</email>
</author>
<published>2013-12-13T12:31:08Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=cb4d254628bb8f74d9034eb701600555939c6143'/>
<id>urn:sha1:cb4d254628bb8f74d9034eb701600555939c6143</id>
<content type='text'>
commit 5b564d80f8bc21094c0cd2b19b679d983aabcc29 upstream.

The old behaviour, returning -EINVAL if a ref_count of 0 would be
decremented, was removed in commit f722063 ("dm space map: optimise
sm_ll_dec and sm_ll_inc").  To fix this regression we return an error
code from the mutator function pointer passed to sm_ll_mutate() and have
dec_ref_count() return -EINVAL if the old ref_count is 0.

Add a DMERR to reflect the potential seriousness of this error.

Also, add missing dm_tm_unlock() to sm_ll_mutate()'s error path.

With this fix the following dmts regression test now passes:
 dmtest run --suite cache -n /metadata_use_kernel/

The next patch fixes the higher-level dm-array code that exposed this
regression.

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 space map metadata: return on failure in sm_metadata_new_block</title>
<updated>2013-12-20T15:49:04Z</updated>
<author>
<name>Mike Snitzer</name>
<email>snitzer@redhat.com</email>
</author>
<published>2013-12-02T21:47:01Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=bc09538e4813d30b98dc1aae91c6e2345626f2bd'/>
<id>urn:sha1:bc09538e4813d30b98dc1aae91c6e2345626f2bd</id>
<content type='text'>
commit f62b6b8f498658a9d537c7d380e9966f15e1b2a1 upstream.

Commit 2fc48021f4afdd109b9e52b6eef5db89ca80bac7 ("dm persistent
metadata: add space map threshold callback") introduced a regression
to the metadata block allocation path that resulted in errors being
ignored.  This regression was uncovered by running the following
device-mapper-test-suite test:
dmtest run --suite thin-provisioning -n /exhausting_metadata_space_causes_fail_mode/

The ignored error codes in sm_metadata_new_block() could crash the
kernel through use of either the dm-thin or dm-cache targets, e.g.:

device-mapper: thin: 253:4: reached low water mark for metadata device: sending event.
device-mapper: space map metadata: unable to allocate new metadata block
general protection fault: 0000 [#1] SMP
...
Workqueue: dm-thin do_worker [dm_thin_pool]
task: ffff880035ce2ab0 ti: ffff88021a054000 task.ti: ffff88021a054000
RIP: 0010:[&lt;ffffffffa0331385&gt;]  [&lt;ffffffffa0331385&gt;] metadata_ll_load_ie+0x15/0x30 [dm_persistent_data]
RSP: 0018:ffff88021a055a68  EFLAGS: 00010202
RAX: 003fc8243d212ba0 RBX: ffff88021a780070 RCX: ffff88021a055a78
RDX: ffff88021a055a78 RSI: 0040402222a92a80 RDI: ffff88021a780070
RBP: ffff88021a055a68 R08: ffff88021a055ba4 R09: 0000000000000010
R10: 0000000000000000 R11: 00000002a02e1000 R12: ffff88021a055ad4
R13: 0000000000000598 R14: ffffffffa0338470 R15: ffff88021a055ba4
FS:  0000000000000000(0000) GS:ffff88033fca0000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
CR2: 00007f467c0291b8 CR3: 0000000001a0b000 CR4: 00000000000007e0
Stack:
 ffff88021a055ab8 ffffffffa0332020 ffff88021a055b30 0000000000000001
 ffff88021a055b30 0000000000000000 ffff88021a055b18 0000000000000000
 ffff88021a055ba4 ffff88021a055b98 ffff88021a055ae8 ffffffffa033304c
Call Trace:
 [&lt;ffffffffa0332020&gt;] sm_ll_lookup_bitmap+0x40/0xa0 [dm_persistent_data]
 [&lt;ffffffffa033304c&gt;] sm_metadata_count_is_more_than_one+0x8c/0xc0 [dm_persistent_data]
 [&lt;ffffffffa0333825&gt;] dm_tm_shadow_block+0x65/0x110 [dm_persistent_data]
 [&lt;ffffffffa0331b00&gt;] sm_ll_mutate+0x80/0x300 [dm_persistent_data]
 [&lt;ffffffffa0330e60&gt;] ? set_ref_count+0x10/0x10 [dm_persistent_data]
 [&lt;ffffffffa0331dba&gt;] sm_ll_inc+0x1a/0x20 [dm_persistent_data]
 [&lt;ffffffffa0332270&gt;] sm_disk_new_block+0x60/0x80 [dm_persistent_data]
 [&lt;ffffffff81520036&gt;] ? down_write+0x16/0x40
 [&lt;ffffffffa001e5c4&gt;] dm_pool_alloc_data_block+0x54/0x80 [dm_thin_pool]
 [&lt;ffffffffa001b23c&gt;] alloc_data_block+0x9c/0x130 [dm_thin_pool]
 [&lt;ffffffffa001c27e&gt;] provision_block+0x4e/0x180 [dm_thin_pool]
 [&lt;ffffffffa001fe9a&gt;] ? dm_thin_find_block+0x6a/0x110 [dm_thin_pool]
 [&lt;ffffffffa001c57a&gt;] process_bio+0x1ca/0x1f0 [dm_thin_pool]
 [&lt;ffffffff8111e2ed&gt;] ? mempool_free+0x8d/0xa0
 [&lt;ffffffffa001d755&gt;] process_deferred_bios+0xc5/0x230 [dm_thin_pool]
 [&lt;ffffffffa001d911&gt;] do_worker+0x51/0x60 [dm_thin_pool]
 [&lt;ffffffff81067872&gt;] process_one_work+0x182/0x3b0
 [&lt;ffffffff81068c90&gt;] worker_thread+0x120/0x3a0
 [&lt;ffffffff81068b70&gt;] ? manage_workers+0x160/0x160
 [&lt;ffffffff8106eb2e&gt;] kthread+0xce/0xe0
 [&lt;ffffffff8106ea60&gt;] ? kthread_freezable_should_stop+0x70/0x70
 [&lt;ffffffff8152af6c&gt;] ret_from_fork+0x7c/0xb0
 [&lt;ffffffff8106ea60&gt;] ? kthread_freezable_should_stop+0x70/0x70
 [&lt;ffffffff8152af6c&gt;] ret_from_fork+0x7c/0xb0
 [&lt;ffffffff8106ea60&gt;] ? kthread_freezable_should_stop+0x70/0x70

Signed-off-by: Mike Snitzer &lt;snitzer@redhat.com&gt;
Acked-by: Joe Thornber &lt;ejt@redhat.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>dm array: fix a reference counting bug in shadow_ablock</title>
<updated>2013-12-20T15:49:04Z</updated>
<author>
<name>Joe Thornber</name>
<email>ejt@redhat.com</email>
</author>
<published>2013-12-13T14:55:55Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=7a3b9049fe0fa103b836bb706077de0e2a9c01aa'/>
<id>urn:sha1:7a3b9049fe0fa103b836bb706077de0e2a9c01aa</id>
<content type='text'>
commit ed9571f0cf1fe09d3506302610f3ccdfa1d22c4a upstream.

An old array block could have its reference count decremented below
zero when it is being replaced in the btree by a new array block.

The fix is to increment the old ablock's reference count just before
inserting a new ablock into the btree.

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 array: fix bug in growing array</title>
<updated>2013-12-04T19:05:27Z</updated>
<author>
<name>Joe Thornber</name>
<email>ejt@redhat.com</email>
</author>
<published>2013-10-30T11:19:59Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=884d5952afcbee9d56961663051390dda586107f'/>
<id>urn:sha1:884d5952afcbee9d56961663051390dda586107f</id>
<content type='text'>
commit 9c1d4de56066e4d6abc66ec188faafd7b303fb08 upstream.

Entries would be lost if the old tail block was partially filled.

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 space map: optimise sm_ll_dec and sm_ll_inc</title>
<updated>2013-08-23T13:02:14Z</updated>
<author>
<name>Joe Thornber</name>
<email>ejt@redhat.com</email>
</author>
<published>2013-08-09T12:04:56Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=f722063ee01c0060488e1000006405449451cfa0'/>
<id>urn:sha1:f722063ee01c0060488e1000006405449451cfa0</id>
<content type='text'>
Prior to this patch these methods did a lookup followed by an insert.
Instead they now call a common mutate function that adjusts the value
according to a callback function.  This avoids traversing the data
structures twice and hence improves performance.

Also factor out sm_ll_lookup_big_ref_count() for use by both
sm_ll_lookup() and sm_ll_mutate().

Signed-off-by: Joe Thornber &lt;ejt@redhat.com&gt;
Signed-off-by: Mike Snitzer &lt;snitzer@redhat.com&gt;
Signed-off-by: Alasdair G Kergon &lt;agk@redhat.com&gt;
</content>
</entry>
<entry>
<title>dm btree: prefetch child nodes when walking tree for a dm_btree_del</title>
<updated>2013-08-23T13:02:14Z</updated>
<author>
<name>Joe Thornber</name>
<email>ejt@redhat.com</email>
</author>
<published>2013-08-09T11:59:30Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=04f17c802f447e76d13ade5bb78fbbf34baef0f8'/>
<id>urn:sha1:04f17c802f447e76d13ade5bb78fbbf34baef0f8</id>
<content type='text'>
dm-btree now takes advantage of dm-bufio's ability to prefetch data via
dm_bm_prefetch().  Prior to this change many btree node visits were
causing a synchronous read.

Signed-off-by: Joe Thornber &lt;ejt@redhat.com&gt;
Signed-off-by: Mike Snitzer &lt;snitzer@redhat.com&gt;
Signed-off-by: Alasdair G Kergon &lt;agk@redhat.com&gt;
</content>
</entry>
</feed>
