<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/drivers/md/bcache, branch v4.5</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v4.5</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v4.5'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2016-01-22T02:19:38Z</updated>
<entry>
<title>Merge branch 'for-4.5/drivers' of git://git.kernel.dk/linux-block</title>
<updated>2016-01-22T02:19:38Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2016-01-22T02:19:38Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=641203549a21ba6a701aecd05c3dfc969ec670cc'/>
<id>urn:sha1:641203549a21ba6a701aecd05c3dfc969ec670cc</id>
<content type='text'>
Pull block driver updates from Jens Axboe:
 "This is the block driver pull request for 4.5, with the exception of
  NVMe, which is in a separate branch and will be posted after this one.

  This pull request contains:

   - A set of bcache stability fixes, which have been acked by Kent.
     These have been used and tested for more than a year by the
     community, so it's about time that they got in.

   - A set of drbd updates from the drbd team (Andreas, Lars, Philipp)
     and Markus Elfring, Oleg Drokin.

   - A set of fixes for xen blkback/front from the usual suspects, (Bob,
     Konrad) as well as community based fixes from Kiri, Julien, and
     Peng.

   - A 2038 time fix for sx8 from Shraddha, with a fix from me.

   - A small mtip32xx cleanup from Zhu Yanjun.

   - A null_blk division fix from Arnd"

* 'for-4.5/drivers' of git://git.kernel.dk/linux-block: (71 commits)
  null_blk: use sector_div instead of do_div
  mtip32xx: restrict variables visible in current code module
  xen/blkfront: Fix crash if backend doesn't follow the right states.
  xen/blkback: Fix two memory leaks.
  xen/blkback: make st_ statistics per ring
  xen/blkfront: Handle non-indirect grant with 64KB pages
  xen-blkfront: Introduce blkif_ring_get_request
  xen-blkback: clear PF_NOFREEZE for xen_blkif_schedule()
  xen/blkback: Free resources if connect_ring failed.
  xen/blocks: Return -EXX instead of -1
  xen/blkback: make pool of persistent grants and free pages per-queue
  xen/blkback: get the number of hardware queues/rings from blkfront
  xen/blkback: pseudo support for multi hardware queues/rings
  xen/blkback: separate ring information out of struct xen_blkif
  xen/blkfront: correct setting for xen_blkif_max_ring_order
  xen/blkfront: make persistent grants pool per-queue
  xen/blkfront: Remove duplicate setting of -&gt;xbdev.
  xen/blkfront: Cleanup of comments, fix unaligned variables, and syntax errors.
  xen/blkfront: negotiate number of queues/rings to be used with backend
  xen/blkfront: split per device io_lock
  ...
</content>
</entry>
<entry>
<title>md: more open-coded offset_in_page()</title>
<updated>2016-01-04T15:29:12Z</updated>
<author>
<name>Al Viro</name>
<email>viro@zeniv.linux.org.uk</email>
</author>
<published>2016-01-02T18:30:54Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=93bbf5831dd1742a98c57b6415ee84ce35425067'/>
<id>urn:sha1:93bbf5831dd1742a98c57b6415ee84ce35425067</id>
<content type='text'>
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>bcache: Change refill_dirty() to always scan entire disk if necessary</title>
<updated>2015-12-31T03:23:16Z</updated>
<author>
<name>Kent Overstreet</name>
<email>kent.overstreet@gmail.com</email>
</author>
<published>2015-11-30T02:47:01Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=627ccd20b4ad3ba836472468208e2ac4dfadbf03'/>
<id>urn:sha1:627ccd20b4ad3ba836472468208e2ac4dfadbf03</id>
<content type='text'>
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;
</content>
</entry>
<entry>
<title>bcache: prevent crash on changing writeback_running</title>
<updated>2015-12-31T03:23:14Z</updated>
<author>
<name>Stefan Bader</name>
<email>stefan.bader@canonical.com</email>
</author>
<published>2015-11-30T02:44:49Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=8d16ce540c94c9d366eb36fc91b7154d92d6397b'/>
<id>urn:sha1:8d16ce540c94c9d366eb36fc91b7154d92d6397b</id>
<content type='text'>
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;
</content>
</entry>
<entry>
<title>bcache: allows use of register in udev to avoid "device_busy" error.</title>
<updated>2015-12-31T03:23:13Z</updated>
<author>
<name>Gabriel de Perthuis</name>
<email>g2p.code@gmail.com</email>
</author>
<published>2015-11-30T02:40:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=d7076f21629f8f329bca4a44dc408d94670f49e2'/>
<id>urn:sha1:d7076f21629f8f329bca4a44dc408d94670f49e2</id>
<content type='text'>
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;
</content>
</entry>
<entry>
<title>bcache: unregister reboot notifier if bcache fails to unregister device</title>
<updated>2015-12-31T03:23:11Z</updated>
<author>
<name>Zheng Liu</name>
<email>wenqing.lz@taobao.com</email>
</author>
<published>2015-11-30T01:21:57Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=2ecf0cdb2b437402110ab57546e02abfa68a716b'/>
<id>urn:sha1:2ecf0cdb2b437402110ab57546e02abfa68a716b</id>
<content type='text'>
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;
</content>
</entry>
<entry>
<title>bcache: fix a leak in bch_cached_dev_run()</title>
<updated>2015-12-31T03:23:10Z</updated>
<author>
<name>Al Viro</name>
<email>viro@ZenIV.linux.org.uk</email>
</author>
<published>2015-11-30T01:20:59Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=4d4d8573a8451acc9f01cbea24b7e55f04a252fe'/>
<id>urn:sha1:4d4d8573a8451acc9f01cbea24b7e55f04a252fe</id>
<content type='text'>
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;
</content>
</entry>
<entry>
<title>bcache: clear BCACHE_DEV_UNLINK_DONE flag when attaching a backing device</title>
<updated>2015-12-31T03:23:08Z</updated>
<author>
<name>Zheng Liu</name>
<email>wenqing.lz@taobao.com</email>
</author>
<published>2015-11-30T01:19:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=fecaee6f20ee122ad75402c53d8278f9bb142ddc'/>
<id>urn:sha1:fecaee6f20ee122ad75402c53d8278f9bb142ddc</id>
<content type='text'>
This bug can be reproduced by the following script:

  #!/bin/bash

  bcache_sysfs="/sys/fs/bcache"

  function clear_cache()
  {
  	if [ ! -e $bcache_sysfs ]; then
  		echo "no bcache sysfs"
  		exit
  	fi

  	cset_uuid=$(ls -l $bcache_sysfs|head -n 2|tail -n 1|awk '{print $9}')
  	sudo sh -c "echo $cset_uuid &gt; /sys/block/sdb/sdb1/bcache/detach"
  	sleep 5
  	sudo sh -c "echo $cset_uuid &gt; /sys/block/sdb/sdb1/bcache/attach"
  }

  for ((i=0;i&lt;10;i++)); do
  	clear_cache
  done

The warning messages look like below:
[  275.948611] ------------[ cut here ]------------
[  275.963840] WARNING: at fs/sysfs/dir.c:512 sysfs_add_one+0xb8/0xd0() (Tainted: P        W
---------------   )
[  275.979253] Hardware name: Tecal RH2285
[  275.994106] sysfs: cannot create duplicate filename '/devices/pci0000:00/0000:00:09.0/0000:08:00.0/host4/target4:2:1/4:2:1:0/block/sdb/sdb1/bcache/cache'
[  276.024105] Modules linked in: bcache tcp_diag inet_diag ipmi_devintf ipmi_si ipmi_msghandler
bonding 8021q garp stp llc ipv6 ext3 jbd loop sg iomemory_vsl(P) bnx2 microcode serio_raw i2c_i801
i2c_core iTCO_wdt iTCO_vendor_support i7core_edac edac_core shpchp ext4 jbd2 mbcache megaraid_sas
pata_acpi ata_generic ata_piix dm_mod [last unloaded: scsi_wait_scan]
[  276.072643] Pid: 2765, comm: sh Tainted: P        W  ---------------    2.6.32 #1
[  276.089315] Call Trace:
[  276.105801]  [&lt;ffffffff81070fe7&gt;] ? warn_slowpath_common+0x87/0xc0
[  276.122650]  [&lt;ffffffff810710d6&gt;] ? warn_slowpath_fmt+0x46/0x50
[  276.139361]  [&lt;ffffffff81205c08&gt;] ? sysfs_add_one+0xb8/0xd0
[  276.156012]  [&lt;ffffffff8120609b&gt;] ? sysfs_do_create_link+0x12b/0x170
[  276.172682]  [&lt;ffffffff81206113&gt;] ? sysfs_create_link+0x13/0x20
[  276.189282]  [&lt;ffffffffa03bda21&gt;] ? bcache_device_link+0xc1/0x110 [bcache]
[  276.205993]  [&lt;ffffffffa03bfa08&gt;] ? bch_cached_dev_attach+0x478/0x4f0 [bcache]
[  276.222794]  [&lt;ffffffffa03c4a17&gt;] ? bch_cached_dev_store+0x627/0x780 [bcache]
[  276.239680]  [&lt;ffffffff8116783a&gt;] ? alloc_pages_current+0xaa/0x110
[  276.256594]  [&lt;ffffffff81203b15&gt;] ? sysfs_write_file+0xe5/0x170
[  276.273364]  [&lt;ffffffff811887b8&gt;] ? vfs_write+0xb8/0x1a0
[  276.290133]  [&lt;ffffffff811890b1&gt;] ? sys_write+0x51/0x90
[  276.306368]  [&lt;ffffffff8100c072&gt;] ? system_call_fastpath+0x16/0x1b
[  276.322301] ---[ end trace 9f5d4fcdd0c3edfb ]---
[  276.338241] ------------[ cut here ]------------
[  276.354109] WARNING: at /home/wenqing.lz/bcache/bcache/super.c:720
bcache_device_link+0xdf/0x110 [bcache]() (Tainted: P        W  ---------------   )
[  276.386017] Hardware name: Tecal RH2285
[  276.401430] Couldn't create device &lt;-&gt; cache set symlinks
[  276.401759] Modules linked in: bcache tcp_diag inet_diag ipmi_devintf ipmi_si ipmi_msghandler
bonding 8021q garp stp llc ipv6 ext3 jbd loop sg iomemory_vsl(P) bnx2 microcode serio_raw i2c_i801
i2c_core iTCO_wdt iTCO_vendor_support i7core_edac edac_core shpchp ext4 jbd2 mbcache megaraid_sas
pata_acpi ata_generic ata_piix dm_mod [last unloaded: scsi_wait_scan]
[  276.465477] Pid: 2765, comm: sh Tainted: P        W  ---------------    2.6.32 #1
[  276.482169] Call Trace:
[  276.498610]  [&lt;ffffffff81070fe7&gt;] ? warn_slowpath_common+0x87/0xc0
[  276.515405]  [&lt;ffffffff810710d6&gt;] ? warn_slowpath_fmt+0x46/0x50
[  276.532059]  [&lt;ffffffffa03bda3f&gt;] ? bcache_device_link+0xdf/0x110 [bcache]
[  276.548808]  [&lt;ffffffffa03bfa08&gt;] ? bch_cached_dev_attach+0x478/0x4f0 [bcache]
[  276.565569]  [&lt;ffffffffa03c4a17&gt;] ? bch_cached_dev_store+0x627/0x780 [bcache]
[  276.582418]  [&lt;ffffffff8116783a&gt;] ? alloc_pages_current+0xaa/0x110
[  276.599341]  [&lt;ffffffff81203b15&gt;] ? sysfs_write_file+0xe5/0x170
[  276.616142]  [&lt;ffffffff811887b8&gt;] ? vfs_write+0xb8/0x1a0
[  276.632607]  [&lt;ffffffff811890b1&gt;] ? sys_write+0x51/0x90
[  276.648671]  [&lt;ffffffff8100c072&gt;] ? system_call_fastpath+0x16/0x1b
[  276.664756] ---[ end trace 9f5d4fcdd0c3edfc ]---

We forget to clear BCACHE_DEV_UNLINK_DONE flag in bcache_device_attach()
function when we attach a backing device first time.  After detaching this
backing device, this flag will be true and sysfs_remove_link() isn't called in
bcache_device_unlink().  Then when we attach this backing device again,
sysfs_create_link() will return EEXIST error in bcache_device_link().

So the fix is trival and we clear this flag in bcache_device_link().

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;
</content>
</entry>
<entry>
<title>bcache: Add a cond_resched() call to gc</title>
<updated>2015-12-31T03:23:06Z</updated>
<author>
<name>Kent Overstreet</name>
<email>kmo@daterainc.com</email>
</author>
<published>2015-11-30T01:18:33Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=c5f1e5adf956e3ba82d204c7c141a75da9fa449a'/>
<id>urn:sha1:c5f1e5adf956e3ba82d204c7c141a75da9fa449a</id>
<content type='text'>
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&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;
</content>
</entry>
<entry>
<title>bcache: fix a livelock when we cause a huge number of cache misses</title>
<updated>2015-12-31T03:23:05Z</updated>
<author>
<name>Zheng Liu</name>
<email>gnehzuil.liu@gmail.com</email>
</author>
<published>2015-11-30T01:17:05Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=2ef9ccbfcb90cf84bdba320a571b18b05c41101b'/>
<id>urn:sha1:2ef9ccbfcb90cf84bdba320a571b18b05c41101b</id>
<content type='text'>
Subject :	[PATCH v2] bcache: fix a livelock in btree lock
Date :	Wed, 25 Feb 2015 20:32:09 +0800 (02/25/2015 04:32:09 AM)

This commit tries to fix a livelock in bcache.  This livelock might
happen when we causes a huge number of cache misses simultaneously.

When we get a cache miss, bcache will execute the following path.

-&gt;cached_dev_make_request()
  -&gt;cached_dev_read()
    -&gt;cached_lookup()
      -&gt;bch-&gt;btree_map_keys()
        -&gt;btree_root()  &lt;------------------------
          -&gt;bch_btree_map_keys_recurse()        |
            -&gt;cache_lookup_fn()                 |
              -&gt;cached_dev_cache_miss()         |
                -&gt;bch_btree_insert_check_key() -|
                  [If btree-&gt;seq is not equal to seq + 1, we should return
                   EINTR and traverse btree again.]

In bch_btree_insert_check_key() function we first need to check upgrade
flag (op-&gt;lock == -1), and when this flag is true we need to release
read btree-&gt;lock and try to take write btree-&gt;lock.  During taking and
releasing this write lock, btree-&gt;seq will be monotone increased in
order to prevent other threads modify this in cache miss (see btree.h:74).
But if there are some cache misses caused by some requested, we could
meet a livelock because btree-&gt;seq is always changed by others.  Thus no
one can make progress.

This commit will try to take write btree-&gt;lock if it encounters a race
when we traverse btree.  Although it sacrifice the scalability but we
can ensure that only one can modify the btree.

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: Joshua Schmid &lt;jschmid@suse.com&gt;
Cc: Zhu Yanhai &lt;zhu.yanhai@gmail.com&gt;
Cc: Kent Overstreet &lt;kmo@daterainc.com&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Jens Axboe &lt;axboe@fb.com&gt;
</content>
</entry>
</feed>
