diff options
author | NeilBrown <neilb@suse.de> | 2011-02-24 17:26:41 +1100 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2011-02-24 17:26:41 +1100 |
commit | f0b4f7e2f29af678bd9af43422c537dcb6008603 (patch) | |
tree | dfc2aa18bbf8411a499ef8117a5e15490eb44728 /drivers/md/md.h | |
parent | 93b270f76e7ef3b81001576860c2701931cdc78b (diff) | |
download | op-kernel-dev-f0b4f7e2f29af678bd9af43422c537dcb6008603.zip op-kernel-dev-f0b4f7e2f29af678bd9af43422c537dcb6008603.tar.gz |
md: Fix - again - partition detection when array becomes active
Revert
b821eaa572fd737faaf6928ba046e571526c36c6
and
f3b99be19ded511a1bf05a148276239d9f13eefa
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
Diffstat (limited to 'drivers/md/md.h')
-rw-r--r-- | drivers/md/md.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/md/md.h b/drivers/md/md.h index 7e90b85..12215d4 100644 --- a/drivers/md/md.h +++ b/drivers/md/md.h @@ -274,6 +274,8 @@ struct mddev_s atomic_t active; /* general refcount */ atomic_t openers; /* number of active opens */ + int changed; /* True if we might need to + * reread partition info */ int degraded; /* whether md should consider * adding a spare */ |