Commit 5dc5cf7d authored by Ingo Molnar's avatar Ingo Molnar Committed by Linus Torvalds

[PATCH] md: locking fix

- fix mddev_lock() usage bugs in md_attr_show() and md_attr_store().
  [they did not anticipate the possibility of getting a signal]

- remove mddev_lock_uninterruptible() [unused]
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Acked-by: default avatarNeil Brown <neilb@suse.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 72b38d43
...@@ -279,11 +279,6 @@ static inline int mddev_lock(mddev_t * mddev) ...@@ -279,11 +279,6 @@ static inline int mddev_lock(mddev_t * mddev)
return mutex_lock_interruptible(&mddev->reconfig_mutex); return mutex_lock_interruptible(&mddev->reconfig_mutex);
} }
static inline void mddev_lock_uninterruptible(mddev_t * mddev)
{
mutex_lock(&mddev->reconfig_mutex);
}
static inline int mddev_trylock(mddev_t * mddev) static inline int mddev_trylock(mddev_t * mddev)
{ {
return mutex_trylock(&mddev->reconfig_mutex); return mutex_trylock(&mddev->reconfig_mutex);
...@@ -2458,9 +2453,11 @@ md_attr_show(struct kobject *kobj, struct attribute *attr, char *page) ...@@ -2458,9 +2453,11 @@ md_attr_show(struct kobject *kobj, struct attribute *attr, char *page)
if (!entry->show) if (!entry->show)
return -EIO; return -EIO;
mddev_lock(mddev); rv = mddev_lock(mddev);
if (!rv) {
rv = entry->show(mddev, page); rv = entry->show(mddev, page);
mddev_unlock(mddev); mddev_unlock(mddev);
}
return rv; return rv;
} }
...@@ -2474,9 +2471,11 @@ md_attr_store(struct kobject *kobj, struct attribute *attr, ...@@ -2474,9 +2471,11 @@ md_attr_store(struct kobject *kobj, struct attribute *attr,
if (!entry->store) if (!entry->store)
return -EIO; return -EIO;
mddev_lock(mddev); rv = mddev_lock(mddev);
if (!rv) {
rv = entry->store(mddev, page, length); rv = entry->store(mddev, page, length);
mddev_unlock(mddev); mddev_unlock(mddev);
}
return rv; return rv;
} }
...@@ -4341,8 +4340,9 @@ static int md_seq_show(struct seq_file *seq, void *v) ...@@ -4341,8 +4340,9 @@ static int md_seq_show(struct seq_file *seq, void *v)
return 0; return 0;
} }
if (mddev_lock(mddev)!=0) if (mddev_lock(mddev) < 0)
return -EINTR; return -EINTR;
if (mddev->pers || mddev->raid_disks || !list_empty(&mddev->disks)) { if (mddev->pers || mddev->raid_disks || !list_empty(&mddev->disks)) {
seq_printf(seq, "%s : %sactive", mdname(mddev), seq_printf(seq, "%s : %sactive", mdname(mddev),
mddev->pers ? "" : "in"); mddev->pers ? "" : "in");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment