]> git.baikalelectronics.ru Git - kernel.git/commit
md: Fix - again - partition detection when array becomes active
authorNeilBrown <neilb@suse.de>
Thu, 24 Feb 2011 06:26:41 +0000 (17:26 +1100)
committerNeilBrown <neilb@suse.de>
Thu, 24 Feb 2011 06:26:41 +0000 (17:26 +1100)
commitd91fda4f8a7f4a85d4248bc30216bfc12be3823d
treedfc2aa18bbf8411a499ef8117a5e15490eb44728
parent8c1e14e8db06bdf02e997b95aaa57d7ef28ec961
md: Fix - again - partition detection when array becomes active

Revert
    f725021142a918325188c54f7f555eb324bbcb37
and
    c96750d94e6770981017b7ab5ae4546b87c593d5

When I wrote the first of these I had a wrong idea about the
lifetime of 'struct block_device'.  It can disappear at any time that
the block device is not open if it falls out of the inode cache.

So relying on the 'size' recorded with it to detect when the
device size has changed and so we need to revalidate, is wrong.

Rather, we really do need the 'changed' attribute stored directly in
the mddev and set/tested as appropriate.

Without this patch, a sequence of:
   mknod / open / close / unlink

(which can cause a block_device to be created and then destroyed)
will result in a rescan of the partition table and consequence removal
and addition of partitions.
Several of these in a row can get udev racing to create and unlink and
other code can get confused.

With the patch, the rescan is only performed when needed and so there
are no races.

This is suitable for any stable kernel from 2.6.35.

Reported-by: "Wojcik, Krzysztof" <krzysztof.wojcik@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Cc: stable@kernel.org
drivers/md/md.c
drivers/md/md.h