<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-toradex.git/drivers/md, branch v4.9.49</title>
<subtitle>Linux kernel for Apalis and Colibri modules</subtitle>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/'/>
<entry>
<title>md/raid5: add thread_group worker async_tx_issue_pending_all</title>
<updated>2017-08-07T01:59:40+00:00</updated>
<author>
<name>Ofer Heifetz</name>
<email>oferh@marvell.com</email>
</author>
<published>2017-07-24T06:17:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=fabc7dffe9e123e5be2456139853a7e12c5adce8'/>
<id>fabc7dffe9e123e5be2456139853a7e12c5adce8</id>
<content type='text'>
commit 7e96d559634b73a8158ee99a7abece2eacec2668 upstream.

Since thread_group worker and raid5d kthread are not in sync, if
worker writes stripe before raid5d then requests will be waiting
for issue_pendig.

Issue observed when building raid5 with ext4, in some build runs
jbd2 would get hung and requests were waiting in the HW engine
waiting to be issued.

Fix this by adding a call to async_tx_issue_pending_all in the
raid5_do_work.

Signed-off-by: Ofer Heifetz &lt;oferh@marvell.com&gt;
Signed-off-by: Shaohua Li &lt;shli@fb.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 7e96d559634b73a8158ee99a7abece2eacec2668 upstream.

Since thread_group worker and raid5d kthread are not in sync, if
worker writes stripe before raid5d then requests will be waiting
for issue_pendig.

Issue observed when building raid5 with ext4, in some build runs
jbd2 would get hung and requests were waiting in the HW engine
waiting to be issued.

Fix this by adding a call to async_tx_issue_pending_all in the
raid5_do_work.

Signed-off-by: Ofer Heifetz &lt;oferh@marvell.com&gt;
Signed-off-by: Shaohua Li &lt;shli@fb.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>Raid5 should update rdev-&gt;sectors after reshape</title>
<updated>2017-07-27T22:08:02+00:00</updated>
<author>
<name>Xiao Ni</name>
<email>xni@redhat.com</email>
</author>
<published>2017-07-05T09:34:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=1e95148551f3ea57aef1a97d1b2a825be5a7704a'/>
<id>1e95148551f3ea57aef1a97d1b2a825be5a7704a</id>
<content type='text'>
commit b5d27718f38843a74552e9a93d32e2391fd3999f upstream.

The raid5 md device is created by the disks which we don't use the total size. For example,
the size of the device is 5G and it just uses 3G of the devices to create one raid5 device.
Then change the chunksize and wait reshape to finish. After reshape finishing stop the raid
and assemble it again. It fails.
mdadm -CR /dev/md0 -l5 -n3 /dev/loop[0-2] --size=3G --chunk=32 --assume-clean
mdadm /dev/md0 --grow --chunk=64
wait reshape to finish
mdadm -S /dev/md0
mdadm -As
The error messages:
[197519.814302] md: loop1 does not have a valid v1.2 superblock, not importing!
[197519.821686] md: md_import_device returned -22

After reshape the data offset is changed. It selects backwards direction in this condition.
In function super_1_load it compares the available space of the underlying device with
sb-&gt;data_size. The new data offset gets bigger after reshape. So super_1_load returns -EINVAL.
rdev-&gt;sectors is updated in md_finish_reshape. Then sb-&gt;data_size is set in super_1_sync based
on rdev-&gt;sectors. So add md_finish_reshape in end_reshape.

Signed-off-by: Xiao Ni &lt;xni@redhat.com&gt;
Acked-by: Guoqing Jiang &lt;gqjiang@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>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit b5d27718f38843a74552e9a93d32e2391fd3999f upstream.

The raid5 md device is created by the disks which we don't use the total size. For example,
the size of the device is 5G and it just uses 3G of the devices to create one raid5 device.
Then change the chunksize and wait reshape to finish. After reshape finishing stop the raid
and assemble it again. It fails.
mdadm -CR /dev/md0 -l5 -n3 /dev/loop[0-2] --size=3G --chunk=32 --assume-clean
mdadm /dev/md0 --grow --chunk=64
wait reshape to finish
mdadm -S /dev/md0
mdadm -As
The error messages:
[197519.814302] md: loop1 does not have a valid v1.2 superblock, not importing!
[197519.821686] md: md_import_device returned -22

After reshape the data offset is changed. It selects backwards direction in this condition.
In function super_1_load it compares the available space of the underlying device with
sb-&gt;data_size. The new data offset gets bigger after reshape. So super_1_load returns -EINVAL.
rdev-&gt;sectors is updated in md_finish_reshape. Then sb-&gt;data_size is set in super_1_sync based
on rdev-&gt;sectors. So add md_finish_reshape in end_reshape.

Signed-off-by: Xiao Ni &lt;xni@redhat.com&gt;
Acked-by: Guoqing Jiang &lt;gqjiang@suse.com&gt;
Signed-off-by: Shaohua Li &lt;shli@fb.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>md: don't use flush_signals in userspace processes</title>
<updated>2017-07-27T22:08:01+00:00</updated>
<author>
<name>Mikulas Patocka</name>
<email>mpatocka@redhat.com</email>
</author>
<published>2017-06-07T23:05:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=03c1d9d45582e8a0991747a6f7a3a235b39b3e2b'/>
<id>03c1d9d45582e8a0991747a6f7a3a235b39b3e2b</id>
<content type='text'>
commit f9c79bc05a2a91f4fba8bfd653579e066714b1ec upstream.

The function flush_signals clears all pending signals for the process. It
may be used by kernel threads when we need to prepare a kernel thread for
responding to signals. However using this function for an userspaces
processes is incorrect - clearing signals without the program expecting it
can cause misbehavior.

The raid1 and raid5 code uses flush_signals in its request routine because
it wants to prepare for an interruptible wait. This patch drops
flush_signals and uses sigprocmask instead to block all signals (including
SIGKILL) around the schedule() call. The signals are not lost, but the
schedule() call won't respond to them.

Signed-off-by: Mikulas Patocka &lt;mpatocka@redhat.com&gt;
Acked-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>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit f9c79bc05a2a91f4fba8bfd653579e066714b1ec upstream.

The function flush_signals clears all pending signals for the process. It
may be used by kernel threads when we need to prepare a kernel thread for
responding to signals. However using this function for an userspaces
processes is incorrect - clearing signals without the program expecting it
can cause misbehavior.

The raid1 and raid5 code uses flush_signals in its request routine because
it wants to prepare for an interruptible wait. This patch drops
flush_signals and uses sigprocmask instead to block all signals (including
SIGKILL) around the schedule() call. The signals are not lost, but the
schedule() call won't respond to them.

Signed-off-by: Mikulas Patocka &lt;mpatocka@redhat.com&gt;
Acked-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;

</pre>
</div>
</content>
</entry>
<entry>
<title>dm mpath: cleanup -Wbool-operation warning in choose_pgpath()</title>
<updated>2017-07-27T22:07:55+00:00</updated>
<author>
<name>Mike Snitzer</name>
<email>snitzer@redhat.com</email>
</author>
<published>2017-01-06T20:33:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=63d32e8af0dd6343cde33993eabc9c7562d92fe9'/>
<id>63d32e8af0dd6343cde33993eabc9c7562d92fe9</id>
<content type='text'>
commit d19a55ccad15a486ffe03030570744e5d5bd9f8e upstream.

Reported-by: David Binderman &lt;dcb314@hotmail.com&gt;
Signed-off-by: Mike Snitzer &lt;snitzer@redhat.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit d19a55ccad15a486ffe03030570744e5d5bd9f8e upstream.

Reported-by: David Binderman &lt;dcb314@hotmail.com&gt;
Signed-off-by: Mike Snitzer &lt;snitzer@redhat.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>md: fix super_offset endianness in super_1_rdev_size_change</title>
<updated>2017-07-15T10:16:15+00:00</updated>
<author>
<name>Jason Yan</name>
<email>yanaijie@huawei.com</email>
</author>
<published>2017-03-10T03:27:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=3953403ca660817a33e7f7ad65a265facc0e59c7'/>
<id>3953403ca660817a33e7f7ad65a265facc0e59c7</id>
<content type='text'>
commit 3fb632e40d7667d8bedfabc28850ac06d5493f54 upstream.

The sb-&gt;super_offset should be big-endian, but the rdev-&gt;sb_start is in
host byte order, so fix this by adding cpu_to_le64.

Signed-off-by: Jason Yan &lt;yanaijie@huawei.com&gt;
Signed-off-by: Shaohua Li &lt;shli@fb.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 3fb632e40d7667d8bedfabc28850ac06d5493f54 upstream.

The sb-&gt;super_offset should be big-endian, but the rdev-&gt;sb_start is in
host byte order, so fix this by adding cpu_to_le64.

Signed-off-by: Jason Yan &lt;yanaijie@huawei.com&gt;
Signed-off-by: Shaohua Li &lt;shli@fb.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>md: fix incorrect use of lexx_to_cpu in does_sb_need_changing</title>
<updated>2017-07-15T10:16:15+00:00</updated>
<author>
<name>Jason Yan</name>
<email>yanaijie@huawei.com</email>
</author>
<published>2017-03-10T03:49:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=9a37d02c497cd839beee3e0cab0fc606bcfe08bf'/>
<id>9a37d02c497cd839beee3e0cab0fc606bcfe08bf</id>
<content type='text'>
commit 1345921393ba23b60d3fcf15933e699232ad25ae upstream.

The sb-&gt;layout is of type __le32, so we shoud use le32_to_cpu.

Signed-off-by: Jason Yan &lt;yanaijie@huawei.com&gt;
Signed-off-by: Shaohua Li &lt;shli@fb.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 1345921393ba23b60d3fcf15933e699232ad25ae upstream.

The sb-&gt;layout is of type __le32, so we shoud use le32_to_cpu.

Signed-off-by: Jason Yan &lt;yanaijie@huawei.com&gt;
Signed-off-by: Shaohua Li &lt;shli@fb.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>dm thin: do not queue freed thin mapping for next stage processing</title>
<updated>2017-07-05T12:40:18+00:00</updated>
<author>
<name>Vallish Vaidyeshwara</name>
<email>vallish@amazon.com</email>
</author>
<published>2017-06-23T18:53:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=1c0fa383b3391f1e5528b264bd9b3ca9209054cf'/>
<id>1c0fa383b3391f1e5528b264bd9b3ca9209054cf</id>
<content type='text'>
commit 00a0ea33b495ee6149bf5a77ac5807ce87323abb upstream.

process_prepared_discard_passdown_pt1() should cleanup
dm_thin_new_mapping in cases of error.

dm_pool_inc_data_range() can fail trying to get a block reference:

metadata operation 'dm_pool_inc_data_range' failed: error = -61

When dm_pool_inc_data_range() fails, dm thin aborts current metadata
transaction and marks pool as PM_READ_ONLY. Memory for thin mapping
is released as well. However, current thin mapping will be queued
onto next stage as part of queue_passdown_pt2() or passdown_endio().
This dangling thin mapping memory when processed and accessed in
next stage will lead to device mapper crashing.

Code flow without fix:
-&gt; process_prepared_discard_passdown_pt1(m)
   -&gt; dm_thin_remove_range()
   -&gt; discard passdown
      --&gt; passdown_endio(m) queues m onto next stage
   -&gt; dm_pool_inc_data_range() fails, frees memory m
            but does not remove it from next stage queue

-&gt; process_prepared_discard_passdown_pt2(m)
   -&gt; processes freed memory m and crashes

One such stack:

Call Trace:
[&lt;ffffffffa037a46f&gt;] dm_cell_release_no_holder+0x2f/0x70 [dm_bio_prison]
[&lt;ffffffffa039b6dc&gt;] cell_defer_no_holder+0x3c/0x80 [dm_thin_pool]
[&lt;ffffffffa039b88b&gt;] process_prepared_discard_passdown_pt2+0x4b/0x90 [dm_thin_pool]
[&lt;ffffffffa0399611&gt;] process_prepared+0x81/0xa0 [dm_thin_pool]
[&lt;ffffffffa039e735&gt;] do_worker+0xc5/0x820 [dm_thin_pool]
[&lt;ffffffff8152bf54&gt;] ? __schedule+0x244/0x680
[&lt;ffffffff81087e72&gt;] ? pwq_activate_delayed_work+0x42/0xb0
[&lt;ffffffff81089f53&gt;] process_one_work+0x153/0x3f0
[&lt;ffffffff8108a71b&gt;] worker_thread+0x12b/0x4b0
[&lt;ffffffff8108a5f0&gt;] ? rescuer_thread+0x350/0x350
[&lt;ffffffff8108fd6a&gt;] kthread+0xca/0xe0
[&lt;ffffffff8108fca0&gt;] ? kthread_park+0x60/0x60
[&lt;ffffffff81530b45&gt;] ret_from_fork+0x25/0x30

The fix is to first take the block ref count for discarded block and
then do a passdown discard of this block. If block ref count fails,
then bail out aborting current metadata transaction, mark pool as
PM_READ_ONLY and also free current thin mapping memory (existing error
handling code) without queueing this thin mapping onto next stage of
processing. If block ref count succeeds, then passdown discard of this
block. Discard callback of passdown_endio() will queue this thin mapping
onto next stage of processing.

Code flow with fix:
-&gt; process_prepared_discard_passdown_pt1(m)
   -&gt; dm_thin_remove_range()
   -&gt; dm_pool_inc_data_range()
      --&gt; if fails, free memory m and bail out
   -&gt; discard passdown
      --&gt; passdown_endio(m) queues m onto next stage

Reviewed-by: Eduardo Valentin &lt;eduval@amazon.com&gt;
Reviewed-by: Cristian Gafton &lt;gafton@amazon.com&gt;
Reviewed-by: Anchal Agarwal &lt;anchalag@amazon.com&gt;
Signed-off-by: Vallish Vaidyeshwara &lt;vallish@amazon.com&gt;
Reviewed-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>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 00a0ea33b495ee6149bf5a77ac5807ce87323abb upstream.

process_prepared_discard_passdown_pt1() should cleanup
dm_thin_new_mapping in cases of error.

dm_pool_inc_data_range() can fail trying to get a block reference:

metadata operation 'dm_pool_inc_data_range' failed: error = -61

When dm_pool_inc_data_range() fails, dm thin aborts current metadata
transaction and marks pool as PM_READ_ONLY. Memory for thin mapping
is released as well. However, current thin mapping will be queued
onto next stage as part of queue_passdown_pt2() or passdown_endio().
This dangling thin mapping memory when processed and accessed in
next stage will lead to device mapper crashing.

Code flow without fix:
-&gt; process_prepared_discard_passdown_pt1(m)
   -&gt; dm_thin_remove_range()
   -&gt; discard passdown
      --&gt; passdown_endio(m) queues m onto next stage
   -&gt; dm_pool_inc_data_range() fails, frees memory m
            but does not remove it from next stage queue

-&gt; process_prepared_discard_passdown_pt2(m)
   -&gt; processes freed memory m and crashes

One such stack:

Call Trace:
[&lt;ffffffffa037a46f&gt;] dm_cell_release_no_holder+0x2f/0x70 [dm_bio_prison]
[&lt;ffffffffa039b6dc&gt;] cell_defer_no_holder+0x3c/0x80 [dm_thin_pool]
[&lt;ffffffffa039b88b&gt;] process_prepared_discard_passdown_pt2+0x4b/0x90 [dm_thin_pool]
[&lt;ffffffffa0399611&gt;] process_prepared+0x81/0xa0 [dm_thin_pool]
[&lt;ffffffffa039e735&gt;] do_worker+0xc5/0x820 [dm_thin_pool]
[&lt;ffffffff8152bf54&gt;] ? __schedule+0x244/0x680
[&lt;ffffffff81087e72&gt;] ? pwq_activate_delayed_work+0x42/0xb0
[&lt;ffffffff81089f53&gt;] process_one_work+0x153/0x3f0
[&lt;ffffffff8108a71b&gt;] worker_thread+0x12b/0x4b0
[&lt;ffffffff8108a5f0&gt;] ? rescuer_thread+0x350/0x350
[&lt;ffffffff8108fd6a&gt;] kthread+0xca/0xe0
[&lt;ffffffff8108fca0&gt;] ? kthread_park+0x60/0x60
[&lt;ffffffff81530b45&gt;] ret_from_fork+0x25/0x30

The fix is to first take the block ref count for discarded block and
then do a passdown discard of this block. If block ref count fails,
then bail out aborting current metadata transaction, mark pool as
PM_READ_ONLY and also free current thin mapping memory (existing error
handling code) without queueing this thin mapping onto next stage of
processing. If block ref count succeeds, then passdown discard of this
block. Discard callback of passdown_endio() will queue this thin mapping
onto next stage of processing.

Code flow with fix:
-&gt; process_prepared_discard_passdown_pt1(m)
   -&gt; dm_thin_remove_range()
   -&gt; dm_pool_inc_data_range()
      --&gt; if fails, free memory m and bail out
   -&gt; discard passdown
      --&gt; passdown_endio(m) queues m onto next stage

Reviewed-by: Eduardo Valentin &lt;eduval@amazon.com&gt;
Reviewed-by: Cristian Gafton &lt;gafton@amazon.com&gt;
Reviewed-by: Anchal Agarwal &lt;anchalag@amazon.com&gt;
Signed-off-by: Vallish Vaidyeshwara &lt;vallish@amazon.com&gt;
Reviewed-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;

</pre>
</div>
</content>
</entry>
<entry>
<title>md: MD_CLOSING needs to be cleared after called md_set_readonly or do_md_stop</title>
<updated>2017-05-25T13:44:33+00:00</updated>
<author>
<name>NeilBrown</name>
<email>neilb@suse.com</email>
</author>
<published>2017-04-06T03:16:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=7e789787878321fc2b1b7869963fa5eeede7402e'/>
<id>7e789787878321fc2b1b7869963fa5eeede7402e</id>
<content type='text'>
commit 065e519e71b2c1f41936cce75b46b5ab34adb588 upstream.

if called md_set_readonly and set MD_CLOSING bit, the mddev cannot
be opened any more due to the MD_CLOING bit wasn't cleared. Thus it
needs to be cleared in md_ioctl after any call to md_set_readonly()
or do_md_stop().

Signed-off-by: NeilBrown &lt;neilb@suse.com&gt;
Fixes: af8d8e6f0315 ("md: changes for MD_STILL_CLOSED flag")
Signed-off-by: Zhilong Liu &lt;zlliu@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>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 065e519e71b2c1f41936cce75b46b5ab34adb588 upstream.

if called md_set_readonly and set MD_CLOSING bit, the mddev cannot
be opened any more due to the MD_CLOING bit wasn't cleared. Thus it
needs to be cleared in md_ioctl after any call to md_set_readonly()
or do_md_stop().

Signed-off-by: NeilBrown &lt;neilb@suse.com&gt;
Fixes: af8d8e6f0315 ("md: changes for MD_STILL_CLOSED flag")
Signed-off-by: Zhilong Liu &lt;zlliu@suse.com&gt;
Signed-off-by: Shaohua Li &lt;shli@fb.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>md: update slab_cache before releasing new stripes when stripes resizing</title>
<updated>2017-05-25T13:44:33+00:00</updated>
<author>
<name>Dennis Yang</name>
<email>dennisyang@qnap.com</email>
</author>
<published>2017-03-29T07:46:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=fa9a4a9c6d6ffb21c220418384ed9d89f8c18e35'/>
<id>fa9a4a9c6d6ffb21c220418384ed9d89f8c18e35</id>
<content type='text'>
commit 583da48e388f472e8818d9bb60ef6a1d40ee9f9d upstream.

When growing raid5 device on machine with small memory, there is chance that
mdadm will be killed and the following bug report can be observed. The same
bug could also be reproduced in linux-4.10.6.

[57600.075774] BUG: unable to handle kernel NULL pointer dereference at           (null)
[57600.083796] IP: [&lt;ffffffff81a6aa87&gt;] _raw_spin_lock+0x7/0x20
[57600.110378] PGD 421cf067 PUD 4442d067 PMD 0
[57600.114678] Oops: 0002 [#1] SMP
[57600.180799] CPU: 1 PID: 25990 Comm: mdadm Tainted: P           O    4.2.8 #1
[57600.187849] Hardware name: To be filled by O.E.M. To be filled by O.E.M./MAHOBAY, BIOS QV05AR66 03/06/2013
[57600.197490] task: ffff880044e47240 ti: ffff880043070000 task.ti: ffff880043070000
[57600.204963] RIP: 0010:[&lt;ffffffff81a6aa87&gt;]  [&lt;ffffffff81a6aa87&gt;] _raw_spin_lock+0x7/0x20
[57600.213057] RSP: 0018:ffff880043073810  EFLAGS: 00010046
[57600.218359] RAX: 0000000000000000 RBX: 000000000000000c RCX: ffff88011e296dd0
[57600.225486] RDX: 0000000000000001 RSI: ffffe8ffffcb46c0 RDI: 0000000000000000
[57600.232613] RBP: ffff880043073878 R08: ffff88011e5f8170 R09: 0000000000000282
[57600.239739] R10: 0000000000000005 R11: 28f5c28f5c28f5c3 R12: ffff880043073838
[57600.246872] R13: ffffe8ffffcb46c0 R14: 0000000000000000 R15: ffff8800b9706a00
[57600.253999] FS:  00007f576106c700(0000) GS:ffff88011e280000(0000) knlGS:0000000000000000
[57600.262078] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[57600.267817] CR2: 0000000000000000 CR3: 00000000428fe000 CR4: 00000000001406e0
[57600.274942] Stack:
[57600.276949]  ffffffff8114ee35 ffff880043073868 0000000000000282 000000000000eb3f
[57600.284383]  ffffffff81119043 ffff880043073838 ffff880043073838 ffff88003e197b98
[57600.291820]  ffffe8ffffcb46c0 ffff88003e197360 0000000000000286 ffff880043073968
[57600.299254] Call Trace:
[57600.301698]  [&lt;ffffffff8114ee35&gt;] ? cache_flusharray+0x35/0xe0
[57600.307523]  [&lt;ffffffff81119043&gt;] ? __page_cache_release+0x23/0x110
[57600.313779]  [&lt;ffffffff8114eb53&gt;] kmem_cache_free+0x63/0xc0
[57600.319344]  [&lt;ffffffff81579942&gt;] drop_one_stripe+0x62/0x90
[57600.324915]  [&lt;ffffffff81579b5b&gt;] raid5_cache_scan+0x8b/0xb0
[57600.330563]  [&lt;ffffffff8111b98a&gt;] shrink_slab.part.36+0x19a/0x250
[57600.336650]  [&lt;ffffffff8111e38c&gt;] shrink_zone+0x23c/0x250
[57600.342039]  [&lt;ffffffff8111e4f3&gt;] do_try_to_free_pages+0x153/0x420
[57600.348210]  [&lt;ffffffff8111e851&gt;] try_to_free_pages+0x91/0xa0
[57600.353959]  [&lt;ffffffff811145b1&gt;] __alloc_pages_nodemask+0x4d1/0x8b0
[57600.360303]  [&lt;ffffffff8157a30b&gt;] check_reshape+0x62b/0x770
[57600.365866]  [&lt;ffffffff8157a4a5&gt;] raid5_check_reshape+0x55/0xa0
[57600.371778]  [&lt;ffffffff81583df7&gt;] update_raid_disks+0xc7/0x110
[57600.377604]  [&lt;ffffffff81592b73&gt;] md_ioctl+0xd83/0x1b10
[57600.382827]  [&lt;ffffffff81385380&gt;] blkdev_ioctl+0x170/0x690
[57600.388307]  [&lt;ffffffff81195238&gt;] block_ioctl+0x38/0x40
[57600.393525]  [&lt;ffffffff811731c5&gt;] do_vfs_ioctl+0x2b5/0x480
[57600.399010]  [&lt;ffffffff8115e07b&gt;] ? vfs_write+0x14b/0x1f0
[57600.404400]  [&lt;ffffffff811733cc&gt;] SyS_ioctl+0x3c/0x70
[57600.409447]  [&lt;ffffffff81a6ad97&gt;] entry_SYSCALL_64_fastpath+0x12/0x6a
[57600.415875] Code: 00 00 00 00 55 48 89 e5 8b 07 85 c0 74 04 31 c0 5d c3 ba 01 00 00 00 f0 0f b1 17 85 c0 75 ef b0 01 5d c3 90 31 c0 ba 01 00 00 00 &lt;f0&gt; 0f b1 17 85 c0 75 01 c3 55 89 c6 48 89 e5 e8 85 d1 63 ff 5d
[57600.435460] RIP  [&lt;ffffffff81a6aa87&gt;] _raw_spin_lock+0x7/0x20
[57600.441208]  RSP &lt;ffff880043073810&gt;
[57600.444690] CR2: 0000000000000000
[57600.448000] ---[ end trace cbc6b5cc4bf9831d ]---

The problem is that resize_stripes() releases new stripe_heads before assigning new
slab cache to conf-&gt;slab_cache. If the shrinker function raid5_cache_scan() gets called
after resize_stripes() starting releasing new stripes but right before new slab cache
being assigned, it is possible that these new stripe_heads will be freed with the old
slab_cache which was already been destoryed and that triggers this bug.

Signed-off-by: Dennis Yang &lt;dennisyang@qnap.com&gt;
Fixes: edbe83ab4c27 ("md/raid5: allow the stripe_cache to grow and shrink.")
Reviewed-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>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 583da48e388f472e8818d9bb60ef6a1d40ee9f9d upstream.

When growing raid5 device on machine with small memory, there is chance that
mdadm will be killed and the following bug report can be observed. The same
bug could also be reproduced in linux-4.10.6.

[57600.075774] BUG: unable to handle kernel NULL pointer dereference at           (null)
[57600.083796] IP: [&lt;ffffffff81a6aa87&gt;] _raw_spin_lock+0x7/0x20
[57600.110378] PGD 421cf067 PUD 4442d067 PMD 0
[57600.114678] Oops: 0002 [#1] SMP
[57600.180799] CPU: 1 PID: 25990 Comm: mdadm Tainted: P           O    4.2.8 #1
[57600.187849] Hardware name: To be filled by O.E.M. To be filled by O.E.M./MAHOBAY, BIOS QV05AR66 03/06/2013
[57600.197490] task: ffff880044e47240 ti: ffff880043070000 task.ti: ffff880043070000
[57600.204963] RIP: 0010:[&lt;ffffffff81a6aa87&gt;]  [&lt;ffffffff81a6aa87&gt;] _raw_spin_lock+0x7/0x20
[57600.213057] RSP: 0018:ffff880043073810  EFLAGS: 00010046
[57600.218359] RAX: 0000000000000000 RBX: 000000000000000c RCX: ffff88011e296dd0
[57600.225486] RDX: 0000000000000001 RSI: ffffe8ffffcb46c0 RDI: 0000000000000000
[57600.232613] RBP: ffff880043073878 R08: ffff88011e5f8170 R09: 0000000000000282
[57600.239739] R10: 0000000000000005 R11: 28f5c28f5c28f5c3 R12: ffff880043073838
[57600.246872] R13: ffffe8ffffcb46c0 R14: 0000000000000000 R15: ffff8800b9706a00
[57600.253999] FS:  00007f576106c700(0000) GS:ffff88011e280000(0000) knlGS:0000000000000000
[57600.262078] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[57600.267817] CR2: 0000000000000000 CR3: 00000000428fe000 CR4: 00000000001406e0
[57600.274942] Stack:
[57600.276949]  ffffffff8114ee35 ffff880043073868 0000000000000282 000000000000eb3f
[57600.284383]  ffffffff81119043 ffff880043073838 ffff880043073838 ffff88003e197b98
[57600.291820]  ffffe8ffffcb46c0 ffff88003e197360 0000000000000286 ffff880043073968
[57600.299254] Call Trace:
[57600.301698]  [&lt;ffffffff8114ee35&gt;] ? cache_flusharray+0x35/0xe0
[57600.307523]  [&lt;ffffffff81119043&gt;] ? __page_cache_release+0x23/0x110
[57600.313779]  [&lt;ffffffff8114eb53&gt;] kmem_cache_free+0x63/0xc0
[57600.319344]  [&lt;ffffffff81579942&gt;] drop_one_stripe+0x62/0x90
[57600.324915]  [&lt;ffffffff81579b5b&gt;] raid5_cache_scan+0x8b/0xb0
[57600.330563]  [&lt;ffffffff8111b98a&gt;] shrink_slab.part.36+0x19a/0x250
[57600.336650]  [&lt;ffffffff8111e38c&gt;] shrink_zone+0x23c/0x250
[57600.342039]  [&lt;ffffffff8111e4f3&gt;] do_try_to_free_pages+0x153/0x420
[57600.348210]  [&lt;ffffffff8111e851&gt;] try_to_free_pages+0x91/0xa0
[57600.353959]  [&lt;ffffffff811145b1&gt;] __alloc_pages_nodemask+0x4d1/0x8b0
[57600.360303]  [&lt;ffffffff8157a30b&gt;] check_reshape+0x62b/0x770
[57600.365866]  [&lt;ffffffff8157a4a5&gt;] raid5_check_reshape+0x55/0xa0
[57600.371778]  [&lt;ffffffff81583df7&gt;] update_raid_disks+0xc7/0x110
[57600.377604]  [&lt;ffffffff81592b73&gt;] md_ioctl+0xd83/0x1b10
[57600.382827]  [&lt;ffffffff81385380&gt;] blkdev_ioctl+0x170/0x690
[57600.388307]  [&lt;ffffffff81195238&gt;] block_ioctl+0x38/0x40
[57600.393525]  [&lt;ffffffff811731c5&gt;] do_vfs_ioctl+0x2b5/0x480
[57600.399010]  [&lt;ffffffff8115e07b&gt;] ? vfs_write+0x14b/0x1f0
[57600.404400]  [&lt;ffffffff811733cc&gt;] SyS_ioctl+0x3c/0x70
[57600.409447]  [&lt;ffffffff81a6ad97&gt;] entry_SYSCALL_64_fastpath+0x12/0x6a
[57600.415875] Code: 00 00 00 00 55 48 89 e5 8b 07 85 c0 74 04 31 c0 5d c3 ba 01 00 00 00 f0 0f b1 17 85 c0 75 ef b0 01 5d c3 90 31 c0 ba 01 00 00 00 &lt;f0&gt; 0f b1 17 85 c0 75 01 c3 55 89 c6 48 89 e5 e8 85 d1 63 ff 5d
[57600.435460] RIP  [&lt;ffffffff81a6aa87&gt;] _raw_spin_lock+0x7/0x20
[57600.441208]  RSP &lt;ffff880043073810&gt;
[57600.444690] CR2: 0000000000000000
[57600.448000] ---[ end trace cbc6b5cc4bf9831d ]---

The problem is that resize_stripes() releases new stripe_heads before assigning new
slab cache to conf-&gt;slab_cache. If the shrinker function raid5_cache_scan() gets called
after resize_stripes() starting releasing new stripes but right before new slab cache
being assigned, it is possible that these new stripe_heads will be freed with the old
slab_cache which was already been destoryed and that triggers this bug.

Signed-off-by: Dennis Yang &lt;dennisyang@qnap.com&gt;
Fixes: edbe83ab4c27 ("md/raid5: allow the stripe_cache to grow and shrink.")
Reviewed-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;

</pre>
</div>
</content>
</entry>
<entry>
<title>dm space map disk: fix some book keeping in the disk space map</title>
<updated>2017-05-25T13:44:33+00:00</updated>
<author>
<name>Joe Thornber</name>
<email>ejt@redhat.com</email>
</author>
<published>2017-05-15T13:45:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=f2bb8bcbc09dfe32138efc44105be9a58fad5cef'/>
<id>f2bb8bcbc09dfe32138efc44105be9a58fad5cef</id>
<content type='text'>
commit 0377a07c7a035e0d033cd8b29f0cb15244c0916a upstream.

When decrementing the reference count for a block, the free count wasn't
being updated if the reference count went to zero.

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>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 0377a07c7a035e0d033cd8b29f0cb15244c0916a upstream.

When decrementing the reference count for a block, the free count wasn't
being updated if the reference count went to zero.

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;

</pre>
</div>
</content>
</entry>
</feed>
