<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/linux.git/block, branch v3.6.9</title>
<subtitle>Linux Kernel
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v3.6.9</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v3.6.9'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/'/>
<updated>2012-12-03T19:37:59Z</updated>
<entry>
<title>block: Don't access request after it might be freed</title>
<updated>2012-12-03T19:37:59Z</updated>
<author>
<name>Roland Dreier</name>
<email>roland@purestorage.com</email>
</author>
<published>2012-11-22T10:00:11Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=1840c51ad1842d31d810a64425dc2b52492ba269'/>
<id>urn:sha1:1840c51ad1842d31d810a64425dc2b52492ba269</id>
<content type='text'>
commit 893d290f1d7496db97c9471bc352ad4a11dc8a25 upstream.

After we've done __elv_add_request() and __blk_run_queue() in
blk_execute_rq_nowait(), the request might finish and be freed
immediately.  Therefore checking if the type is REQ_TYPE_PM_RESUME
isn't safe afterwards, because if it isn't, rq might be gone.
Instead, check beforehand and stash the result in a temporary.

This fixes crashes in blk_execute_rq_nowait() I get occasionally when
running with lots of memory debugging options enabled -- I think this
race is usually harmless because the window for rq to be reallocated
is so small.

Signed-off-by: Roland Dreier &lt;roland@purestorage.com&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>blkcg: Fix use-after-free of q-&gt;root_blkg and q-&gt;root_rl.blkg</title>
<updated>2012-11-05T08:56:48Z</updated>
<author>
<name>Jun'ichi Nomura</name>
<email>j-nomura@ce.jp.nec.com</email>
</author>
<published>2012-10-17T08:45:36Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=edf5181e0804d4d484b11b4d4e8150a80a39908b'/>
<id>urn:sha1:edf5181e0804d4d484b11b4d4e8150a80a39908b</id>
<content type='text'>
commit 65635cbc37e011e71b208257a25e7c1078cd039b upstream.

blk_put_rl() does not call blkg_put() for q-&gt;root_rl because we
don't take request list reference on q-&gt;root_blkg.
However, if root_blkg is once attached then detached (freed),
blk_put_rl() is confused by the bogus pointer in q-&gt;root_blkg.

For example, with !CONFIG_BLK_DEV_THROTTLING &amp;&amp;
CONFIG_CFQ_GROUP_IOSCHED,
switching IO scheduler from cfq to deadline will cause system stall
after the following warning with 3.6:

&gt; WARNING: at /work/build/linux/block/blk-cgroup.h:250
&gt; blk_put_rl+0x4d/0x95()
&gt; Modules linked in: bridge stp llc sunrpc acpi_cpufreq freq_table mperf
&gt; ipt_REJECT nf_conntrack_ipv4 nf_defrag_ipv4
&gt; Pid: 0, comm: swapper/0 Not tainted 3.6.0 #1
&gt; Call Trace:
&gt;  &lt;IRQ&gt;  [&lt;ffffffff810453bd&gt;] warn_slowpath_common+0x85/0x9d
&gt;  [&lt;ffffffff810453ef&gt;] warn_slowpath_null+0x1a/0x1c
&gt;  [&lt;ffffffff811d5f8d&gt;] blk_put_rl+0x4d/0x95
&gt;  [&lt;ffffffff811d614a&gt;] __blk_put_request+0xc3/0xcb
&gt;  [&lt;ffffffff811d71a3&gt;] blk_finish_request+0x232/0x23f
&gt;  [&lt;ffffffff811d76c3&gt;] ? blk_end_bidi_request+0x34/0x5d
&gt;  [&lt;ffffffff811d76d1&gt;] blk_end_bidi_request+0x42/0x5d
&gt;  [&lt;ffffffff811d7728&gt;] blk_end_request+0x10/0x12
&gt;  [&lt;ffffffff812cdf16&gt;] scsi_io_completion+0x207/0x4d5
&gt;  [&lt;ffffffff812c6fcf&gt;] scsi_finish_command+0xfa/0x103
&gt;  [&lt;ffffffff812ce2f8&gt;] scsi_softirq_done+0xff/0x108
&gt;  [&lt;ffffffff811dcea5&gt;] blk_done_softirq+0x8d/0xa1
&gt;  [&lt;ffffffff810915d5&gt;] ?
&gt;  generic_smp_call_function_single_interrupt+0x9f/0xd7
&gt;  [&lt;ffffffff8104cf5b&gt;] __do_softirq+0x102/0x213
&gt;  [&lt;ffffffff8108a5ec&gt;] ? lock_release_holdtime+0xb6/0xbb
&gt;  [&lt;ffffffff8104d2b4&gt;] ? raise_softirq_irqoff+0x9/0x3d
&gt;  [&lt;ffffffff81424dfc&gt;] call_softirq+0x1c/0x30
&gt;  [&lt;ffffffff81011beb&gt;] do_softirq+0x4b/0xa3
&gt;  [&lt;ffffffff8104cdb0&gt;] irq_exit+0x53/0xd5
&gt;  [&lt;ffffffff8102d865&gt;] smp_call_function_single_interrupt+0x34/0x36
&gt;  [&lt;ffffffff8142486f&gt;] call_function_single_interrupt+0x6f/0x80
&gt;  &lt;EOI&gt;  [&lt;ffffffff8101800b&gt;] ? mwait_idle+0x94/0xcd
&gt;  [&lt;ffffffff81018002&gt;] ? mwait_idle+0x8b/0xcd
&gt;  [&lt;ffffffff81017811&gt;] cpu_idle+0xbb/0x114
&gt;  [&lt;ffffffff81401fbd&gt;] rest_init+0xc1/0xc8
&gt;  [&lt;ffffffff81401efc&gt;] ? csum_partial_copy_generic+0x16c/0x16c
&gt;  [&lt;ffffffff81cdbd3d&gt;] start_kernel+0x3d4/0x3e1
&gt;  [&lt;ffffffff81cdb79e&gt;] ? kernel_init+0x1f7/0x1f7
&gt;  [&lt;ffffffff81cdb2dd&gt;] x86_64_start_reservations+0xb8/0xbd
&gt;  [&lt;ffffffff81cdb3e3&gt;] x86_64_start_kernel+0x101/0x110

This patch clears q-&gt;root_blkg and q-&gt;root_rl.blkg when root blkg
is destroyed.

Signed-off-by: Jun'ichi Nomura &lt;j-nomura@ce.jp.nec.com&gt;
Acked-by: Vivek Goyal &lt;vgoyal@redhat.com&gt;
Acked-by: Tejun Heo &lt;tj@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: fix request_queue-&gt;flags initialization</title>
<updated>2012-10-21T16:32:40Z</updated>
<author>
<name>Tejun Heo</name>
<email>tj@kernel.org</email>
</author>
<published>2012-09-20T21:09:30Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=e68aa412d98d72b8096f93f6c02999c8a40df3ac'/>
<id>urn:sha1:e68aa412d98d72b8096f93f6c02999c8a40df3ac</id>
<content type='text'>
commit 60ea8226cbd5c8301f9a39edc574ddabcb8150e0 upstream.

A queue newly allocated with blk_alloc_queue_node() has only
QUEUE_FLAG_BYPASS set.  For request-based drivers,
blk_init_allocated_queue() is called and q-&gt;queue_flags is overwritten
with QUEUE_FLAG_DEFAULT which doesn't include BYPASS even though the
initial bypass is still in effect.

In blk_init_allocated_queue(), or QUEUE_FLAG_DEFAULT to q-&gt;queue_flags
instead of overwriting.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Acked-by: Vivek Goyal &lt;vgoyal@redhat.com&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>blk: add an upper sanity check on partition adding</title>
<updated>2012-09-18T09:56:29Z</updated>
<author>
<name>Alan Cox</name>
<email>alan@linux.intel.com</email>
</author>
<published>2012-09-17T10:47:13Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=2bd6efad25d7c1950008e2ab4e2d6796001919fc'/>
<id>urn:sha1:2bd6efad25d7c1950008e2ab4e2d6796001919fc</id>
<content type='text'>
65536 should be ludicrous anyway but without it we overflow the
memory computation doing the allocation and badness occurs.

Signed-off-by: Alan Cox &lt;alan@linux.intel.com&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>block: rate-limit the error message from failing commands</title>
<updated>2012-08-30T23:26:25Z</updated>
<author>
<name>Yi Zou</name>
<email>yi.zou@intel.com</email>
</author>
<published>2012-08-30T23:26:25Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=37d7b34f05b7bcca364bdf47d8955e766094a244'/>
<id>urn:sha1:37d7b34f05b7bcca364bdf47d8955e766094a244</id>
<content type='text'>
When performing a cable pull test w/ active stress I/O using fio over
a dual port Intel 82599 FCoE CNA, w/ 256LUNs on one port and about 32LUNs
on the other, it is observed that the system becomes not usable due to
scsi-ml being busy printing the error messages for all the failing commands.
I don't believe this problem is specific to FCoE and these commands are
anyway failing due to link being down (DID_NO_CONNECT), just rate-limit
the messages here to solve this issue.

v2-&gt;v1: use __ratelimit() as Tomas Henzl mentioned as the proper way for
rate-limit per function. However, in this case, the failed i/o gets to
blk_end_request_err() and then blk_update_request(), which also has to
be rate-limited, as added in the v2 of this patch.

v3-v2: resolved conflict to apply on current 3.6-rc3 upstream tip.

Signed-off-by: Yi Zou &lt;yi.zou@intel.com&gt;
Cc: www.Open-FCoE.org &lt;devel@open-fcoe.org&gt;
Cc: Tomas Henzl &lt;thenzl@redhat.com&gt;
Cc: &lt;linux-scsi@vger.kernel.org&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>block: Don't use static to define "void *p" in show_partition_start()</title>
<updated>2012-08-03T08:42:00Z</updated>
<author>
<name>Jianpeng Ma</name>
<email>majianpeng@gmail.com</email>
</author>
<published>2012-08-03T08:42:00Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=0676806707281e27b13d44323bed580a8160b7a4'/>
<id>urn:sha1:0676806707281e27b13d44323bed580a8160b7a4</id>
<content type='text'>
I met a odd prblem:read /proc/partitions may return zero.

I wrote a file test.c:
int main()
{
	char buff[4096];
	int ret;
	int fd;
	printf("pid=%d\n",getpid());
	while (1) {
		fd = open("/proc/partitions", O_RDONLY);
		if (fd &lt; 0) {
			printf("open error %s\n", strerror(errno));
			return 0;
		}
		ret = read(fd, buff, 4096);
		if (ret &lt;= 0)
			printf("ret=%d, %s, %ld\n", ret,
				strerror(errno), lseek(fd,0,SEEK_CUR));
		close(fd);
	}
	exit(0);
}

You can reproduce by:
1:while true;do cat /proc/partitions &gt; /dev/null ;done
2:./test

I reviewed the code and found:

&gt;&gt; static void *show_partition_start(struct seq_file *seqf, loff_t *pos)
&gt;&gt; {
&gt;&gt; 	static void *p;
&gt;&gt;
&gt;&gt; 	p = disk_seqf_start(seqf, pos);
&gt;&gt; 	if (!IS_ERR_OR_NULL(p) &amp;&amp; !*pos)
&gt;&gt; 		seq_puts(seqf, "major minor  #blocks  name\n\n");
&gt;&gt; 	return p;
&gt;&gt; }
		test								cat /proc/partitions
	p = disk_seqf_start()(Not NULL)
									p = disk_seqf_start()(NULL because pos)
	if (!IS_ERR_OR_NULL(p) &amp;&amp; !*pos)

Signed-off-by: Jianpeng Ma &lt;majianpeng@gmail.com&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>block: Add blk_bio_map_sg() helper</title>
<updated>2012-08-02T21:42:04Z</updated>
<author>
<name>Asias He</name>
<email>asias@redhat.com</email>
</author>
<published>2012-08-02T21:42:04Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=85b9f66a41eb8ee3f1dfc95707412705463cdd97'/>
<id>urn:sha1:85b9f66a41eb8ee3f1dfc95707412705463cdd97</id>
<content type='text'>
Add a helper to map a bio to a scatterlist, modelled after
blk_rq_map_sg.

This helper is useful for any driver that wants to create
a scatterlist from its -&gt;make_request_fn method.

Changes in v2:
 - Use __blk_segment_map_sg to avoid duplicated code
 - Add cocbook style function comment

Cc: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
Cc: Christoph Hellwig &lt;hch@lst.de&gt;
Cc: Tejun Heo &lt;tj@kernel.org&gt;
Cc: Shaohua Li &lt;shli@kernel.org&gt;
Cc: "Michael S. Tsirkin" &lt;mst@redhat.com&gt;
Cc: kvm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: virtualization@lists.linux-foundation.org
Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: Minchan Kim &lt;minchan.kim@gmail.com&gt;
Signed-off-by: Asias He &lt;asias@redhat.com&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>block: Introduce __blk_segment_map_sg() helper</title>
<updated>2012-08-02T21:42:03Z</updated>
<author>
<name>Asias He</name>
<email>asias@redhat.com</email>
</author>
<published>2012-08-02T21:42:03Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=963ab9e5da95c654bb3ab937cc478de4f7088a96'/>
<id>urn:sha1:963ab9e5da95c654bb3ab937cc478de4f7088a96</id>
<content type='text'>
Split the mapping code in blk_rq_map_sg() to a helper
__blk_segment_map_sg(), so that other mapping function, e.g.
blk_bio_map_sg(), can share the code.

Cc: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
Cc: Christoph Hellwig &lt;hch@lst.de&gt;
Cc: Tejun Heo &lt;tj@kernel.org&gt;
Cc: Shaohua Li &lt;shli@kernel.org&gt;
Cc: "Michael S. Tsirkin" &lt;mst@redhat.com&gt;
Cc: kvm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: virtualization@lists.linux-foundation.org
Suggested-by: Jens Axboe &lt;axboe@kernel.dk&gt;
Suggested-by: Tejun Heo &lt;tj@kernel.org&gt;
Signed-off-by: Asias He &lt;asias@redhat.com&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>block: split discard into aligned requests</title>
<updated>2012-08-02T07:48:50Z</updated>
<author>
<name>Paolo Bonzini</name>
<email>pbonzini@redhat.com</email>
</author>
<published>2012-08-02T07:48:50Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=c6e666345e1b79c62ba82339cc7d55a89cb73f88'/>
<id>urn:sha1:c6e666345e1b79c62ba82339cc7d55a89cb73f88</id>
<content type='text'>
When a disk has large discard_granularity and small max_discard_sectors,
discards are not split with optimal alignment.  In the limit case of
discard_granularity == max_discard_sectors, no request could be aligned
correctly, so in fact you might end up with no discarded logical blocks
at all.

Another example that helps showing the condition in the patch is with
discard_granularity == 64, max_discard_sectors == 128.  A request that is
submitted for 256 sectors 2..257 will be split in two: 2..129, 130..257.
However, only 2 aligned blocks out of 3 are included in the request;
128..191 may be left intact and not discarded.  With this patch, the
first request will be truncated to ensure good alignment of what's left,
and the split will be 2..127, 128..255, 256..257.  The patch will also
take into account the discard_alignment.

At most one extra request will be introduced, because the first request
will be reduced by at most granularity-1 sectors, and granularity
must be less than max_discard_sectors.  Subsequent requests will run
on round_down(max_discard_sectors, granularity) sectors, as in the
current code.

Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
Acked-by: Vivek Goyal &lt;vgoyal@redhat.com&gt;
Tested-by: Mike Snitzer &lt;snitzer@redhat.com&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>block: reorganize rounding of max_discard_sectors</title>
<updated>2012-08-02T07:48:49Z</updated>
<author>
<name>Paolo Bonzini</name>
<email>pbonzini@redhat.com</email>
</author>
<published>2012-08-02T07:48:49Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=f6ff53d3611b564661896be23369b54d84941a0e'/>
<id>urn:sha1:f6ff53d3611b564661896be23369b54d84941a0e</id>
<content type='text'>
Mostly a preparation for the next patch.

In principle this fixes an infinite loop if max_discard_sectors &lt; granularity,
but that really shouldn't happen.

Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
Acked-by: Vivek Goyal &lt;vgoyal@redhat.com&gt;
Tested-by: Mike Snitzer &lt;snitzer@redhat.com&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
</feed>
