<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/linux.git/block/blk-sysfs.c, branch v3.2.39</title>
<subtitle>Linux Kernel
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v3.2.39</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v3.2.39'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/'/>
<updated>2012-08-02T13:37:54Z</updated>
<entry>
<title>block: add blk_queue_dead()</title>
<updated>2012-08-02T13:37:54Z</updated>
<author>
<name>Tejun Heo</name>
<email>tj@kernel.org</email>
</author>
<published>2011-12-13T23:33:37Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=68e9e9fee2bbec4853a993e98b0df8479292f572'/>
<id>urn:sha1:68e9e9fee2bbec4853a993e98b0df8479292f572</id>
<content type='text'>
commit 34f6055c80285e4efb3f602a9119db75239744dc upstream.

There are a number of QUEUE_FLAG_DEAD tests.  Add blk_queue_dead()
macro and use it.

This patch doesn't introduce any functional difference.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
<entry>
<title>block: fix request_queue lifetime handling by making blk_queue_cleanup() properly shutdown</title>
<updated>2011-10-19T12:42:16Z</updated>
<author>
<name>Tejun Heo</name>
<email>tj@kernel.org</email>
</author>
<published>2011-10-19T12:42:16Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=c9a929dde3913780b5c416f4bb9d9ed804f509ce'/>
<id>urn:sha1:c9a929dde3913780b5c416f4bb9d9ed804f509ce</id>
<content type='text'>
request_queue is refcounted but actually depdends on lifetime
management from the queue owner - on blk_cleanup_queue(), block layer
expects that there's no request passing through request_queue and no
new one will.

This is fundamentally broken.  The queue owner (e.g. SCSI layer)
doesn't have a way to know whether there are other active users before
calling blk_cleanup_queue() and other users (e.g. bsg) don't have any
guarantee that the queue is and would stay valid while it's holding a
reference.

With delay added in blk_queue_bio() before queue_lock is grabbed, the
following oops can be easily triggered when a device is removed with
in-flight IOs.

 sd 0:0:1:0: [sdb] Stopping disk
 ata1.01: disabled
 general protection fault: 0000 [#1] PREEMPT SMP
 CPU 2
 Modules linked in:

 Pid: 648, comm: test_rawio Not tainted 3.1.0-rc3-work+ #56 Bochs Bochs
 RIP: 0010:[&lt;ffffffff8137d651&gt;]  [&lt;ffffffff8137d651&gt;] elv_rqhash_find+0x61/0x100
 ...
 Process test_rawio (pid: 648, threadinfo ffff880019efa000, task ffff880019ef8a80)
 ...
 Call Trace:
  [&lt;ffffffff8137d774&gt;] elv_merge+0x84/0xe0
  [&lt;ffffffff81385b54&gt;] blk_queue_bio+0xf4/0x400
  [&lt;ffffffff813838ea&gt;] generic_make_request+0xca/0x100
  [&lt;ffffffff81383994&gt;] submit_bio+0x74/0x100
  [&lt;ffffffff811c53ec&gt;] dio_bio_submit+0xbc/0xc0
  [&lt;ffffffff811c610e&gt;] __blockdev_direct_IO+0x92e/0xb40
  [&lt;ffffffff811c39f7&gt;] blkdev_direct_IO+0x57/0x60
  [&lt;ffffffff8113b1c5&gt;] generic_file_aio_read+0x6d5/0x760
  [&lt;ffffffff8118c1ca&gt;] do_sync_read+0xda/0x120
  [&lt;ffffffff8118ce55&gt;] vfs_read+0xc5/0x180
  [&lt;ffffffff8118cfaa&gt;] sys_pread64+0x9a/0xb0
  [&lt;ffffffff81afaf6b&gt;] system_call_fastpath+0x16/0x1b

This happens because blk_queue_cleanup() destroys the queue and
elevator whether IOs are in progress or not and DEAD tests are
sprinkled in the request processing path without proper
synchronization.

Similar problem exists for blk-throtl.  On queue cleanup, blk-throtl
is shutdown whether it has requests in it or not.  Depending on
timing, it either oopses or throttled bios are lost putting tasks
which are waiting for bio completion into eternal D state.

The way it should work is having the usual clear distinction between
shutdown and release.  Shutdown drains all currently pending requests,
marks the queue dead, and performs partial teardown of the now
unnecessary part of the queue.  Even after shutdown is complete,
reference holders are still allowed to issue requests to the queue
although they will be immmediately failed.  The rest of teardown
happens on release.

This patch makes the following changes to make blk_queue_cleanup()
behave as proper shutdown.

* QUEUE_FLAG_DEAD is now set while holding both q-&gt;exit_mutex and
  queue_lock.

* Unsynchronized DEAD check in generic_make_request_checks() removed.
  This couldn't make any meaningful difference as the queue could die
  after the check.

* blk_drain_queue() updated such that it can drain all requests and is
  now called during cleanup.

* blk_throtl updated such that it checks DEAD on grabbing queue_lock,
  drains all throttled bios during cleanup and free td when queue is
  released.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Cc: Vivek Goyal &lt;vgoyal@redhat.com&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>Merge branch 'v3.1-rc10' into for-3.2/core</title>
<updated>2011-10-19T12:30:42Z</updated>
<author>
<name>Jens Axboe</name>
<email>axboe@kernel.dk</email>
</author>
<published>2011-10-19T12:30:42Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=5c04b426f2e8b46cfc7969a35b2631063a3c646c'/>
<id>urn:sha1:5c04b426f2e8b46cfc7969a35b2631063a3c646c</id>
<content type='text'>
Conflicts:
	block/blk-core.c
	include/linux/blkdev.h

Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>block: Free queue resources at blk_release_queue()</title>
<updated>2011-09-28T14:07:01Z</updated>
<author>
<name>Hannes Reinecke</name>
<email>hare@suse.de</email>
</author>
<published>2011-09-28T14:07:01Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=777eb1bf15b8532c396821774bf6451e563438f5'/>
<id>urn:sha1:777eb1bf15b8532c396821774bf6451e563438f5</id>
<content type='text'>
A kernel crash is observed when a mounted ext3/ext4 filesystem is
physically removed. The problem is that blk_cleanup_queue() frees up
some resources eg by calling elevator_exit(), which are not checked for
in normal operation. So we should rather move these calls to the
destructor function blk_release_queue() as at that point all remaining
references are gone. However, in doing so we have to ensure that any
externally supplied queue_lock is disconnected as the driver might free
up the lock after the call of blk_cleanup_queue(),

Signed-off-by: Hannes Reinecke &lt;hare@suse.de&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>block/blk-sysfs.c: fix kerneldoc references</title>
<updated>2011-09-21T08:01:22Z</updated>
<author>
<name>Andrew Morton</name>
<email>akpm@linux-foundation.org</email>
</author>
<published>2011-09-21T08:01:22Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=499337bb6511e665a236a6a947f819d98ea340c6'/>
<id>urn:sha1:499337bb6511e665a236a6a947f819d98ea340c6</id>
<content type='text'>
The kerneldoc for blk_release_queue() is referring to blk_cleanup_queue().

Cc: Jens Axboe &lt;axboe@kernel.dk&gt;
Signed-off-by: Andrew Morton &lt;akpm@google.com&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>block: Fix queue_flag update when rq_affinity goes from 2 to 1</title>
<updated>2011-08-24T06:51:34Z</updated>
<author>
<name>Eric Seppanen</name>
<email>eric@purestorage.com</email>
</author>
<published>2011-08-23T19:25:12Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=e8037d49835482c9534a9a07bed0d0ea831135ae'/>
<id>urn:sha1:e8037d49835482c9534a9a07bed0d0ea831135ae</id>
<content type='text'>
Commit 5757a6d76cdf added the QUEUE_FLAG_SAME_FORCE flag, but fails to
clear that flag when the current state is '2' (SAME_COMP + SAME_FORCE)
and the new state is '1' (SAME_COMP).

Acked-by: Dan Williams &lt;dan.j.williams@intel.com&gt;
Reviewed-by: Roland Dreier &lt;roland@purestorage.com&gt;
Signed-off-by: Eric Seppanen &lt;eric@purestorage.com&gt;
Signed-off-by: Jens Axboe &lt;jaxboe@fusionio.com&gt;
</content>
</entry>
<entry>
<title>block: strict rq_affinity</title>
<updated>2011-07-23T18:44:25Z</updated>
<author>
<name>Dan Williams</name>
<email>dan.j.williams@intel.com</email>
</author>
<published>2011-07-23T18:44:25Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=5757a6d76cdf6dda2a492c09b985c015e86779b1'/>
<id>urn:sha1:5757a6d76cdf6dda2a492c09b985c015e86779b1</id>
<content type='text'>
Some systems benefit from completions always being steered to the strict
requester cpu rather than the looser "per-socket" steering that
blk_cpu_to_group() attempts by default. This is because the first
CPU in the group mask ends up being completely overloaded with work,
while the others (including the original submitter) has power left
to spare.

Allow the strict mode to be set by writing '2' to the sysfs control
file. This is identical to the scheme used for the nomerges file,
where '2' is a more aggressive setting than just being turned on.

echo 2 &gt; /sys/block/&lt;bdev&gt;/queue/rq_affinity

Cc: Christoph Hellwig &lt;hch@infradead.org&gt;
Cc: Roland Dreier &lt;roland@purestorage.com&gt;
Tested-by: Dave Jiang &lt;dave.jiang@intel.com&gt;
Signed-off-by: Dan Williams &lt;dan.j.williams@intel.com&gt;
Signed-off-by: Jens Axboe &lt;jaxboe@fusionio.com&gt;
</content>
</entry>
<entry>
<title>Merge commit 'v2.6.39' into for-2.6.40/core</title>
<updated>2011-05-20T18:33:15Z</updated>
<author>
<name>Jens Axboe</name>
<email>jaxboe@fusionio.com</email>
</author>
<published>2011-05-20T18:33:15Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=698567f3fa790fea37509a54dea855302dd88331'/>
<id>urn:sha1:698567f3fa790fea37509a54dea855302dd88331</id>
<content type='text'>
Since for-2.6.40/core was forked off the 2.6.39 devel tree, we've
had churn in the core area that makes it difficult to handle
patches for eg cfq or blk-throttle. Instead of requiring that they
be based in older versions with bugs that have been fixed later
in the rc cycle, merge in 2.6.39 final.

Also fixes up conflicts in the below files.

Conflicts:
	drivers/block/paride/pcd.c
	drivers/cdrom/viocd.c
	drivers/ide/ide-cd.c

Signed-off-by: Jens Axboe &lt;jaxboe@fusionio.com&gt;
</content>
</entry>
<entry>
<title>block: Fix discard topology stacking and reporting</title>
<updated>2011-05-18T08:37:35Z</updated>
<author>
<name>Martin K. Petersen</name>
<email>martin.petersen@oracle.com</email>
</author>
<published>2011-05-18T08:37:35Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=a934a00a69e940b126b9bdbf83e630ef5fe43523'/>
<id>urn:sha1:a934a00a69e940b126b9bdbf83e630ef5fe43523</id>
<content type='text'>
In some cases we would end up stacking discard_zeroes_data incorrectly.
Fix this by enabling the feature by default for stacking drivers and
clearing it for low-level drivers. Incorporating a device that does not
support dzd will then cause the feature to be disabled in the stacking
driver.

Also ensure that the maximum discard value does not overflow when
exported in sysfs and return 0 in the alignment and dzd fields for
devices that don't support discard.

Reported-by: Lukas Czerner &lt;lczerner@redhat.com&gt;
Signed-off-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
Acked-by: Mike Snitzer &lt;snitzer@redhat.com&gt;
Cc: stable@kernel.org
Signed-off-by: Jens Axboe &lt;jaxboe@fusionio.com&gt;
</content>
</entry>
<entry>
<title>block: Remove the extra check in queue_requests_store</title>
<updated>2011-04-19T11:51:53Z</updated>
<author>
<name>Tao Ma</name>
<email>boyu.mt@taobao.com</email>
</author>
<published>2011-04-19T11:50:40Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=60735b6362f29b52b5635a2dfa9ab5ad39948345'/>
<id>urn:sha1:60735b6362f29b52b5635a2dfa9ab5ad39948345</id>
<content type='text'>
In queue_requests_store, the code looks like
	if (rl-&gt;count[BLK_RW_SYNC] &gt;= q-&gt;nr_requests) {
		blk_set_queue_full(q, BLK_RW_SYNC);
	} else if (rl-&gt;count[BLK_RW_SYNC]+1 &lt;= q-&gt;nr_requests) {
		blk_clear_queue_full(q, BLK_RW_SYNC);
		wake_up(&amp;rl-&gt;wait[BLK_RW_SYNC]);
	}
If we don't satify the situation of "if", we can get that
rl-&gt;count[BLK_RW_SYNC} &lt; q-&gt;nr_quests. It is the same as
rl-&gt;count[BLK_RW_SYNC]+1 &lt;= q-&gt;nr_requests.
All the "else" should satisfy the "else if" check so it isn't
needed actually.

Signed-off-by: Tao Ma &lt;boyu.mt@taobao.com&gt;
Signed-off-by: Jens Axboe &lt;jaxboe@fusionio.com&gt;
</content>
</entry>
</feed>
