aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2006-04-20 05:43:23 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-04-20 10:54:04 -0400
commit5dc5cf7dd2723430b6df3d91c5b22af49e063622 (patch)
treef0c3575c153a82173e030fbd5a3538b10ece4903 /drivers
parent72b38d436e4cd18185de11f4b48a6e62eb104644 (diff)
[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: Ingo Molnar <mingo@elte.hu> Acked-by: Neil Brown <neilb@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/md/md.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 434ca39d19c1..d7316b829a62 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -279,11 +279,6 @@ static inline int mddev_lock(mddev_t * mddev)
279 return mutex_lock_interruptible(&mddev->reconfig_mutex); 279 return mutex_lock_interruptible(&mddev->reconfig_mutex);
280} 280}
281 281
282static inline void mddev_lock_uninterruptible(mddev_t * mddev)
283{
284 mutex_lock(&mddev->reconfig_mutex);
285}
286
287static inline int mddev_trylock(mddev_t * mddev) 282static inline int mddev_trylock(mddev_t * mddev)
288{ 283{
289 return mutex_trylock(&mddev->reconfig_mutex); 284 return mutex_trylock(&mddev->reconfig_mutex);
@@ -2458,9 +2453,11 @@ md_attr_show(struct kobject *kobj, struct attribute *attr, char *page)
2458 2453
2459 if (!entry->show) 2454 if (!entry->show)
2460 return -EIO; 2455 return -EIO;
2461 mddev_lock(mddev); 2456 rv = mddev_lock(mddev);
2462 rv = entry->show(mddev, page); 2457 if (!rv) {
2463 mddev_unlock(mddev); 2458 rv = entry->show(mddev, page);
2459 mddev_unlock(mddev);
2460 }
2464 return rv; 2461 return rv;
2465} 2462}
2466 2463
@@ -2474,9 +2471,11 @@ md_attr_store(struct kobject *kobj, struct attribute *attr,
2474 2471
2475 if (!entry->store) 2472 if (!entry->store)
2476 return -EIO; 2473 return -EIO;
2477 mddev_lock(mddev); 2474 rv = mddev_lock(mddev);
2478 rv = entry->store(mddev, page, length); 2475 if (!rv) {
2479 mddev_unlock(mddev); 2476 rv = entry->store(mddev, page, length);
2477 mddev_unlock(mddev);
2478 }
2480 return rv; 2479 return rv;
2481} 2480}
2482 2481
@@ -4341,8 +4340,9 @@ static int md_seq_show(struct seq_file *seq, void *v)
4341 return 0; 4340 return 0;
4342 } 4341 }
4343 4342
4344 if (mddev_lock(mddev)!=0) 4343 if (mddev_lock(mddev) < 0)
4345 return -EINTR; 4344 return -EINTR;
4345
4346 if (mddev->pers || mddev->raid_disks || !list_empty(&mddev->disks)) { 4346 if (mddev->pers || mddev->raid_disks || !list_empty(&mddev->disks)) {
4347 seq_printf(seq, "%s : %sactive", mdname(mddev), 4347 seq_printf(seq, "%s : %sactive", mdname(mddev),
4348 mddev->pers ? "" : "in"); 4348 mddev->pers ? "" : "in");