<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/linux.git/block/blk-core.c, branch v3.2.29</title>
<subtitle>Linux Kernel
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v3.2.29</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v3.2.29'/>
<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: don't kick empty queue in blk_drain_queue()</title>
<updated>2011-12-15T19:03:04Z</updated>
<author>
<name>Tejun Heo</name>
<email>tj@kernel.org</email>
</author>
<published>2011-12-15T19:03:04Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=4eabc941259f9d8c8fb71746d3f30c87e1d9e49b'/>
<id>urn:sha1:4eabc941259f9d8c8fb71746d3f30c87e1d9e49b</id>
<content type='text'>
While probing, fd sets up queue, probes hardware and tears down the
queue if probing fails.  In the process, blk_drain_queue() kicks the
queue which failed to finish initialization and fd is unhappy about
that.

  floppy0: no floppy controllers found
  ------------[ cut here ]------------
  WARNING: at drivers/block/floppy.c:2929 do_fd_request+0xbf/0xd0()
  Hardware name: To Be Filled By O.E.M.
  VFS: do_fd_request called on non-open device
  Modules linked in:
  Pid: 1, comm: swapper Not tainted 3.2.0-rc4-00077-g5983fe2 #2
  Call Trace:
   [&lt;ffffffff81039a6a&gt;] warn_slowpath_common+0x7a/0xb0
   [&lt;ffffffff81039b41&gt;] warn_slowpath_fmt+0x41/0x50
   [&lt;ffffffff813d657f&gt;] do_fd_request+0xbf/0xd0
   [&lt;ffffffff81322b95&gt;] blk_drain_queue+0x65/0x80
   [&lt;ffffffff81322c93&gt;] blk_cleanup_queue+0xe3/0x1a0
   [&lt;ffffffff818a809d&gt;] floppy_init+0xdeb/0xe28
   [&lt;ffffffff818a72b2&gt;] ? daring+0x6b/0x6b
   [&lt;ffffffff810002af&gt;] do_one_initcall+0x3f/0x170
   [&lt;ffffffff81884b34&gt;] kernel_init+0x9d/0x11e
   [&lt;ffffffff810317c2&gt;] ? schedule_tail+0x22/0xa0
   [&lt;ffffffff815dbb14&gt;] kernel_thread_helper+0x4/0x10
   [&lt;ffffffff81884a97&gt;] ? start_kernel+0x2be/0x2be
   [&lt;ffffffff815dbb10&gt;] ? gs_change+0xb/0xb

Avoid it by making blk_drain_queue() kick queue iff dispatch queue has
something on it.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Reported-by: Ralf Hildebrandt &lt;Ralf.Hildebrandt@charite.de&gt;
Reported-by: Wu Fengguang &lt;fengguang.wu@intel.com&gt;
Tested-by: Sergei Trofimovich &lt;slyich@gmail.com&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>block: initialize request_queue's numa node during</title>
<updated>2011-11-23T09:59:13Z</updated>
<author>
<name>Mike Snitzer</name>
<email>snitzer@redhat.com</email>
</author>
<published>2011-11-23T09:59:13Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=5151412dd4338b273afdb107c3772528e9e67d92'/>
<id>urn:sha1:5151412dd4338b273afdb107c3772528e9e67d92</id>
<content type='text'>
struct request_queue is allocated with __GFP_ZERO so its "node" field is
zero before initialization.  This causes an oops if node 0 is offline in
the page allocator because its zonelists are not initialized.  From Dave
Young's dmesg:

	SRAT: Node 1 PXM 2 0-d0000000
	SRAT: Node 1 PXM 2 100000000-330000000
	SRAT: Node 0 PXM 1 330000000-630000000
	Initmem setup node 1 0000000000000000-000000000affb000
	...
	Built 1 zonelists in Node order, mobility grouping on.
	...
	BUG: unable to handle kernel paging request at 0000000000001c08
	IP: [&lt;ffffffff8111c355&gt;] __alloc_pages_nodemask+0xb5/0x870

and __alloc_pages_nodemask+0xb5 translates to a NULL pointer on
zonelist-&gt;_zonerefs.

The fix is to initialize q-&gt;node at the time of allocation so the correct
node is passed to the slab allocator later.

Since blk_init_allocated_queue_node() is no longer needed, merge it with
blk_init_allocated_queue().

[rientjes@google.com: changelog, initializing q-&gt;node]
Cc: stable@vger.kernel.org [2.6.37+]
Reported-by: Dave Young &lt;dyoung@redhat.com&gt;
Signed-off-by: Mike Snitzer &lt;snitzer@redhat.com&gt;
Signed-off-by: David Rientjes &lt;rientjes@google.com&gt;
Tested-by: Dave Young &lt;dyoung@redhat.com&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>block: add missed trace_block_plug</title>
<updated>2011-11-16T08:21:50Z</updated>
<author>
<name>Shaohua Li</name>
<email>shaohua.li@intel.com</email>
</author>
<published>2011-11-16T08:21:50Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=019ceb7d5d252ce71001a157cf29f4ac28501b72'/>
<id>urn:sha1:019ceb7d5d252ce71001a157cf29f4ac28501b72</id>
<content type='text'>
After flush plug list, the list has no request, so we need to add a
trace_block_plug().

Signed-off-by: Shaohua Li &lt;shaohua.li@intel.com&gt;
Reviewed-by: Namhyung Kim &lt;namhyung@gmail.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>block: avoid unnecessary plug list flush</title>
<updated>2011-11-16T08:21:50Z</updated>
<author>
<name>Shaohua Li</name>
<email>shaohua.li@intel.com</email>
</author>
<published>2011-11-16T08:21:50Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=3540d5e89b2ac268fcfc9b07a50a9ba4acc2e5e5'/>
<id>urn:sha1:3540d5e89b2ac268fcfc9b07a50a9ba4acc2e5e5</id>
<content type='text'>
get_request_wait() could sleep and flush the plug list.  If the list is
already flushed, don't flush again.

Signed-off-by: Shaohua Li &lt;shaohua.li@intel.com&gt;
Reviewed-by: Namhyung Kim &lt;namhyung@gmail.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>block: don't call blk_drain_queue() if elevator is not up</title>
<updated>2011-11-03T17:52:11Z</updated>
<author>
<name>Tejun Heo</name>
<email>tj@kernel.org</email>
</author>
<published>2011-11-03T17:52:11Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=6dd9ad7df2019b1e33a372a501907db293ebcd0d'/>
<id>urn:sha1:6dd9ad7df2019b1e33a372a501907db293ebcd0d</id>
<content type='text'>
blk_cleanup_queue() may be called before elevator is set up on a
queue which triggers the following oops.

 BUG: unable to handle kernel NULL pointer dereference at           (null)
 IP: [&lt;ffffffff8125a69c&gt;] elv_drain_elevator+0x1c/0x70
 ...
 Pid: 830, comm: kworker/0:2 Not tainted 3.1.0-next-20111025_64+ #1590
 Bochs Bochs
 RIP: 0010:[&lt;ffffffff8125a69c&gt;]  [&lt;ffffffff8125a69c&gt;] elv_drain_elevator+0x1c/0x70
 ...
 Call Trace:
  [&lt;ffffffff8125da92&gt;] blk_drain_queue+0x42/0x70
  [&lt;ffffffff8125db90&gt;] blk_cleanup_queue+0xd0/0x1c0
  [&lt;ffffffff81469640&gt;] md_free+0x50/0x70
  [&lt;ffffffff8126f43b&gt;] kobject_release+0x8b/0x1d0
  [&lt;ffffffff81270d56&gt;] kref_put+0x36/0xa0
  [&lt;ffffffff8126f2b7&gt;] kobject_put+0x27/0x60
  [&lt;ffffffff814693af&gt;] mddev_delayed_delete+0x2f/0x40
  [&lt;ffffffff81083450&gt;] process_one_work+0x100/0x3b0
  [&lt;ffffffff8108527f&gt;] worker_thread+0x15f/0x3a0
  [&lt;ffffffff81089937&gt;] kthread+0x87/0x90
  [&lt;ffffffff81621834&gt;] kernel_thread_helper+0x4/0x10

Fix it by making blk_cleanup_queue() check whether q-&gt;elevator is set
up before invoking blk_drain_queue.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Reported-and-tested-by: Jiri Slaby &lt;jslaby@suse.cz&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>Merge branch 'for-linus' into for-3.2/core</title>
<updated>2011-10-24T14:24:38Z</updated>
<author>
<name>Jens Axboe</name>
<email>axboe@kernel.dk</email>
</author>
<published>2011-10-24T14:24:38Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=83157223defe3be490cfea048e83451b6f254216'/>
<id>urn:sha1:83157223defe3be490cfea048e83451b6f254216</id>
<content type='text'>
</content>
</entry>
<entry>
<title>blk-flush: move the queue kick into</title>
<updated>2011-10-24T14:24:31Z</updated>
<author>
<name>Jeff Moyer</name>
<email>jmoyer@redhat.com</email>
</author>
<published>2011-10-17T10:57:23Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=e67b77c791ca2778198c9e7088f3266ed2da7a55'/>
<id>urn:sha1:e67b77c791ca2778198c9e7088f3266ed2da7a55</id>
<content type='text'>
A dm-multipath user reported[1] a problem when trying to boot
a kernel with commit 4853abaae7e4a2af938115ce9071ef8684fb7af4
(block: fix flush machinery for stacking drivers with differring
flush flags) applied.  It turns out that an empty flush request
can be sent into blk_insert_flush.  When the BUG_ON was fixed
to allow for this, I/O on the underlying device would stall.  The
reason is that blk_insert_cloned_request does not kick the queue.
In the aforementioned commit, I had added a special case to
kick the queue if data was sent down but the queue flags did
not require a flush.  A better solution is to push the queue
kick up into blk_insert_cloned_request.

This patch, along with a follow-on which fixes the BUG_ON, fixes
the issue reported.

[1] http://www.redhat.com/archives/dm-devel/2011-September/msg00154.html

Reported-by: Christophe Saout &lt;christophe@saout.de&gt;
Signed-off-by: Jeff Moyer &lt;jmoyer@redhat.com&gt;
Acked-by: Tejun Heo &lt;tj@kernel.org&gt;

Stable note: 3.1
Cc: stable@vger.kernel.org
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>block: Remove the control of complete cpu from bio.</title>
<updated>2011-10-24T14:11:30Z</updated>
<author>
<name>Tao Ma</name>
<email>boyu.mt@taobao.com</email>
</author>
<published>2011-10-24T14:11:30Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=9562ad9ab36df7ccef920d119f3b5100025db95f'/>
<id>urn:sha1:9562ad9ab36df7ccef920d119f3b5100025db95f</id>
<content type='text'>
bio originally has the functionality to set the complete cpu, but
it is broken.

Chirstoph said that "This code is unused, and from the all the
discussions lately pretty obviously broken.  The only thing keeping
it serves is creating more confusion and possibly more bugs."

And Jens replied with "We can kill bio_set_completion_cpu(). I'm fine
with leaving cpu control to the request based drivers, they are the
only ones that can toggle the setting anyway".

So this patch tries to remove all the work of controling complete cpu
from a bio.

Cc: Shaohua Li &lt;shaohua.li@intel.com&gt;
Cc: Christoph Hellwig &lt;hch@infradead.org&gt;
Signed-off-by: Tao Ma &lt;boyu.mt@taobao.com&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&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>
</feed>
