summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2008-02-06 12:39:55 +0300
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-06 21:41:18 +0300
commitca38805945edf5d1f5444b283eed95bb954772e8 (patch)
tree9e31b58f8124c0ef5d6803c693c00f5b8f71dd24 /drivers
parentc5d79adba7ced41d7ac097c2ab74759d10522dd5 (diff)
downloadlinux-ca38805945edf5d1f5444b283eed95bb954772e8.tar.xz
md: lock address when changing attributes of component devices
Signed-off-by: Neil Brown <neilb@suse.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/md/md.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 7c9a87b02e77..39757566f39b 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -2075,12 +2075,18 @@ rdev_attr_store(struct kobject *kobj, struct attribute *attr,
{
struct rdev_sysfs_entry *entry = container_of(attr, struct rdev_sysfs_entry, attr);
mdk_rdev_t *rdev = container_of(kobj, mdk_rdev_t, kobj);
+ int rv;
if (!entry->store)
return -EIO;
if (!capable(CAP_SYS_ADMIN))
return -EACCES;
- return entry->store(rdev, page, length);
+ rv = mddev_lock(rdev->mddev);
+ if (!rv) {
+ rv = entry->store(rdev, page, length);
+ mddev_unlock(rdev->mddev);
+ }
+ return rv;
}
static void rdev_free(struct kobject *ko)