<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/fs/partitions/check.c, branch linux-3.2.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-3.2.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-3.2.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2017-09-15T17:30:47Z</updated>
<entry>
<title>block: fix an error code in add_partition()</title>
<updated>2017-09-15T17:30:47Z</updated>
<author>
<name>Dan Carpenter</name>
</author>
<published>2017-05-23T14:28:36Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=93bfaf316fd00c28c94a04ca9ecade0b4f5c73c2'/>
<id>urn:sha1:93bfaf316fd00c28c94a04ca9ecade0b4f5c73c2</id>
<content type='text'>
commit 7bd897cfce1eb373892d35d7f73201b0f9b221c4 upstream.

We don't set an error code on this path.  It means that we return NULL
instead of an error pointer and the caller does a NULL dereference.

Fixes: 6d1d8050b4bc ("block, partition: add partition_meta_info to hd_struct")
Signed-off-by: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Signed-off-by: Jens Axboe &lt;axboe@fb.com&gt;
[bwh: Backported to 3.2: adjust filename]
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
<entry>
<title>block: Fix dev_t minor allocation lifetime</title>
<updated>2014-11-05T20:27:40Z</updated>
<author>
<name>Keith Busch</name>
</author>
<published>2014-08-26T15:05:36Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a288cafeceb6e18ba4fd10ec8d3270593472cca6'/>
<id>urn:sha1:a288cafeceb6e18ba4fd10ec8d3270593472cca6</id>
<content type='text'>
commit 2da78092dda13f1efd26edbbf99a567776913750 upstream.

Releases the dev_t minor when all references are closed to prevent
another device from acquiring the same major/minor.

Since the partition's release may be invoked from call_rcu's soft-irq
context, the ext_dev_idr's mutex had to be replaced with a spinlock so
as not so sleep.

Signed-off-by: Keith Busch &lt;keith.busch@intel.com&gt;
Signed-off-by: Jens Axboe &lt;axboe@fb.com&gt;
[bwh: Backported to 3.2:
 - Adjust filename
 - idr insertion API is different, and blk_alloc_devt() is preallocating
   a node in a different way]
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
<entry>
<title>block: fix ext_devt_idr handling</title>
<updated>2013-03-06T03:24:15Z</updated>
<author>
<name>Tomas Henzl</name>
</author>
<published>2013-02-28T01:03:32Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=2abb7d3a3cf05900a6d9cc6b98b1ba3aa432ce30'/>
<id>urn:sha1:2abb7d3a3cf05900a6d9cc6b98b1ba3aa432ce30</id>
<content type='text'>
commit 7b74e912785a11572da43292786ed07ada7e3e0c upstream.

While adding and removing a lot of disks disks and partitions this
sometimes shows up:

  WARNING: at fs/sysfs/dir.c:512 sysfs_add_one+0xc9/0x130() (Not tainted)
  Hardware name:
  sysfs: cannot create duplicate filename '/dev/block/259:751'
  Modules linked in: raid1 autofs4 bnx2fc cnic uio fcoe libfcoe libfc 8021q scsi_transport_fc scsi_tgt garp stp llc sunrpc cpufreq_ondemand powernow_k8 freq_table mperf ipv6 dm_mirror dm_region_hash dm_log power_meter microcode dcdbas serio_raw amd64_edac_mod edac_core edac_mce_amd i2c_piix4 i2c_core k10temp bnx2 sg ixgbe dca mdio ext4 mbcache jbd2 dm_round_robin sr_mod cdrom sd_mod crc_t10dif ata_generic pata_acpi pata_atiixp ahci mptsas mptscsih mptbase scsi_transport_sas dm_multipath dm_mod [last unloaded: scsi_wait_scan]
  Pid: 44103, comm: async/16 Not tainted 2.6.32-195.el6.x86_64 #1
  Call Trace:
    warn_slowpath_common+0x87/0xc0
    warn_slowpath_fmt+0x46/0x50
    sysfs_add_one+0xc9/0x130
    sysfs_do_create_link+0x12b/0x170
    sysfs_create_link+0x13/0x20
    device_add+0x317/0x650
    idr_get_new+0x13/0x50
    add_partition+0x21c/0x390
    rescan_partitions+0x32b/0x470
    sd_open+0x81/0x1f0 [sd_mod]
    __blkdev_get+0x1b6/0x3c0
    blkdev_get+0x10/0x20
    register_disk+0x155/0x170
    add_disk+0xa6/0x160
    sd_probe_async+0x13b/0x210 [sd_mod]
    add_wait_queue+0x46/0x60
    async_thread+0x102/0x250
    default_wake_function+0x0/0x20
    async_thread+0x0/0x250
    kthread+0x96/0xa0
    child_rip+0xa/0x20
    kthread+0x0/0xa0
    child_rip+0x0/0x20

This most likely happens because dev_t is freed while the number is
still used and idr_get_new() is not protected on every use.  The fix
adds a mutex where it wasn't before and moves the dev_t free function so
it is called after device del.

Signed-off-by: Tomas Henzl &lt;thenzl@redhat.com&gt;
Cc: Jens Axboe &lt;axboe@kernel.dk&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
[bwh: Backported to 3.2: adjust filename]
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
<entry>
<title>block: Fix NULL pointer dereference in sd_revalidate_disk</title>
<updated>2012-03-19T16:02:34Z</updated>
<author>
<name>Jun'ichi Nomura</name>
</author>
<published>2012-03-02T09:38:33Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=195b1c3447ea79c7e453aaf62b6e7df49fdba8f8'/>
<id>urn:sha1:195b1c3447ea79c7e453aaf62b6e7df49fdba8f8</id>
<content type='text'>
commit fe316bf2d5847bc5dd975668671a7b1067603bc7 upstream.

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;
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>Merge branch 'for-linus' into for-3.1/core</title>
<updated>2011-07-01T14:17:13Z</updated>
<author>
<name>Jens Axboe</name>
</author>
<published>2011-07-01T14:17:13Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=04bf7869ca0fd12009aee301cac2264a36df4d98'/>
<id>urn:sha1:04bf7869ca0fd12009aee301cac2264a36df4d98</id>
<content type='text'>
Conflicts:
	block/blk-throttle.c
	block/cfq-iosched.c

Signed-off-by: Jens Axboe &lt;jaxboe@fusionio.com&gt;
</content>
</entry>
<entry>
<title>fs/partitions/check.c: make local symbols static</title>
<updated>2011-06-13T09:47:24Z</updated>
<author>
<name>H Hartley Sweeten</name>
</author>
<published>2011-06-13T09:47:24Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=dd7740933842202fccaa9ebcba6bce0507b3f6d6'/>
<id>urn:sha1:dd7740933842202fccaa9ebcba6bce0507b3f6d6</id>
<content type='text'>
The symbols part_ro_show, part_alignment_offset_show, and
part_discard_alignment_show are not used outside this file and
should be marked static.

Signed-off-by: H Hartley Sweeten &lt;hsweeten@visionengravers.com&gt;
Cc: Yasuaki Ishimatsu &lt;isimatu.yasuaki@jp.fujitsu.com&gt;
Cc: Alexey Dobriyan &lt;adobriyan@gmail.com&gt;
Acked-by: Tejun Heo &lt;tj@kernel.org&gt;
Signed-off-by: Jens Axboe &lt;jaxboe@fusionio.com&gt;
</content>
</entry>
<entry>
<title>Revert "block: Remove extra discard_alignment from hd_struct."</title>
<updated>2011-05-30T05:42:51Z</updated>
<author>
<name>Jens Axboe</name>
</author>
<published>2011-05-30T05:42:51Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a1706ac4c0201ea0143dc0db0659001b26ceeabb'/>
<id>urn:sha1:a1706ac4c0201ea0143dc0db0659001b26ceeabb</id>
<content type='text'>
It was not a good idea to start dereferencing disk-&gt;queue from
the fs sysfs strategy for displaying discard alignment. We ran
into first a NULL pointer deref, and after fixing that we sometimes
see unvalid disk-&gt;queue pointer values.

Since discard is the only one of the bunch actually looking into
the queue, just revert the change.

This reverts commit 23ceb5b7719e9276d4fa72a3ecf94dd396755276.

Conflicts:
	fs/partitions/check.c
</content>
</entry>
<entry>
<title>block: fix oops on !disk-&gt;queue and sysfs discard alignment display</title>
<updated>2011-05-26T19:01:38Z</updated>
<author>
<name>Jens Axboe</name>
</author>
<published>2011-05-26T19:01:38Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f4fa3424c66255ba1e07b26becfc3d6cab0fdf65'/>
<id>urn:sha1:f4fa3424c66255ba1e07b26becfc3d6cab0fdf65</id>
<content type='text'>
Eric Dumazet reports:

----

At boot, I have a crash in part_discard_alignment_show+0x1b/0x50

CR2 : 000006ac

fault in : mov    0x2c(%rcx),%edx

I suspect commit 23ceb5b7719e9276d4 (block: Remove extra
discard_alignment from hd_struct) being in fault

----

Not quite known how -&gt;queue can be NULL while the sysfs entry
exists, but lets play it safe and check for a NULL queue.
The rest of the sysfs show strategies in check.c do not dereference
disk-&gt;queue.

Reported-by: Eric Dumazet &lt;eric.dumazet@gmail.com&gt;
Signed-off-by: Jens Axboe &lt;jaxboe@fusionio.com&gt;
</content>
</entry>
<entry>
<title>fs: fixup warning part_discard_alignment_show()</title>
<updated>2011-05-09T06:28:13Z</updated>
<author>
<name>Jens Axboe</name>
</author>
<published>2011-05-09T06:28:13Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=bbdd304cf66fbf2b4b2d28418dc619d443635e83'/>
<id>urn:sha1:bbdd304cf66fbf2b4b2d28418dc619d443635e83</id>
<content type='text'>
Stephen reports:

-----

After merging the block tree, today's linux-next build (x86_64
allmodconfig) produced this warning:

fs/partitions/check.c: In function 'part_discard_alignment_show':
fs/partitions/check.c:263: warning: format '%u' expects type 'unsigned int', but argument 3 has type 'long long unsigned int'

Introduced by commit  ("block: Remove extra discard_alignment from
hd_struct")

-----

Fix it up by just removing the cast, we return an int already.

Reported-by: Stephen Rothwell &lt;sfr@canb.auug.org.au&gt;
Signed-off-by: Jens Axboe &lt;jaxboe@fusionio.com&gt;
</content>
</entry>
<entry>
<title>block: Remove extra discard_alignment from hd_struct.</title>
<updated>2011-05-07T01:30:02Z</updated>
<author>
<name>Tao Ma</name>
</author>
<published>2011-05-07T01:30:02Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=23ceb5b7719e9276d4fa72a3ecf94dd396755276'/>
<id>urn:sha1:23ceb5b7719e9276d4fa72a3ecf94dd396755276</id>
<content type='text'>
Currently, hd_struct.discard_alignment is only used when we
show /sys/block/sdx/sdx/discard_alignment. So remove it and
calculate when it is asked to show.

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