<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/block, branch v2.6.34.8</title>
<subtitle>Linux kernel source tree</subtitle>
<id>https://git.amat.us/linux/atom/block?h=v2.6.34.8</id>
<link rel='self' href='https://git.amat.us/linux/atom/block?h=v2.6.34.8'/>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/'/>
<updated>2011-01-06T23:08:15Z</updated>
<entry>
<title>bsg: fix incorrect device_status value</title>
<updated>2011-01-06T23:08:15Z</updated>
<author>
<name>FUJITA Tomonori</name>
<email>fujita.tomonori@lab.ntt.co.jp</email>
</author>
<published>2010-09-16T15:46:42Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=86261be42eeb89e48f9722c2eaf477da8ef44a36'/>
<id>urn:sha1:86261be42eeb89e48f9722c2eaf477da8ef44a36</id>
<content type='text'>
commit 478971600e47cb83ff2d3c63c5c24f2b04b0d6a1 upstream.

bsg incorrectly returns sg's masked_status value for device_status.

[jejb: fix up expression logic]
Reported-by: Douglas Gilbert &lt;dgilbert@interlog.com&gt;
Signed-off-by: FUJITA Tomonori &lt;fujita.tomonori@lab.ntt.co.jp&gt;
Signed-off-by: James Bottomley &lt;James.Bottomley@suse.de&gt;
Signed-off-by: Paul Gortmaker &lt;paul.gortmaker@windriver.com&gt;
</content>
</entry>
<entry>
<title>block: Don't count_vm_events for discard bio in submit_bio.</title>
<updated>2010-08-02T17:30:18Z</updated>
<author>
<name>Tao Ma</name>
<email>tao.ma@oracle.com</email>
</author>
<published>2010-06-23T23:43:57Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=caf785bc19966cedc0ba3ee43526e0af43bd001a'/>
<id>urn:sha1:caf785bc19966cedc0ba3ee43526e0af43bd001a</id>
<content type='text'>
commit 1b99973f1c82707e46e8cb9416865a1e955e8f8c upstream.

In submit_bio, we count vm events by check READ/WRITE.
But actually DISCARD_NOBARRIER also has the WRITE flag set.
It looks as if in blkdev_issue_discard, we also add a
page as the payload and the bio_has_data check isn't enough.
So add another check for discard bio.

Signed-off-by: Tao Ma &lt;tao.ma@oracle.com&gt;
Signed-off-by: Jens Axboe &lt;jaxboe@fusionio.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
</entry>
<entry>
<title>cfq: Don't allow queue merges for queues that have no process references</title>
<updated>2010-08-02T17:29:47Z</updated>
<author>
<name>Jeff Moyer</name>
<email>jmoyer@redhat.com</email>
</author>
<published>2010-06-17T14:19:11Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=e86dd9fae6df8417f4461ca0c108e9aee585a077'/>
<id>urn:sha1:e86dd9fae6df8417f4461ca0c108e9aee585a077</id>
<content type='text'>
commit c10b61f0910466b4b99c266a7d76ac4390743fb5 upstream.

Hi,

A user reported a kernel bug when running a particular program that did
the following:

created 32 threads
- each thread took a mutex, grabbed a global offset, added a buffer size
  to that offset, released the lock
- read from the given offset in the file
- created a new thread to do the same
- exited

The result is that cfq's close cooperator logic would trigger, as the
threads were issuing I/O within the mean seek distance of one another.
This workload managed to routinely trigger a use after free bug when
walking the list of merge candidates for a particular cfqq
(cfqq-&gt;new_cfqq).  The logic used for merging queues looks like this:

static void cfq_setup_merge(struct cfq_queue *cfqq, struct cfq_queue *new_cfqq)
{
	int process_refs, new_process_refs;
	struct cfq_queue *__cfqq;

	/* Avoid a circular list and skip interim queue merges */
	while ((__cfqq = new_cfqq-&gt;new_cfqq)) {
		if (__cfqq == cfqq)
			return;
		new_cfqq = __cfqq;
	}

	process_refs = cfqq_process_refs(cfqq);
	/*
	 * If the process for the cfqq has gone away, there is no
	 * sense in merging the queues.
	 */
	if (process_refs == 0)
		return;

	/*
	 * Merge in the direction of the lesser amount of work.
	 */
	new_process_refs = cfqq_process_refs(new_cfqq);
	if (new_process_refs &gt;= process_refs) {
		cfqq-&gt;new_cfqq = new_cfqq;
		atomic_add(process_refs, &amp;new_cfqq-&gt;ref);
	} else {
		new_cfqq-&gt;new_cfqq = cfqq;
		atomic_add(new_process_refs, &amp;cfqq-&gt;ref);
	}
}

When a merge candidate is found, we add the process references for the
queue with less references to the queue with more.  The actual merging
of queues happens when a new request is issued for a given cfqq.  In the
case of the test program, it only does a single pread call to read in
1MB, so the actual merge never happens.

Normally, this is fine, as when the queue exits, we simply drop the
references we took on the other cfqqs in the merge chain:

	/*
	 * If this queue was scheduled to merge with another queue, be
	 * sure to drop the reference taken on that queue (and others in
	 * the merge chain).  See cfq_setup_merge and cfq_merge_cfqqs.
	 */
	__cfqq = cfqq-&gt;new_cfqq;
	while (__cfqq) {
		if (__cfqq == cfqq) {
			WARN(1, "cfqq-&gt;new_cfqq loop detected\n");
			break;
		}
		next = __cfqq-&gt;new_cfqq;
		cfq_put_queue(__cfqq);
		__cfqq = next;
	}

However, there is a hole in this logic.  Consider the following (and
keep in mind that each I/O keeps a reference to the cfqq):

q1-&gt;new_cfqq = q2   // q2 now has 2 process references
q3-&gt;new_cfqq = q2   // q2 now has 3 process references

// the process associated with q2 exits
// q2 now has 2 process references

// queue 1 exits, drops its reference on q2
// q2 now has 1 process reference

// q3 exits, so has 0 process references, and hence drops its references
// to q2, which leaves q2 also with 0 process references

q4 comes along and wants to merge with q3

q3-&gt;new_cfqq still points at q2!  We follow that link and end up at an
already freed cfqq.

So, the fix is to not follow a merge chain if the top-most queue does
not have a process reference, otherwise any queue in the chain could be
already freed.  I also changed the logic to disallow merging with a
queue that does not have any process references.  Previously, we did
this check for one of the merge candidates, but not the other.  That
doesn't really make sense.

Without the attached patch, my system would BUG within a couple of
seconds of running the reproducer program.  With the patch applied, my
system ran the program for over an hour without issues.

This addresses the following bugzilla:
    https://bugzilla.kernel.org/show_bug.cgi?id=16217

Thanks a ton to Phil Carns for providing the bug report and an excellent
reproducer.

[ Note for stable: this applies to 2.6.32/33/34 ].

Signed-off-by: Jeff Moyer &lt;jmoyer@redhat.com&gt;
Reported-by: Phil Carns &lt;carns@mcs.anl.gov&gt;
Signed-off-by: Jens Axboe &lt;jaxboe@fusionio.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
</entry>
<entry>
<title>cfq-iosched: fix an oops caused by slab leak</title>
<updated>2010-07-05T18:22:50Z</updated>
<author>
<name>Shaohua Li</name>
<email>shaohua.li@intel.com</email>
</author>
<published>2010-05-25T08:16:53Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=42864ec780011c0a8357317e03151f203d3d6b8c'/>
<id>urn:sha1:42864ec780011c0a8357317e03151f203d3d6b8c</id>
<content type='text'>
commit d02a2c077fb81f3224c770be62a318165b23b486 upstream.

I got below oops when unloading cfq-iosched. Considering scenario:
queue A merge to B, C merge to D and B will be merged to D. Before B is merged
to D, we do split B. We should put B's reference for D.

[  807.768536] =============================================================================
[  807.768539] BUG cfq_queue: Objects remaining on kmem_cache_close()
[  807.768541] -----------------------------------------------------------------------------
[  807.768543]
[  807.768546] INFO: Slab 0xffffea0003e6b4e0 objects=26 used=1 fp=0xffff88011d584fd8 flags=0x200000000004082
[  807.768550] Pid: 5946, comm: rmmod Tainted: G        W   2.6.34-07097-gf4b87de-dirty #724
[  807.768552] Call Trace:
[  807.768560]  [&lt;ffffffff81104e8d&gt;] slab_err+0x8f/0x9d
[  807.768564]  [&lt;ffffffff811059e1&gt;] ? flush_cpu_slab+0x0/0x93
[  807.768569]  [&lt;ffffffff8164be52&gt;] ? add_preempt_count+0xe/0xca
[  807.768572]  [&lt;ffffffff8164bd9c&gt;] ? sub_preempt_count+0xe/0xb6
[  807.768577]  [&lt;ffffffff81648871&gt;] ? _raw_spin_unlock+0x15/0x30
[  807.768580]  [&lt;ffffffff8164bd9c&gt;] ? sub_preempt_count+0xe/0xb6
[  807.768584]  [&lt;ffffffff811061bc&gt;] list_slab_objects+0x9b/0x19f
[  807.768588]  [&lt;ffffffff8164bf0a&gt;] ? add_preempt_count+0xc6/0xca
[  807.768591]  [&lt;ffffffff81109e27&gt;] kmem_cache_destroy+0x13f/0x21d
[  807.768597]  [&lt;ffffffffa000ff13&gt;] cfq_slab_kill+0x1a/0x43 [cfq_iosched]
[  807.768601]  [&lt;ffffffffa000ffcf&gt;] cfq_exit+0x93/0x9e [cfq_iosched]
[  807.768606]  [&lt;ffffffff810973a2&gt;] sys_delete_module+0x1b1/0x219
[  807.768612]  [&lt;ffffffff8102fb5b&gt;] system_call_fastpath+0x16/0x1b
[  807.768618] INFO: Object 0xffff88011d584618 @offset=1560
[  807.768622] INFO: Allocated in cfq_get_queue+0x11e/0x274 [cfq_iosched] age=7173 cpu=1 pid=5496
[  807.768626] =============================================================================

Signed-off-by: Shaohua Li &lt;shaohua.li@intel.com&gt;
Signed-off-by: Jens Axboe &lt;jens.axboe@oracle.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
</entry>
<entry>
<title>blk-cgroup: Fix an RCU warning in blkiocg_create()</title>
<updated>2010-05-07T06:57:00Z</updated>
<author>
<name>Li Zefan</name>
<email>lizf@cn.fujitsu.com</email>
</author>
<published>2010-05-07T06:57:00Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=0341509fdfc9519f7de6aabc5dd23217cef72b73'/>
<id>urn:sha1:0341509fdfc9519f7de6aabc5dd23217cef72b73</id>
<content type='text'>
with CONFIG_PROVE_RCU=y, a warning can be triggered:

  # mount -t cgroup -o blkio xxx /mnt
  # mkdir /mnt/subgroup

...
kernel/cgroup.c:4442 invoked rcu_dereference_check() without protection!
...

To fix this, we avoid caling css_depth() here, which is a bit simpler
than the original code.

Signed-off-by: Li Zefan &lt;lizf@cn.fujitsu.com&gt;
Acked-by: Vivek Goyal &lt;vgoyal@redhat.com&gt;
Signed-off-by: Jens Axboe &lt;jens.axboe@oracle.com&gt;
</content>
</entry>
<entry>
<title>blk-cgroup: Fix RCU correctness warning in cfq_init_queue()</title>
<updated>2010-05-06T06:54:00Z</updated>
<author>
<name>Vivek Goyal</name>
<email>vgoyal@redhat.com</email>
</author>
<published>2010-04-22T15:54:52Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=dcf097b247affd8b88ad410a92298590c5600f44'/>
<id>urn:sha1:dcf097b247affd8b88ad410a92298590c5600f44</id>
<content type='text'>
It is necessary to be in an RCU read-side critical section when invoking
css_id(), so this patch adds one to blkiocg_add_blkio_group().  This is
actually a false positive, because this is called at initialization time
and hence always refers to the root cgroup, which cannot go away.

[  103.790505] ===================================================
[  103.790509] [ INFO: suspicious rcu_dereference_check() usage. ]
[  103.790511] ---------------------------------------------------
[  103.790514] kernel/cgroup.c:4432 invoked rcu_dereference_check() without protection!
[  103.790517]
[  103.790517] other info that might help us debug this:
[  103.790519]
[  103.790521]
[  103.790521] rcu_scheduler_active = 1, debug_locks = 1
[  103.790524] 4 locks held by bash/4422:
[  103.790526]  #0:  (&amp;buffer-&gt;mutex){+.+.+.}, at: [&lt;ffffffff8114befa&gt;] sysfs_write_file+0x3c/0x144
[  103.790537]  #1:  (s_active#102){.+.+.+}, at: [&lt;ffffffff8114bfa5&gt;] sysfs_write_file+0xe7/0x144
[  103.790544]  #2:  (&amp;q-&gt;sysfs_lock){+.+.+.}, at: [&lt;ffffffff812263b1&gt;] queue_attr_store+0x49/0x8f
[  103.790552]  #3:  (&amp;(&amp;blkcg-&gt;lock)-&gt;rlock){......}, at: [&lt;ffffffff8122e4db&gt;] blkiocg_add_blkio_group+0x2b/0xad
[  103.790560]
[  103.790561] stack backtrace:
[  103.790564] Pid: 4422, comm: bash Not tainted 2.6.34-rc4-blkio-second-crash #81
[  103.790567] Call Trace:
[  103.790572]  [&lt;ffffffff81068f57&gt;] lockdep_rcu_dereference+0x9d/0xa5
[  103.790577]  [&lt;ffffffff8107fac1&gt;] css_id+0x44/0x57
[  103.790581]  [&lt;ffffffff8122e503&gt;] blkiocg_add_blkio_group+0x53/0xad
[  103.790586]  [&lt;ffffffff81231936&gt;] cfq_init_queue+0x139/0x32c
[  103.790591]  [&lt;ffffffff8121f2d0&gt;] elv_iosched_store+0xbf/0x1bf
[  103.790595]  [&lt;ffffffff812263d8&gt;] queue_attr_store+0x70/0x8f
[  103.790599]  [&lt;ffffffff8114bfa5&gt;] ? sysfs_write_file+0xe7/0x144
[  103.790603]  [&lt;ffffffff8114bfc6&gt;] sysfs_write_file+0x108/0x144
[  103.790609]  [&lt;ffffffff810f527f&gt;] vfs_write+0xae/0x10b
[  103.790612]  [&lt;ffffffff81069863&gt;] ? trace_hardirqs_on_caller+0x10c/0x130
[  103.790616]  [&lt;ffffffff810f539c&gt;] sys_write+0x4a/0x6e
[  103.790622]  [&lt;ffffffff81002b5b&gt;] system_call_fastpath+0x16/0x1b
[  103.790625]

Located-by: Miles Lane &lt;miles.lane@gmail.com&gt;
Signed-off-by: Vivek Goyal &lt;vgoyal@redhat.com&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@linux.vnet.ibm.com&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
Signed-off-by: Jens Axboe &lt;jens.axboe@oracle.com&gt;
</content>
</entry>
<entry>
<title>block: ensure jiffies wrap is handled correctly in blk_rq_timed_out_timer</title>
<updated>2010-04-21T15:42:08Z</updated>
<author>
<name>Richard Kennedy</name>
<email>richard@rsk.demon.co.uk</email>
</author>
<published>2010-04-14T18:54:03Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=a534dbe96e9929c7245924d8252d89048c23d569'/>
<id>urn:sha1:a534dbe96e9929c7245924d8252d89048c23d569</id>
<content type='text'>
blk_rq_timed_out_timer() relied on blk_add_timer() never returning a
timer value of zero, but commit 7838c15b8dd18e78a523513749e5b54bda07b0cb
removed the code that bumped this value when it was zero.
Therefore when jiffies is near wrap we could get unlucky &amp; not set the
timeout value correctly.

This patch uses a flag to indicate that the timeout value was set and so
handles jiffies wrap correctly, and it keeps all the logic in one
function so should be easier to maintain in the future.

Signed-off-by: Richard Kennedy &lt;richard@rsk.demon.co.uk&gt;
Cc: stable@kernel.org
Signed-off-by: Jens Axboe &lt;jens.axboe@oracle.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'for-linus' of git://git.kernel.dk/linux-2.6-block</title>
<updated>2010-04-09T18:50:29Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2010-04-09T18:50:29Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=2f4084209adc77f9a1c9f38db3019a509e167882'/>
<id>urn:sha1:2f4084209adc77f9a1c9f38db3019a509e167882</id>
<content type='text'>
* 'for-linus' of git://git.kernel.dk/linux-2.6-block: (34 commits)
  cfq-iosched: Fix the incorrect timeslice accounting with forced_dispatch
  loop: Update mtime when writing using aops
  block: expose the statistics in blkio.time and blkio.sectors for the root cgroup
  backing-dev: Handle class_create() failure
  Block: Fix block/elevator.c elevator_get() off-by-one error
  drbd: lc_element_by_index() never returns NULL
  cciss: unlock on error path
  cfq-iosched: Do not merge queues of BE and IDLE classes
  cfq-iosched: Add additional blktrace log messages in CFQ for easier debugging
  i2o: Remove the dangerous kobj_to_i2o_device macro
  block: remove 16 bytes of padding from struct request on 64bits
  cfq-iosched: fix a kbuild regression
  block: make CONFIG_BLK_CGROUP visible
  Remove GENHD_FL_DRIVERFS
  block: Export max number of segments and max segment size in sysfs
  block: Finalize conversion of block limits functions
  block: Fix overrun in lcm() and move it to lib
  vfs: improve writeback_inodes_wb()
  paride: fix off-by-one test
  drbd: fix al-to-on-disk-bitmap for 4k logical_block_size
  ...
</content>
</entry>
<entry>
<title>cfq-iosched: Fix the incorrect timeslice accounting with forced_dispatch</title>
<updated>2010-04-09T07:29:57Z</updated>
<author>
<name>Divyesh Shah</name>
<email>dpshah@google.com</email>
</author>
<published>2010-04-09T07:29:57Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=3440c49f5c5ecb4f29b0544aa87da71888404f8f'/>
<id>urn:sha1:3440c49f5c5ecb4f29b0544aa87da71888404f8f</id>
<content type='text'>
When CFQ dispatches requests forcefully due to a barrier or changing iosched,
it runs through all cfqq's dispatching requests and then expires each queue.
However, it does not activate a cfqq before flushing its IOs resulting in
using stale values for computing slice_used.
This patch fixes it by calling activate queue before flushing reuqests from
each queue.

This is useful mostly for barrier requests because when the iosched is changing
it really doesnt matter if we have incorrect accounting since we're going to
break down all structures anyway.

We also now expire the current timeslice before moving on with the dispatch
to accurately account slice used for that cfqq.

Signed-off-by: Divyesh Shah&lt;dpshah@google.com&gt;
Signed-off-by: Jens Axboe &lt;jens.axboe@oracle.com&gt;
</content>
</entry>
<entry>
<title>block: expose the statistics in blkio.time and blkio.sectors for the root cgroup</title>
<updated>2010-04-05T16:22:17Z</updated>
<author>
<name>Ricky Benitez</name>
<email>rickyb@google.com</email>
</author>
<published>2010-04-05T16:22:17Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=a74b2adae06265b8cfa335d7d40d4a5abd11e977'/>
<id>urn:sha1:a74b2adae06265b8cfa335d7d40d4a5abd11e977</id>
<content type='text'>
Currently, the io statistics for the root cgroup are maintained, but
they are not shown because the device information is not available at
the point that the root blkio cgroup is created. This patch updates
the device information when the statistics are updated so that the
statistics become visible.

Signed-off-by: Ricky Benitez &lt;rickyb@google.com&gt;
Acked-by: Vivek Goyal &lt;vgoyal@redhat.com&gt;
Signed-off-by: Jens Axboe &lt;jens.axboe@oracle.com&gt;
</content>
</entry>
</feed>
