<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/block, branch v4.0.7</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v4.0.7</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v4.0.7'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2015-06-23T00:03:36+00:00</updated>
<entry>
<title>blk-mq: free hctx-&gt;ctxs in queue's release handler</title>
<updated>2015-06-23T00:03:36+00:00</updated>
<author>
<name>Ming Lei</name>
<email>tom.leiming@gmail.com</email>
</author>
<published>2015-06-04T14:25:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=3804579f5c6fd113c65099c79629e7db857d0e87'/>
<id>urn:sha1:3804579f5c6fd113c65099c79629e7db857d0e87</id>
<content type='text'>
commit c3b4afca7023b5aa0531912364246e67f79b3010 upstream.

Now blk_cleanup_queue() can be called before calling
del_gendisk()[1], inside which hctx-&gt;ctxs is touched
from blk_mq_unregister_hctx(), but the variable has
been freed by blk_cleanup_queue() at that time.

So this patch moves freeing of hctx-&gt;ctxs into queue's
release handler for fixing the oops reported by Stefan.

[1], 6cd18e711dd8075 (block: destroy bdi before blockdev is
unregistered)

Reported-by: Stefan Seyfried &lt;stefan.seyfried@googlemail.com&gt;
Cc: NeilBrown &lt;neilb@suse.de&gt;
Cc: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: Ming Lei &lt;tom.leiming@gmail.com&gt;
Signed-off-by: Jens Axboe &lt;axboe@fb.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>block: discard bdi_unregister() in favour of bdi_destroy()</title>
<updated>2015-06-23T00:03:29+00:00</updated>
<author>
<name>NeilBrown</name>
<email>neilb@suse.de</email>
</author>
<published>2015-05-19T05:58:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=9e58b828f8480f951328fdb339876c22d07c8861'/>
<id>urn:sha1:9e58b828f8480f951328fdb339876c22d07c8861</id>
<content type='text'>
commit aad653a0bc09dd4ebcb5579f9f835bbae9ef2ba3 upstream.

bdi_unregister() now contains very little functionality.

It contains a "WARN_ON" if bdi-&gt;dev is NULL.  This warning is of no
real consequence as bdi-&gt;dev isn't needed by anything else in the function,
and it triggers if
   blk_cleanup_queue() -&gt; bdi_destroy()
is called before bdi_unregister, which happens since
  Commit: 6cd18e711dd8 ("block: destroy bdi before blockdev is unregistered.")

So this isn't wanted.

It also calls bdi_set_min_ratio().  This needs to be called after
writes through the bdi have all been flushed, and before the bdi is destroyed.
Calling it early is better than calling it late as it frees up a global
resource.

Calling it immediately after bdi_wb_shutdown() in bdi_destroy()
perfectly fits these requirements.

So bdi_unregister() can be discarded with the important content moved to
bdi_destroy(), as can the
  writeback_bdi_unregister
event which is already not used.

Reported-by: Mike Snitzer &lt;snitzer@redhat.com&gt;
Fixes: c4db59d31e39 ("fs: don't reassign dirty inodes to default_backing_dev_info")
Fixes: 6cd18e711dd8 ("block: destroy bdi before blockdev is unregistered.")
Acked-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Acked-by: Dan Williams &lt;dan.j.williams@intel.com&gt;
Tested-by: Nicholas Moulin &lt;nicholas.w.moulin@linux.intel.com&gt;
Signed-off-by: NeilBrown &lt;neilb@suse.de&gt;
Reviewed-by: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: Jens Axboe &lt;axboe@fb.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>block: fix ext_dev_lock lockdep report</title>
<updated>2015-06-23T00:03:28+00:00</updated>
<author>
<name>Dan Williams</name>
<email>dan.j.williams@intel.com</email>
</author>
<published>2015-06-11T03:47:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=4fc9b9d84ffc216cf8d142e501e25d5441f1ff0d'/>
<id>urn:sha1:4fc9b9d84ffc216cf8d142e501e25d5441f1ff0d</id>
<content type='text'>
commit 4d66e5e9b6d720d8463e11d027bd4ad91c8b1318 upstream.

 =================================
 [ INFO: inconsistent lock state ]
 4.1.0-rc7+ #217 Tainted: G           O
 ---------------------------------
 inconsistent {SOFTIRQ-ON-W} -&gt; {IN-SOFTIRQ-W} usage.
 swapper/6/0 [HC0[0]:SC1[1]:HE1:SE0] takes:
  (ext_devt_lock){+.?...}, at: [&lt;ffffffff8143a60c&gt;] blk_free_devt+0x3c/0x70
 {SOFTIRQ-ON-W} state was registered at:
   [&lt;ffffffff810bf6b1&gt;] __lock_acquire+0x461/0x1e70
   [&lt;ffffffff810c1947&gt;] lock_acquire+0xb7/0x290
   [&lt;ffffffff818ac3a8&gt;] _raw_spin_lock+0x38/0x50
   [&lt;ffffffff8143a07d&gt;] blk_alloc_devt+0x6d/0xd0  &lt;-- take the lock in process context
[..]
  [&lt;ffffffff810bf64e&gt;] __lock_acquire+0x3fe/0x1e70
  [&lt;ffffffff810c00ad&gt;] ? __lock_acquire+0xe5d/0x1e70
  [&lt;ffffffff810c1947&gt;] lock_acquire+0xb7/0x290
  [&lt;ffffffff8143a60c&gt;] ? blk_free_devt+0x3c/0x70
  [&lt;ffffffff818ac3a8&gt;] _raw_spin_lock+0x38/0x50
  [&lt;ffffffff8143a60c&gt;] ? blk_free_devt+0x3c/0x70
  [&lt;ffffffff8143a60c&gt;] blk_free_devt+0x3c/0x70    &lt;-- take the lock in softirq
  [&lt;ffffffff8143bfec&gt;] part_release+0x1c/0x50
  [&lt;ffffffff8158edf6&gt;] device_release+0x36/0xb0
  [&lt;ffffffff8145ac2b&gt;] kobject_cleanup+0x7b/0x1a0
  [&lt;ffffffff8145aad0&gt;] kobject_put+0x30/0x70
  [&lt;ffffffff8158f147&gt;] put_device+0x17/0x20
  [&lt;ffffffff8143c29c&gt;] delete_partition_rcu_cb+0x16c/0x180
  [&lt;ffffffff8143c130&gt;] ? read_dev_sector+0xa0/0xa0
  [&lt;ffffffff810e0e0f&gt;] rcu_process_callbacks+0x2ff/0xa90
  [&lt;ffffffff810e0dcf&gt;] ? rcu_process_callbacks+0x2bf/0xa90
  [&lt;ffffffff81067e2e&gt;] __do_softirq+0xde/0x600

Neil sees this in his tests and it also triggers on pmem driver unbind
for the libnvdimm tests.  This fix is on top of an initial fix by Keith
for incorrect usage of mutex_lock() in this path: 2da78092dda1 "block:
Fix dev_t minor allocation lifetime".  Both this and 2da78092dda1 are
candidates for -stable.

Fixes: 2da78092dda1 ("block: Fix dev_t minor allocation lifetime")
Cc: Keith Busch &lt;keith.busch@intel.com&gt;
Reported-by: NeilBrown &lt;neilb@suse.de&gt;
Signed-off-by: Dan Williams &lt;dan.j.williams@intel.com&gt;
Signed-off-by: Jens Axboe &lt;axboe@fb.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>blk-mq: fix CPU hotplug handling</title>
<updated>2015-05-17T16:55:07+00:00</updated>
<author>
<name>Ming Lei</name>
<email>ming.lei@canonical.com</email>
</author>
<published>2015-04-21T02:00:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=69f3181a88e391dbde3ad0b0a1d8722e200e84ac'/>
<id>urn:sha1:69f3181a88e391dbde3ad0b0a1d8722e200e84ac</id>
<content type='text'>
commit 2a34c0872adf252f23a6fef2d051a169ac796cef upstream.

hctx-&gt;tags has to be set as NULL in case that it is to be unmapped
no matter if set-&gt;tags[hctx-&gt;queue_num] is NULL or not in blk_mq_map_swqueue()
because shared tags can be freed already from another request queue.

The same situation has to be considered during handling CPU online too.
Unmapped hw queue can be remapped after CPU topo is changed, so we need
to allocate tags for the hw queue in blk_mq_map_swqueue(). Then tags
allocation for hw queue can be removed in hctx cpu online notifier, and it
is reasonable to do that after mapping is updated.

Reported-by: Dongsu Park &lt;dongsu.park@profitbricks.com&gt;
Tested-by: Dongsu Park &lt;dongsu.park@profitbricks.com&gt;
Signed-off-by: Ming Lei &lt;ming.lei@canonical.com&gt;
Signed-off-by: Jens Axboe &lt;axboe@fb.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>blk-mq: fix race between timeout and CPU hotplug</title>
<updated>2015-05-17T16:55:07+00:00</updated>
<author>
<name>Ming Lei</name>
<email>ming.lei@canonical.com</email>
</author>
<published>2015-04-21T02:00:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=f7bbf3add4e037d8fb5f6251b33dda6a029cbdac'/>
<id>urn:sha1:f7bbf3add4e037d8fb5f6251b33dda6a029cbdac</id>
<content type='text'>
commit f054b56c951bf1731ba7314a4c7f1cc0b2977cc9 upstream.

Firstly during CPU hotplug, even queue is freezed, timeout
handler still may come and access hctx-&gt;tags, which may cause
use after free, so this patch deactivates timeout handler
inside CPU hotplug notifier.

Secondly, tags can be shared by more than one queues, so we
have to check if the hctx has been unmapped, otherwise
still use-after-free on tags can be triggered.

Reported-by: Dongsu Park &lt;dongsu.park@profitbricks.com&gt;
Tested-by: Dongsu Park &lt;dongsu.park@profitbricks.com&gt;
Signed-off-by: Ming Lei &lt;ming.lei@canonical.com&gt;
Signed-off-by: Jens Axboe &lt;axboe@fb.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>block: destroy bdi before blockdev is unregistered.</title>
<updated>2015-05-17T16:55:07+00:00</updated>
<author>
<name>NeilBrown</name>
<email>neilb@suse.de</email>
</author>
<published>2015-04-27T04:12:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=a45c1c367c8d8dc4fd5ee6fb5f92454c6145710a'/>
<id>urn:sha1:a45c1c367c8d8dc4fd5ee6fb5f92454c6145710a</id>
<content type='text'>
commit 6cd18e711dd8075da9d78cfc1239f912ff28968a upstream.

Because of the peculiar way that md devices are created (automatically
when the device node is opened), a new device can be created and
registered immediately after the
	blk_unregister_region(disk_devt(disk), disk-&gt;minors);
call in del_gendisk().

Therefore it is important that all visible artifacts of the previous
device are removed before this call.  In particular, the 'bdi'.

Since:
commit c4db59d31e39ea067c32163ac961e9c80198fd37
Author: Christoph Hellwig &lt;hch@lst.de&gt;
    fs: don't reassign dirty inodes to default_backing_dev_info

moved the
   device_unregister(bdi-&gt;dev);
call from bdi_unregister() to bdi_destroy() it has been quite easy to
lose a race and have a new (e.g.) "md127" be created after the
blk_unregister_region() call and before bdi_destroy() is ultimately
called by the final 'put_disk', which must come after del_gendisk().

The new device finds that the bdi name is already registered in sysfs
and complains

&gt; [ 9627.630029] WARNING: CPU: 18 PID: 3330 at fs/sysfs/dir.c:31 sysfs_warn_dup+0x5a/0x70()
&gt; [ 9627.630032] sysfs: cannot create duplicate filename '/devices/virtual/bdi/9:127'

We can fix this by moving the bdi_destroy() call out of
blk_release_queue() (which can happen very late when a refcount
reaches zero) and into blk_cleanup_queue() - which happens exactly when the md
device driver calls it.

Then it is only necessary for md to call blk_cleanup_queue() before
del_gendisk().  As loop.c devices are also created on demand by
opening the device node, we make the same change there.

Fixes: c4db59d31e39ea067c32163ac961e9c80198fd37
Reported-by: Azat Khuzhin &lt;a3at.mail@gmail.com&gt;
Cc: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: NeilBrown &lt;neilb@suse.de&gt;
Reviewed-by: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: Jens Axboe &lt;axboe@fb.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>blk-mq: initialize 'struct request' and associated data to zero</title>
<updated>2015-04-11T20:42:16+00:00</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2015-04-09T21:12:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=ac2111753ca9350c8634c5d5f592628b32652cf3'/>
<id>urn:sha1:ac2111753ca9350c8634c5d5f592628b32652cf3</id>
<content type='text'>
Jan Engelhardt reports a strange oops with an invalid -&gt;sense_buffer
pointer in scsi_init_cmd_errh() with the blk-mq code.

The sense_buffer pointer should have been initialized by the call to
scsi_init_request() from blk_mq_init_rq_map(), but there seems to be
some non-repeatable memory corruptor.

This patch makes sure we initialize the whole struct request allocation
(and the associated 'struct scsi_cmnd' for the SCSI case) to zero, by
using __GFP_ZERO in the allocation.  The old code initialized a couple
of individual fields, leaving the rest undefined (although many of them
are then initialized in later phases, like blk_mq_rq_ctx_init() etc.

It's not entirely clear why this matters, but it's the rigth thing to do
regardless, and with 4.0 imminent this is the defensive "let's just make
sure everything is initialized properly" patch.

Tested-by: Jan Engelhardt &lt;jengelh@inai.de&gt;
Acked-by: Jens Axboe &lt;axboe@kernel.dk&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>block: fix blk_stack_limits() regression due to lcm() change</title>
<updated>2015-03-31T15:45:50+00:00</updated>
<author>
<name>Mike Snitzer</name>
<email>snitzer@redhat.com</email>
</author>
<published>2015-03-30T17:39:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=e9637415a92cf25ad800b7fdeddcd30cce7b44ab'/>
<id>urn:sha1:e9637415a92cf25ad800b7fdeddcd30cce7b44ab</id>
<content type='text'>
Linux 3.19 commit 69c953c ("lib/lcm.c: lcm(n,0)=lcm(0,n) is 0, not n")
caused blk_stack_limits() to not properly stack queue_limits for stacked
devices (e.g. DM).

Fix this regression by establishing lcm_not_zero() and switching
blk_stack_limits() over to using it.

DM uses blk_set_stacking_limits() to establish the initial top-level
queue_limits that are then built up based on underlying devices' limits
using blk_stack_limits().  In the case of optimal_io_size (io_opt)
blk_set_stacking_limits() establishes a default value of 0.  With commit
69c953c, lcm(0, n) is no longer n, which compromises proper stacking of
the underlying devices' io_opt.

Test:
$ modprobe scsi_debug dev_size_mb=10 num_tgts=1 opt_blks=1536
$ cat /sys/block/sde/queue/optimal_io_size
786432
$ dmsetup create node --table "0 100 linear /dev/sde 0"

Before this fix:
$ cat /sys/block/dm-5/queue/optimal_io_size
0

After this fix:
$ cat /sys/block/dm-5/queue/optimal_io_size
786432

Signed-off-by: Mike Snitzer &lt;snitzer@redhat.com&gt;
Cc: stable@vger.kernel.org # 3.19+
Acked-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
Signed-off-by: Jens Axboe &lt;axboe@fb.com&gt;
</content>
</entry>
<entry>
<title>Fix bug in blk_rq_merge_ok</title>
<updated>2015-03-20T14:50:41+00:00</updated>
<author>
<name>Wenbo Wang</name>
<email>wenbo.wang@memblaze.com</email>
</author>
<published>2015-03-20T05:04:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=7ee8e4f3983c4ff700958a6099c8fd212ea67b94'/>
<id>urn:sha1:7ee8e4f3983c4ff700958a6099c8fd212ea67b94</id>
<content type='text'>
Use the right array index to reference the last
element of rq-&gt;biotail-&gt;bi_io_vec[]

Signed-off-by: Wenbo Wang &lt;wenbo.wang@memblaze.com&gt;
Reviewed-by: Chong Yuan &lt;chong.yuan@memblaze.com&gt;
Fixes: 66cb45aa41315 ("block: add support for limiting gaps in SG lists")
Cc: stable@kernel.org
Signed-off-by: Jens Axboe &lt;axboe@fb.com&gt;
</content>
</entry>
<entry>
<title>blkmq: Fix NULL pointer deref when all reserved tags in</title>
<updated>2015-03-18T23:06:18+00:00</updated>
<author>
<name>Sam Bradshaw</name>
<email>sbradshaw@micron.com</email>
</author>
<published>2015-03-18T23:06:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=bc188d818edf325ae38cfa43254a0b10a4defd65'/>
<id>urn:sha1:bc188d818edf325ae38cfa43254a0b10a4defd65</id>
<content type='text'>
When allocating from the reserved tags pool, bt_get() is called with
a NULL hctx.  If all tags are in use, the hw queue is kicked to push
out any pending IO, potentially freeing tags, and tag allocation is
retried.  The problem is that blk_mq_run_hw_queue() doesn't check for
a NULL hctx.  So we avoid it with a simple NULL hctx test.

Tested by hammering mtip32xx with concurrent smartctl/hdparm.

Signed-off-by: Sam Bradshaw &lt;sbradshaw@micron.com&gt;
Signed-off-by: Selvan Mani &lt;smani@micron.com&gt;
Fixes: b32232073e80 ("blk-mq: fix hang in bt_get()")
Cc: stable@kernel.org

Added appropriate comment.

Signed-off-by: Jens Axboe &lt;axboe@fb.com&gt;
</content>
</entry>
</feed>
