<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/block/blk-sysfs.c, branch linux-4.18.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.18.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.18.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2018-09-09T08:32:29Z</updated>
<entry>
<title>block: Ensure that a request queue is dissociated from the cgroup controller</title>
<updated>2018-09-09T08:32:29Z</updated>
<author>
<name>Bart Van Assche</name>
</author>
<published>2018-08-09T14:53:38Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=ac89e9c33de32967c046dd8ef07c3ae36e024e98'/>
<id>urn:sha1:ac89e9c33de32967c046dd8ef07c3ae36e024e98</id>
<content type='text'>
commit 24ecc3585348b616993a3c4d6dc2c6b8007e358c upstream.

Several block drivers call alloc_disk() followed by put_disk() if
something fails before device_add_disk() is called without calling
blk_cleanup_queue(). Make sure that also for this scenario a request
queue is dissociated from the cgroup controller. This patch avoids
that loading the parport_pc, paride and pf drivers triggers the
following kernel crash:

BUG: KASAN: null-ptr-deref in pi_init+0x42e/0x580 [paride]
Read of size 4 at addr 0000000000000008 by task modprobe/744
Call Trace:
dump_stack+0x9a/0xeb
kasan_report+0x139/0x350
pi_init+0x42e/0x580 [paride]
pf_init+0x2bb/0x1000 [pf]
do_one_initcall+0x8e/0x405
do_init_module+0xd9/0x2f2
load_module+0x3ab4/0x4700
SYSC_finit_module+0x176/0x1a0
do_syscall_64+0xee/0x2b0
entry_SYSCALL_64_after_hwframe+0x42/0xb7

Reported-by: Alexandru Moise &lt;00moses.alexander00@gmail.com&gt;
Fixes: a063057d7c73 ("block: Fix a race between request queue removal and the block cgroup controller") # v4.17
Signed-off-by: Bart Van Assche &lt;bart.vanassche@wdc.com&gt;
Tested-by: Alexandru Moise &lt;00moses.alexander00@gmail.com&gt;
Reviewed-by: Johannes Thumshirn &lt;jthumshirn@suse.de&gt;
Cc: Tejun Heo &lt;tj@kernel.org&gt;
Cc: Christoph Hellwig &lt;hch@lst.de&gt;
Cc: Ming Lei &lt;ming.lei@redhat.com&gt;
Cc: Alexandru Moise &lt;00moses.alexander00@gmail.com&gt;
Cc: Joseph Qi &lt;joseph.qi@linux.alibaba.com&gt;
Cc: &lt;stable@vger.kernel.org&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>block: convert bounce, q-&gt;bio_split to bioset_init()/mempool_init()</title>
<updated>2018-05-30T21:33:32Z</updated>
<author>
<name>Kent Overstreet</name>
</author>
<published>2018-05-20T22:25:47Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=338aa96d5661048b3c0cafc6d91876025603cacf'/>
<id>urn:sha1:338aa96d5661048b3c0cafc6d91876025603cacf</id>
<content type='text'>
Convert the core block functionality to embedded bio sets.

Reviewed-by: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: Kent Overstreet &lt;kent.overstreet@gmail.com&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>block drivers/block: Use octal not symbolic permissions</title>
<updated>2018-05-24T19:38:59Z</updated>
<author>
<name>Joe Perches</name>
</author>
<published>2018-05-24T19:38:59Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5657a819a8d94426c76be04dcedfad0f64cfff00'/>
<id>urn:sha1:5657a819a8d94426c76be04dcedfad0f64cfff00</id>
<content type='text'>
Convert the S_&lt;FOO&gt; symbolic permissions to their octal equivalents as
using octal and not symbolic permissions is preferred by many as more
readable.

see: https://lkml.org/lkml/2016/8/2/1945

Done with automated conversion via:
$ ./scripts/checkpatch.pl -f --types=SYMBOLIC_PERMS --fix-inplace &lt;files...&gt;

Miscellanea:

o Wrapped modified multi-line calls to a single line where appropriate
o Realign modified multi-line calls to open parenthesis

Signed-off-by: Joe Perches &lt;joe@perches.com&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>block: Add sysfs entry for fua support</title>
<updated>2018-05-14T19:16:17Z</updated>
<author>
<name>Kent Overstreet</name>
</author>
<published>2018-05-09T01:33:58Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=6fcefbe578811bf938908e1ec43347d205133ad0'/>
<id>urn:sha1:6fcefbe578811bf938908e1ec43347d205133ad0</id>
<content type='text'>
Signed-off-by: Kent Overstreet &lt;kent.overstreet@gmail.com&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>block: Introduce blk_queue_flag_{set,clear,test_and_{set,clear}}()</title>
<updated>2018-03-08T21:13:48Z</updated>
<author>
<name>Bart Van Assche</name>
</author>
<published>2018-03-08T01:10:04Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=8814ce8a0f680599a837af18aefdec774e5c7b97'/>
<id>urn:sha1:8814ce8a0f680599a837af18aefdec774e5c7b97</id>
<content type='text'>
Introduce functions that modify the queue flags and that protect
these modifications with the request queue lock. Except for moving
one wake_up_all() call from inside to outside a critical section,
this patch does not change any functionality.

Cc: Christoph Hellwig &lt;hch@lst.de&gt;
Cc: Hannes Reinecke &lt;hare@suse.de&gt;
Cc: Ming Lei &lt;ming.lei@redhat.com&gt;
Reviewed-by: Johannes Thumshirn &lt;jthumshirn@suse.de&gt;
Reviewed-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
Signed-off-by: Bart Van Assche &lt;bart.vanassche@wdc.com&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>block: Fix a race between request queue removal and the block cgroup controller</title>
<updated>2018-02-28T19:23:35Z</updated>
<author>
<name>Bart Van Assche</name>
</author>
<published>2018-02-28T18:15:33Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a063057d7c731cffa7d10740e8ebc2970df8dbb3'/>
<id>urn:sha1:a063057d7c731cffa7d10740e8ebc2970df8dbb3</id>
<content type='text'>
Avoid that the following race can occur:

blk_cleanup_queue()               blkcg_print_blkgs()
  spin_lock_irq(lock) (1)           spin_lock_irq(blkg-&gt;q-&gt;queue_lock) (2,5)
    q-&gt;queue_lock = &amp;q-&gt;__queue_lock (3)
  spin_unlock_irq(lock) (4)
                                    spin_unlock_irq(blkg-&gt;q-&gt;queue_lock) (6)

(1) take driver lock;
(2) busy loop for driver lock;
(3) override driver lock with internal lock;
(4) unlock driver lock;
(5) can take driver lock now;
(6) but unlock internal lock.

This change is safe because only the SCSI core and the NVME core keep
a reference on a request queue after having called blk_cleanup_queue().
Neither driver accesses any of the removed data structures between its
blk_cleanup_queue() and blk_put_queue() calls.

Reported-by: Joseph Qi &lt;joseph.qi@linux.alibaba.com&gt;
Signed-off-by: Bart Van Assche &lt;bart.vanassche@wdc.com&gt;
Reviewed-by: Joseph Qi &lt;joseph.qi@linux.alibaba.com&gt;
Cc: Jan Kara &lt;jack@suse.com&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>block: Protect less code with sysfs_lock in blk_{un,}register_queue()</title>
<updated>2018-01-18T19:54:44Z</updated>
<author>
<name>Bart Van Assche</name>
</author>
<published>2018-01-17T19:48:10Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=2c2086afc2b8b974fac32cb028e73dc27bfae442'/>
<id>urn:sha1:2c2086afc2b8b974fac32cb028e73dc27bfae442</id>
<content type='text'>
The __blk_mq_register_dev(), blk_mq_unregister_dev(),
elv_register_queue() and elv_unregister_queue() calls need to be
protected with sysfs_lock but other code in these functions not.
Hence protect only this code with sysfs_lock. This patch fixes a
locking inversion issue in blk_unregister_queue() and also in an
error path of blk_register_queue(): it is not allowed to hold
sysfs_lock around the kobject_del(&amp;q-&gt;kobj) call.

Reviewed-by: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: Bart Van Assche &lt;bart.vanassche@wdc.com&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>block: allow gendisk's request_queue registration to be deferred</title>
<updated>2018-01-15T15:41:38Z</updated>
<author>
<name>Mike Snitzer</name>
</author>
<published>2018-01-09T03:01:13Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=fa70d2e2c4a0a54ced98260c6a176cc94c876d27'/>
<id>urn:sha1:fa70d2e2c4a0a54ced98260c6a176cc94c876d27</id>
<content type='text'>
Since I can remember DM has forced the block layer to allow the
allocation and initialization of the request_queue to be distinct
operations.  Reason for this is block/genhd.c:add_disk() has requires
that the request_queue (and associated bdi) be tied to the gendisk
before add_disk() is called -- because add_disk() also deals with
exposing the request_queue via blk_register_queue().

DM's dynamic creation of arbitrary device types (and associated
request_queue types) requires the DM device's gendisk be available so
that DM table loads can establish a master/slave relationship with
subordinate devices that are referenced by loaded DM tables -- using
bd_link_disk_holder().  But until these DM tables, and their associated
subordinate devices, are known DM cannot know what type of request_queue
it needs -- nor what its queue_limits should be.

This chicken and egg scenario has created all manner of problems for DM
and, at times, the block layer.

Summary of changes:

- Add device_add_disk_no_queue_reg() and add_disk_no_queue_reg() variant
  that drivers may use to add a disk without also calling
  blk_register_queue().  Driver must call blk_register_queue() once its
  request_queue is fully initialized.

- Return early from blk_unregister_queue() if QUEUE_FLAG_REGISTERED
  is not set.  It won't be set if driver used add_disk_no_queue_reg()
  but driver encounters an error and must del_gendisk() before calling
  blk_register_queue().

- Export blk_register_queue().

These changes allow DM to use add_disk_no_queue_reg() to anchor its
gendisk as the "master" for master/slave relationships DM must establish
with subordinate devices referenced in DM tables that get loaded.  Once
all "slave" devices for a DM device are known its request_queue can be
properly initialized and then advertised via sysfs -- important
improvement being that no request_queue resource initialization
performed by blk_register_queue() is missed for DM devices anymore.

Signed-off-by: Mike Snitzer &lt;snitzer@redhat.com&gt;
Reviewed-by: Ming Lei &lt;ming.lei@redhat.com&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>block: properly protect the 'queue' kobj in blk_unregister_queue</title>
<updated>2018-01-15T15:41:38Z</updated>
<author>
<name>Mike Snitzer</name>
</author>
<published>2018-01-11T19:11:01Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=667257e8b2988c0183ba23e2bcd6900e87961606'/>
<id>urn:sha1:667257e8b2988c0183ba23e2bcd6900e87961606</id>
<content type='text'>
The original commit e9a823fb34a8b (block: fix warning when I/O elevator
is changed as request_queue is being removed) is pretty conflated.
"conflated" because the resource being protected by q-&gt;sysfs_lock isn't
the queue_flags (it is the 'queue' kobj).

q-&gt;sysfs_lock serializes __elevator_change() (via elv_iosched_store)
from racing with blk_unregister_queue():
1) By holding q-&gt;sysfs_lock first, __elevator_change() can complete
before a racing blk_unregister_queue().
2) Conversely, __elevator_change() is testing for QUEUE_FLAG_REGISTERED
in case elv_iosched_store() loses the race with blk_unregister_queue(),
it needs a way to know the 'queue' kobj isn't there.

Expand the scope of blk_unregister_queue()'s q-&gt;sysfs_lock use so it is
held until after the 'queue' kobj is removed.

To do so blk_mq_unregister_dev() must not also take q-&gt;sysfs_lock.  So
rename __blk_mq_unregister_dev() to blk_mq_unregister_dev().

Also, blk_unregister_queue() should use q-&gt;queue_lock to protect against
any concurrent writes to q-&gt;queue_flags -- even though chances are the
queue is being cleaned up so no concurrent writes are likely.

Fixes: e9a823fb34a8b ("block: fix warning when I/O elevator is changed as request_queue is being removed")
Signed-off-by: Mike Snitzer &lt;snitzer@redhat.com&gt;
Reviewed-by: Ming Lei &lt;ming.lei@redhat.com&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>blk-sysfs: remove NULL pointer checking in queue_wb_lat_store</title>
<updated>2017-11-24T05:00:17Z</updated>
<author>
<name>weiping zhang</name>
</author>
<published>2017-11-23T13:39:40Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f680474345f1fd6329d1806d6358066fd3b07f02'/>
<id>urn:sha1:f680474345f1fd6329d1806d6358066fd3b07f02</id>
<content type='text'>
wbt_init doesn't set q-&gt;rq_wb to NULL, if wbt_init return 0,
so check return value is enough, remove NULL checking.

Signed-off-by: weiping zhang &lt;zhangweiping@didichuxing.com&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
</feed>
