<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/md/bcache, branch v3.18.62</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v3.18.62</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v3.18.62'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2016-09-01T02:05:44+00:00</updated>
<entry>
<title>bcache: RESERVE_PRIO is too small by one when prio_buckets() is a power of two.</title>
<updated>2016-09-01T02:05:44+00:00</updated>
<author>
<name>Kent Overstreet</name>
<email>kent.overstreet@gmail.com</email>
</author>
<published>2016-08-18T01:21:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=3dd120f43407cb270b40cfe931430517a604c914'/>
<id>urn:sha1:3dd120f43407cb270b40cfe931430517a604c914</id>
<content type='text'>
[ Upstream commit acc9cf8c66c66b2cbbdb4a375537edee72be64df ]

This patch fixes a cachedev registration-time allocation deadlock.
This can deadlock on boot if your initrd auto-registeres bcache devices:

Allocator thread:
[  720.727614] INFO: task bcache_allocato:3833 blocked for more than 120 seconds.
[  720.732361]  [&lt;ffffffff816eeac7&gt;] schedule+0x37/0x90
[  720.732963]  [&lt;ffffffffa05192b8&gt;] bch_bucket_alloc+0x188/0x360 [bcache]
[  720.733538]  [&lt;ffffffff810e6950&gt;] ? prepare_to_wait_event+0xf0/0xf0
[  720.734137]  [&lt;ffffffffa05302bd&gt;] bch_prio_write+0x19d/0x340 [bcache]
[  720.734715]  [&lt;ffffffffa05190bf&gt;] bch_allocator_thread+0x3ff/0x470 [bcache]
[  720.735311]  [&lt;ffffffff816ee41c&gt;] ? __schedule+0x2dc/0x950
[  720.735884]  [&lt;ffffffffa0518cc0&gt;] ? invalidate_buckets+0x980/0x980 [bcache]

Registration thread:
[  720.710403] INFO: task bash:3531 blocked for more than 120 seconds.
[  720.715226]  [&lt;ffffffff816eeac7&gt;] schedule+0x37/0x90
[  720.715805]  [&lt;ffffffffa05235cd&gt;] __bch_btree_map_nodes+0x12d/0x150 [bcache]
[  720.716409]  [&lt;ffffffffa0522d30&gt;] ? bch_btree_insert_check_key+0x1c0/0x1c0 [bcache]
[  720.717008]  [&lt;ffffffffa05236e4&gt;] bch_btree_insert+0xf4/0x170 [bcache]
[  720.717586]  [&lt;ffffffff810e6950&gt;] ? prepare_to_wait_event+0xf0/0xf0
[  720.718191]  [&lt;ffffffffa0527d9a&gt;] bch_journal_replay+0x14a/0x290 [bcache]
[  720.718766]  [&lt;ffffffff810cc90d&gt;] ? ttwu_do_activate.constprop.94+0x5d/0x70
[  720.719369]  [&lt;ffffffff810cf684&gt;] ? try_to_wake_up+0x1d4/0x350
[  720.719968]  [&lt;ffffffffa05317d0&gt;] run_cache_set+0x580/0x8e0 [bcache]
[  720.720553]  [&lt;ffffffffa053302e&gt;] register_bcache+0xe2e/0x13b0 [bcache]
[  720.721153]  [&lt;ffffffff81354cef&gt;] kobj_attr_store+0xf/0x20
[  720.721730]  [&lt;ffffffff812a2dad&gt;] sysfs_kf_write+0x3d/0x50
[  720.722327]  [&lt;ffffffff812a225a&gt;] kernfs_fop_write+0x12a/0x180
[  720.722904]  [&lt;ffffffff81225177&gt;] __vfs_write+0x37/0x110
[  720.723503]  [&lt;ffffffff81228048&gt;] ? __sb_start_write+0x58/0x110
[  720.724100]  [&lt;ffffffff812cedb3&gt;] ? security_file_permission+0x23/0xa0
[  720.724675]  [&lt;ffffffff812258a9&gt;] vfs_write+0xa9/0x1b0
[  720.725275]  [&lt;ffffffff8102479c&gt;] ? do_audit_syscall_entry+0x6c/0x70
[  720.725849]  [&lt;ffffffff81226755&gt;] SyS_write+0x55/0xd0
[  720.726451]  [&lt;ffffffff8106a390&gt;] ? do_page_fault+0x30/0x80
[  720.727045]  [&lt;ffffffff816f2cae&gt;] system_call_fastpath+0x12/0x71

The fifo code in upstream bcache can't use the last element in the buffer,
which was the cause of the bug: if you asked for a power of two size,
it'd give you a fifo that could hold one less than what you asked for
rather than allocating a buffer twice as big.

Signed-off-by: Kent Overstreet &lt;kent.overstreet@gmail.com&gt;
Tested-by: Eric Wheeler &lt;bcache@linux.ewheeler.net&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Sasha Levin &lt;alexander.levin@verizon.com&gt;
</content>
</entry>
<entry>
<title>bcache: register_bcache(): call blkdev_put() when cache_alloc() fails</title>
<updated>2016-09-01T02:05:44+00:00</updated>
<author>
<name>Eric Wheeler</name>
<email>git@linux.ewheeler.net</email>
</author>
<published>2016-06-17T22:01:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=472ea0f4001a7e1a70d1063dd2cf2831949c325b'/>
<id>urn:sha1:472ea0f4001a7e1a70d1063dd2cf2831949c325b</id>
<content type='text'>
[ Upstream commit d9dc1702b297ec4a6bb9c0326a70641b322ba886 ]

register_cache() is supposed to return an error string on error so that
register_bcache() will will blkdev_put and cleanup other user counters,
but it does not set 'char *err' when cache_alloc() fails (eg, due to
memory pressure) and thus register_bcache() performs no cleanup.

register_bcache() &lt;----------\  &lt;- no jump to err_close, no blkdev_put()
   |                         |
   +-&gt;register_cache()       |  &lt;- fails to set char *err
         |                   |
         +-&gt;cache_alloc() ---/  &lt;- returns error

This patch sets `char *err` for this failure case so that register_cache()
will cause register_bcache() to correctly jump to err_close and do
cleanup.  This was tested under OOM conditions that triggered the bug.

Signed-off-by: Eric Wheeler &lt;bcache@linux.ewheeler.net&gt;
Cc: Kent Overstreet &lt;kent.overstreet@gmail.com&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Sasha Levin &lt;alexander.levin@verizon.com&gt;
</content>
</entry>
<entry>
<title>bcache: fix cache_set_flush() NULL pointer dereference on OOM</title>
<updated>2016-04-18T12:49:25+00:00</updated>
<author>
<name>Eric Wheeler</name>
<email>git@linux.ewheeler.net</email>
</author>
<published>2016-03-07T23:17:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=3629c42c9918a763d75786479f384a00324ec4f0'/>
<id>urn:sha1:3629c42c9918a763d75786479f384a00324ec4f0</id>
<content type='text'>
[ Upstream commit f8b11260a445169989d01df75d35af0f56178f95 ]

When bch_cache_set_alloc() fails to kzalloc the cache_set, the
asyncronous closure handling tries to dereference a cache_set that
hadn't yet been allocated inside of cache_set_flush() which is called
by __cache_set_unregister() during cleanup.  This appears to happen only
during an OOM condition on bcache_register.

Signed-off-by: Eric Wheeler &lt;bcache@linux.ewheeler.net&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Sasha Levin &lt;sasha.levin@oracle.com&gt;
</content>
</entry>
<entry>
<title>bcache: cleaned up error handling around register_cache()</title>
<updated>2016-04-18T12:49:25+00:00</updated>
<author>
<name>Eric Wheeler</name>
<email>git@linux.ewheeler.net</email>
</author>
<published>2016-02-26T22:33:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=6af6167c3f1905018cde0262ceae7e07b70cb577'/>
<id>urn:sha1:6af6167c3f1905018cde0262ceae7e07b70cb577</id>
<content type='text'>
[ Upstream commit 9b299728ed777428b3908ac72ace5f8f84b97789 ]

Fix null pointer dereference by changing register_cache() to return an int
instead of being void.  This allows it to return -ENOMEM or -ENODEV and
enables upper layers to handle the OOM case without NULL pointer issues.

See this thread:
  http://thread.gmane.org/gmane.linux.kernel.bcache.devel/3521

Fixes this error:
  gargamel:/sys/block/md5/bcache# echo /dev/sdh2 &gt; /sys/fs/bcache/register

  bcache: register_cache() error opening sdh2: cannot allocate memory
  BUG: unable to handle kernel NULL pointer dereference at 00000000000009b8
  IP: [&lt;ffffffffc05a7e8d&gt;] cache_set_flush+0x102/0x15c [bcache]
  PGD 120dff067 PUD 1119a3067 PMD 0
  Oops: 0000 [#1] SMP
  Modules linked in: veth ip6table_filter ip6_tables
  (...)
  CPU: 4 PID: 3371 Comm: kworker/4:3 Not tainted 4.4.2-amd64-i915-volpreempt-20160213bc1 #3
  Hardware name: System manufacturer System Product Name/P8H67-M PRO, BIOS 3904 04/27/2013
  Workqueue: events cache_set_flush [bcache]
  task: ffff88020d5dc280 ti: ffff88020b6f8000 task.ti: ffff88020b6f8000
  RIP: 0010:[&lt;ffffffffc05a7e8d&gt;]  [&lt;ffffffffc05a7e8d&gt;] cache_set_flush+0x102/0x15c [bcache]

Signed-off-by: Eric Wheeler &lt;bcache@linux.ewheeler.net&gt;
Tested-by: Marc MERLIN &lt;marc@merlins.org&gt;
Cc: &lt;stable@vger.kernel.org&gt;
Signed-off-by: Sasha Levin &lt;sasha.levin@oracle.com&gt;
</content>
</entry>
<entry>
<title>bcache: fix race of writeback thread starting before complete initialization</title>
<updated>2016-04-18T12:49:25+00:00</updated>
<author>
<name>Eric Wheeler</name>
<email>git@linux.ewheeler.net</email>
</author>
<published>2016-02-26T22:39:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=c2f87b5d704608a0ca412d511ff2ca8b7eb1ff36'/>
<id>urn:sha1:c2f87b5d704608a0ca412d511ff2ca8b7eb1ff36</id>
<content type='text'>
[ Upstream commit 07cc6ef8edc47f8b4fc1e276d31127a0a5863d4d ]

The bch_writeback_thread might BUG_ON in read_dirty() if
dc-&gt;sb==BDEV_STATE_DIRTY and bch_sectors_dirty_init has not yet completed
its related initialization.  This patch downs the dc-&gt;writeback_lock until
after initialization is complete, thus preventing bch_writeback_thread
from proceeding prematurely.

See this thread:
  http://thread.gmane.org/gmane.linux.kernel.bcache.devel/3453

Signed-off-by: Eric Wheeler &lt;bcache@linux.ewheeler.net&gt;
Tested-by: Marc MERLIN &lt;marc@merlins.org&gt;
Cc: &lt;stable@vger.kernel.org&gt;
Signed-off-by: Jens Axboe &lt;axboe@fb.com&gt;
Signed-off-by: Sasha Levin &lt;sasha.levin@oracle.com&gt;
</content>
</entry>
<entry>
<title>bcache: Change refill_dirty() to always scan entire disk if necessary</title>
<updated>2016-02-10T03:56:17+00:00</updated>
<author>
<name>Kent Overstreet</name>
<email>kent.overstreet@gmail.com</email>
</author>
<published>2015-11-30T02:47:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=234bf2369de5c3f82d32287b007552fbedeb46c2'/>
<id>urn:sha1:234bf2369de5c3f82d32287b007552fbedeb46c2</id>
<content type='text'>
[ Upstream commit 627ccd20b4ad3ba836472468208e2ac4dfadbf03 ]

Previously, it would only scan the entire disk if it was starting from
the very start of the disk - i.e. if the previous scan got to the end.

This was broken by refill_full_stripes(), which updates last_scanned so
that refill_dirty was never triggering the searched_from_start path.

But if we change refill_dirty() to always scan the entire disk if
necessary, regardless of what last_scanned was, the code gets cleaner
and we fix that bug too.

Signed-off-by: Kent Overstreet &lt;kent.overstreet@gmail.com&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Jens Axboe &lt;axboe@fb.com&gt;
Signed-off-by: Sasha Levin &lt;sasha.levin@oracle.com&gt;
</content>
</entry>
<entry>
<title>bcache: prevent crash on changing writeback_running</title>
<updated>2016-02-10T03:56:17+00:00</updated>
<author>
<name>Stefan Bader</name>
<email>stefan.bader@canonical.com</email>
</author>
<published>2015-11-30T02:44:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=fa362f255a283516f852b5405ba30462da7b6f5e'/>
<id>urn:sha1:fa362f255a283516f852b5405ba30462da7b6f5e</id>
<content type='text'>
[ Upstream commit 8d16ce540c94c9d366eb36fc91b7154d92d6397b ]

Added a safeguard in the shutdown case. At least while not being
attached it is also possible to trigger a kernel bug by writing into
writeback_running. This change  adds the same check before trying to
wake up the thread for that case.

Signed-off-by: Stefan Bader &lt;stefan.bader@canonical.com&gt;
Cc: Kent Overstreet &lt;kent.overstreet@gmail.com&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Jens Axboe &lt;axboe@fb.com&gt;
Signed-off-by: Sasha Levin &lt;sasha.levin@oracle.com&gt;
</content>
</entry>
<entry>
<title>bcache: allows use of register in udev to avoid "device_busy" error.</title>
<updated>2016-02-10T03:56:17+00:00</updated>
<author>
<name>Gabriel de Perthuis</name>
<email>g2p.code@gmail.com</email>
</author>
<published>2015-11-30T02:40:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=e321fdfb1a07ad716265a24346dbe0814b102c09'/>
<id>urn:sha1:e321fdfb1a07ad716265a24346dbe0814b102c09</id>
<content type='text'>
[ Upstream commit d7076f21629f8f329bca4a44dc408d94670f49e2 ]

Allows to use register, not register_quiet in udev to avoid "device_busy" error.
The initial patch proposed at https://lkml.org/lkml/2013/8/26/549 by Gabriel de Perthuis
&lt;g2p.code@gmail.com&gt; does not unlock the mutex and hangs the kernel.

See http://thread.gmane.org/gmane.linux.kernel.bcache.devel/2594 for the discussion.

Cc: Denis Bychkov &lt;manover@gmail.com&gt;
Cc: Kent Overstreet &lt;kent.overstreet@gmail.com&gt;
Cc: Eric Wheeler &lt;bcache@linux.ewheeler.net&gt;
Cc: Gabriel de Perthuis &lt;g2p.code@gmail.com&gt;
Cc: stable@vger.kernel.org

Signed-off-by: Jens Axboe &lt;axboe@fb.com&gt;
Signed-off-by: Sasha Levin &lt;sasha.levin@oracle.com&gt;
</content>
</entry>
<entry>
<title>bcache: unregister reboot notifier if bcache fails to unregister device</title>
<updated>2016-02-10T03:56:16+00:00</updated>
<author>
<name>Zheng Liu</name>
<email>wenqing.lz@taobao.com</email>
</author>
<published>2015-11-30T01:21:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=de406db368382f0f93beddfbd39a46c8fead5eec'/>
<id>urn:sha1:de406db368382f0f93beddfbd39a46c8fead5eec</id>
<content type='text'>
[ Upstream commit 2ecf0cdb2b437402110ab57546e02abfa68a716b ]

In bcache_init() function it forgot to unregister reboot notifier if
bcache fails to unregister a block device.  This commit fixes this.

Signed-off-by: Zheng Liu &lt;wenqing.lz@taobao.com&gt;
Tested-by: Joshua Schmid &lt;jschmid@suse.com&gt;
Tested-by: Eric Wheeler &lt;bcache@linux.ewheeler.net&gt;
Cc: Kent Overstreet &lt;kmo@daterainc.com&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Jens Axboe &lt;axboe@fb.com&gt;
Signed-off-by: Sasha Levin &lt;sasha.levin@oracle.com&gt;
</content>
</entry>
<entry>
<title>bcache: fix a leak in bch_cached_dev_run()</title>
<updated>2016-02-10T03:56:16+00:00</updated>
<author>
<name>Al Viro</name>
<email>viro@ZenIV.linux.org.uk</email>
</author>
<published>2015-11-30T01:20:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=f997a6ac49a7de81cff6c9a44223a7537744a11d'/>
<id>urn:sha1:f997a6ac49a7de81cff6c9a44223a7537744a11d</id>
<content type='text'>
[ Upstream commit 4d4d8573a8451acc9f01cbea24b7e55f04a252fe ]

Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Tested-by: Joshua Schmid &lt;jschmid@suse.com&gt;
Tested-by: Eric Wheeler &lt;bcache@linux.ewheeler.net&gt;
Cc: Kent Overstreet &lt;kmo@daterainc.com&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Jens Axboe &lt;axboe@fb.com&gt;
Signed-off-by: Sasha Levin &lt;sasha.levin@oracle.com&gt;
</content>
</entry>
</feed>
