<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/linux.git/block, branch v3.3.4</title>
<subtitle>Linux Kernel
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v3.3.4</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v3.3.4'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/'/>
<updated>2012-03-15T00:16:45Z</updated>
<entry>
<title>Merge branch 'for-linus' of git://git.kernel.dk/linux-block</title>
<updated>2012-03-15T00:16:45Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2012-03-15T00:16:45Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=f1cbd03f5eabb75ea8ace23b47d2209f10871c16'/>
<id>urn:sha1:f1cbd03f5eabb75ea8ace23b47d2209f10871c16</id>
<content type='text'>
Pull block fixes from Jens Axboe:
 "Been sitting on this for a while, but lets get this out the door.
  This fixes various important bugs for 3.3 final, along with a few more
  trivial ones.  Please pull!"

* 'for-linus' of git://git.kernel.dk/linux-block:
  block: fix ioc leak in put_io_context
  block, sx8: fix pointer math issue getting fw version
  Block: use a freezable workqueue for disk-event polling
  drivers/block/DAC960: fix -Wuninitialized warning
  drivers/block/DAC960: fix DAC960_V2_IOCTL_Opcode_T -Wenum-compare warning
  block: fix __blkdev_get and add_disk race condition
  block: Fix setting bio flags in drivers (sd_dif/floppy)
  block: Fix NULL pointer dereference in sd_revalidate_disk
  block: exit_io_context() should call elevator_exit_icq_fn()
  block: simplify ioc_release_fn()
  block: replace icq-&gt;changed with icq-&gt;flags
</content>
</entry>
<entry>
<title>block: fix ioc leak in put_io_context</title>
<updated>2012-03-14T14:34:48Z</updated>
<author>
<name>Xiaotian Feng</name>
<email>xtfeng@gmail.com</email>
</author>
<published>2012-03-14T14:34:48Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=ff8c1474cc2f5e11414c71ec4d739c18e6e669c0'/>
<id>urn:sha1:ff8c1474cc2f5e11414c71ec4d739c18e6e669c0</id>
<content type='text'>
When put_io_context is called, if ioc-&gt;icq_list is empty and refcount
is 1, kernel will not free the ioc.

This is caught by following kmemleak:

unreferenced object 0xffff880036349fe0 (size 216):
  comm "sh", pid 2137, jiffies 4294931140 (age 290579.412s)
  hex dump (first 32 bytes):
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    01 00 01 00 ad 4e ad de ff ff ff ff 00 00 00 00  .....N..........
  backtrace:
    [&lt;ffffffff8169f926&gt;] kmemleak_alloc+0x26/0x50
    [&lt;ffffffff81195a9c&gt;] kmem_cache_alloc_node+0x1cc/0x2a0
    [&lt;ffffffff81356b67&gt;] create_io_context_slowpath+0x27/0x130
    [&lt;ffffffff81356d2b&gt;] get_task_io_context+0xbb/0xf0
    [&lt;ffffffff81055f0e&gt;] copy_process+0x188e/0x18b0
    [&lt;ffffffff8105609b&gt;] do_fork+0x11b/0x420
    [&lt;ffffffff810247f8&gt;] sys_clone+0x28/0x30
    [&lt;ffffffff816d3373&gt;] stub_clone+0x13/0x20
    [&lt;ffffffffffffffff&gt;] 0xffffffffffffffff

ioc should be freed if ioc-&gt;icq_list is empty.
Signed-off-by: Xiaotian Feng &lt;dannyfeng@tencent.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;
</content>
</entry>
<entry>
<title>Block: use a freezable workqueue for disk-event polling</title>
<updated>2012-03-02T09:51:00Z</updated>
<author>
<name>Alan Stern</name>
<email>stern@rowland.harvard.edu</email>
</author>
<published>2012-03-02T09:51:00Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=62d3c5439c534b0e6c653fc63e6d8c67be3a57b1'/>
<id>urn:sha1:62d3c5439c534b0e6c653fc63e6d8c67be3a57b1</id>
<content type='text'>
This patch (as1519) fixes a bug in the block layer's disk-events
polling.  The polling is done by a work routine queued on the
system_nrt_wq workqueue.  Since that workqueue isn't freezable, the
polling continues even in the middle of a system sleep transition.

Obviously, polling a suspended drive for media changes and such isn't
a good thing to do; in the case of USB mass-storage devices it can
lead to real problems requiring device resets and even re-enumeration.

The patch fixes things by creating a new system-wide, non-reentrant,
freezable workqueue and using it for disk-events polling.

Signed-off-by: Alan Stern &lt;stern@rowland.harvard.edu&gt;
CC: &lt;stable@kernel.org&gt;
Acked-by: Tejun Heo &lt;tj@kernel.org&gt;
Acked-by: Rafael J. Wysocki &lt;rjw@sisk.pl&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>block: fix __blkdev_get and add_disk race condition</title>
<updated>2012-03-02T09:44:17Z</updated>
<author>
<name>Stanislaw Gruszka</name>
<email>sgruszka@redhat.com</email>
</author>
<published>2012-03-02T09:43:28Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=9f53d2fe815b4011ff930a7b6db98385d45faa68'/>
<id>urn:sha1:9f53d2fe815b4011ff930a7b6db98385d45faa68</id>
<content type='text'>
The following situation might occur:

__blkdev_get:			add_disk:

				register_disk()
get_gendisk()

disk_block_events()
	disk-&gt;ev == NULL

				disk_add_events()

__disk_unblock_events()
	disk-&gt;ev != NULL
	--ev-&gt;block

Then we unblock events, when they are suppose to be blocked. This can
trigger events related block/genhd.c warnings, but also can crash in
sd_check_events() or other places.

I'm able to reproduce crashes with the following scripts (with
connected usb dongle as sdb disk).

&lt;snip&gt;
DEV=/dev/sdb
ENABLE=/sys/bus/usb/devices/1-2/bConfigurationValue

function stop_me()
{
	for i in `jobs -p` ; do kill $i 2&gt; /dev/null ; done
	exit
}

trap stop_me SIGHUP SIGINT SIGTERM

for ((i = 0; i &lt; 10; i++)) ; do
	while true; do fdisk -l $DEV  2&gt;&amp;1 &gt; /dev/null ; done &amp;
done

while true ; do
echo 1 &gt; $ENABLE
sleep 1
echo 0 &gt; $ENABLE
done
&lt;/snip&gt;

I use the script to verify patch fixing oops in sd_revalidate_disk
http://marc.info/?l=linux-scsi&amp;m=132935572512352&amp;w=2
Without Jun'ichi Nomura patch titled "Fix NULL pointer dereference in
sd_revalidate_disk" or this one, script easily crash kernel within
a few seconds. With both patches applied I do not observe crash.
Unfortunately after some time (dozen of minutes), script will hung in:

[ 1563.906432]  [&lt;c08354f5&gt;] schedule_timeout_uninterruptible+0x15/0x20
[ 1563.906437]  [&lt;c04532d5&gt;] msleep+0x15/0x20
[ 1563.906443]  [&lt;c05d60b2&gt;] blk_drain_queue+0x32/0xd0
[ 1563.906447]  [&lt;c05d6e00&gt;] blk_cleanup_queue+0xd0/0x170
[ 1563.906454]  [&lt;c06d278f&gt;] scsi_free_queue+0x3f/0x60
[ 1563.906459]  [&lt;c06d7e6e&gt;] __scsi_remove_device+0x6e/0xb0
[ 1563.906463]  [&lt;c06d4aff&gt;] scsi_forget_host+0x4f/0x60
[ 1563.906468]  [&lt;c06cd84a&gt;] scsi_remove_host+0x5a/0xf0
[ 1563.906482]  [&lt;f7f030fb&gt;] quiesce_and_remove_host+0x5b/0xa0 [usb_storage]
[ 1563.906490]  [&lt;f7f03203&gt;] usb_stor_disconnect+0x13/0x20 [usb_storage]

Anyway I think this patch is some step forward.

As drawback, I do not teardown on sysfs file create error, because I do
not know how to nullify disk-&gt;ev (since it can be used). However add_disk
error handling practically does not exist too, and things will work
without this sysfs file, except events will not be exported to user
space.

Signed-off-by: Stanislaw Gruszka &lt;sgruszka@redhat.com&gt;
Acked-by: Tejun Heo &lt;tj@kernel.org&gt;
Cc: stable@kernel.org
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>block: Fix NULL pointer dereference in sd_revalidate_disk</title>
<updated>2012-03-02T09:38:33Z</updated>
<author>
<name>Jun'ichi Nomura</name>
<email>j-nomura@ce.jp.nec.com</email>
</author>
<published>2012-03-02T09:38:33Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=fe316bf2d5847bc5dd975668671a7b1067603bc7'/>
<id>urn:sha1:fe316bf2d5847bc5dd975668671a7b1067603bc7</id>
<content type='text'>
Since 2.6.39 (1196f8b), when a driver returns -ENOMEDIUM for open(),
__blkdev_get() calls rescan_partitions() to remove
in-kernel partition structures and raise KOBJ_CHANGE uevent.

However it ends up calling driver's revalidate_disk without open
and could cause oops.

In the case of SCSI:

  process A                  process B
  ----------------------------------------------
  sys_open
    __blkdev_get
      sd_open
        returns -ENOMEDIUM
                             scsi_remove_device
                               &lt;scsi_device torn down&gt;
      rescan_partitions
        sd_revalidate_disk
          &lt;oops&gt;
Oopses are reported here:
http://marc.info/?l=linux-scsi&amp;m=132388619710052

This patch separates the partition invalidation from rescan_partitions()
and use it for -ENOMEDIUM case.

Reported-by: Huajun Li &lt;huajun.li.lee@gmail.com&gt;
Signed-off-by: Jun'ichi Nomura &lt;j-nomura@ce.jp.nec.com&gt;
Acked-by: Tejun Heo &lt;tj@kernel.org&gt;
Cc: stable@kernel.org
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>LDM: Fix reassembly of extended VBLKs.</title>
<updated>2012-02-24T09:37:42Z</updated>
<author>
<name>Anton Altaparmakov</name>
<email>anton@tuxera.com</email>
</author>
<published>2012-02-24T09:37:42Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=97387e3baaf3c35ad560f8878e943c720a77da1b'/>
<id>urn:sha1:97387e3baaf3c35ad560f8878e943c720a77da1b</id>
<content type='text'>
From: Ben Hutchings &lt;ben@decadent.org.uk&gt;

Extended VBLKs (those larger than the preset VBLK size) are divided
into fragments, each with its own VBLK header.  Our LDM implementation
generally assumes that each VBLK is contiguous in memory, so these
fragments must be assembled before further processing.

Currently the reassembly seems to be done quite wrongly - no VBLK
header is copied into the contiguous buffer, and the length of the
header is subtracted twice from each fragment.  Also the total
length of the reassembled VBLK is calculated incorrectly.

Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
Signed-off-by: Anton Altaparmakov &lt;anton@tuxera.com&gt;
</content>
</entry>
<entry>
<title>block: exit_io_context() should call elevator_exit_icq_fn()</title>
<updated>2012-02-15T08:45:53Z</updated>
<author>
<name>Tejun Heo</name>
<email>tj@kernel.org</email>
</author>
<published>2012-02-15T08:45:53Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=621032ad6eaabf2fe771c4fa0d8f58e1fcfcdba6'/>
<id>urn:sha1:621032ad6eaabf2fe771c4fa0d8f58e1fcfcdba6</id>
<content type='text'>
While updating locking, b2efa05265 "block, cfq: unlink
cfq_io_context's immediately" moved elevator_exit_icq_fn() invocation
from exit_io_context() to the final ioc put.  While this doesn't cause
catastrophic failure, it effectively removes task exit notification to
elevator and cause noticeable IO performance degradation with CFQ.

On task exit, CFQ used to immediately expire the slice if it was being
used by the exiting task as no more IO would be issued by the task;
however, after b2efa05265, the notification is lost and disk could sit
idle needlessly, leading to noticeable IO performance degradation for
certain workloads.

This patch renames ioc_exit_icq() to ioc_destroy_icq(), separates
elevator_exit_icq_fn() invocation into ioc_exit_icq() and invokes it
from exit_io_context().  ICQ_EXITED flag is added to avoid invoking
the callback more than once for the same icq.

Walking icq_list from ioc side and invoking elevator callback requires
reverse double locking.  This may be better implemented using RCU;
unfortunately, using RCU isn't trivial.  e.g. RCU protection would
need to cover request_queue and queue_lock switch on cleanup makes
grabbing queue_lock from RCU unsafe.  Reverse double locking should
do, at least for now.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Reported-and-bisected-by: Shaohua Li &lt;shli@kernel.org&gt;
LKML-Reference: &lt;CANejiEVzs=pUhQSTvUppkDcc2TNZyfohBRLygW5zFmXyk5A-xQ@mail.gmail.com&gt;
Tested-by: Shaohua Li &lt;shaohua.li@intel.com&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>block: simplify ioc_release_fn()</title>
<updated>2012-02-15T08:45:52Z</updated>
<author>
<name>Tejun Heo</name>
<email>tj@kernel.org</email>
</author>
<published>2012-02-15T08:45:52Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=2274b029f640cd652ab59c363e5beebf5f50e609'/>
<id>urn:sha1:2274b029f640cd652ab59c363e5beebf5f50e609</id>
<content type='text'>
Reverse double lock dancing in ioc_release_fn() can be simplified by
just using trylock on the queue_lock and back out from ioc lock on
trylock failure.  Simplify it.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Tested-by: Shaohua Li &lt;shaohua.li@intel.com&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>block: replace icq-&gt;changed with icq-&gt;flags</title>
<updated>2012-02-15T08:45:49Z</updated>
<author>
<name>Tejun Heo</name>
<email>tj@kernel.org</email>
</author>
<published>2012-02-15T08:45:49Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=d705ae6b133f9f6a8beee617b1224b6a5c99c5da'/>
<id>urn:sha1:d705ae6b133f9f6a8beee617b1224b6a5c99c5da</id>
<content type='text'>
icq-&gt;changed was used for ICQ_*_CHANGED bits.  Rename it to flags and
access it under ioc-&gt;lock instead of using atomic bitops.
ioc_get_changed() is added so that the changed part can be fetched and
cleared as before.

icq-&gt;flags will be used to carry other flags.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Tested-by: Shaohua Li &lt;shaohua.li@intel.com&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>block: fix lockdep warning on io_context release put_io_context()</title>
<updated>2012-02-11T11:37:25Z</updated>
<author>
<name>Tejun Heo</name>
<email>tj@kernel.org</email>
</author>
<published>2012-02-11T11:37:25Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=d8c66c5d59247e25a69428aced0b79d33b9c66d6'/>
<id>urn:sha1:d8c66c5d59247e25a69428aced0b79d33b9c66d6</id>
<content type='text'>
11a3122f6c "block: strip out locking optimization in put_io_context()"
removed ioc_lock depth lockdep annoation along with locking
optimization; however, while recursing from put_io_context() is no
longer possible, ioc_release_fn() may still end up putting the last
reference of another ioc through elevator, which wlil grab ioc-&gt;lock
triggering spurious (as the ioc is always different one) A-A deadlock
warning.

As this can only happen one time from ioc_release_fn(), using non-zero
subclass from ioc_release_fn() is enough.  Use subclass 1.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
</feed>
