aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2006-03-27 04:18:20 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-27 11:45:03 -0500
commitdf5b89b323b922f56650b4b4d7c41899b937cf19 (patch)
treed1578782a9d763174474fe2db08f4ce4c6dc6218
parent48c9c27b8bcd2a328a06151e2d5c1170db0b701b (diff)
[PATCH] md: Convert reconfig_sem to reconfig_mutex
... being careful that mutex_trylock is inverted wrt down_trylock Signed-off-by: Neil Brown <neilb@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--drivers/md/md.c14
-rw-r--r--include/linux/raid/md_k.h2
2 files changed, 8 insertions, 8 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index c9c9c096ad80..039e071c1007 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -255,7 +255,7 @@ static mddev_t * mddev_find(dev_t unit)
255 else 255 else
256 new->md_minor = MINOR(unit) >> MdpMinorShift; 256 new->md_minor = MINOR(unit) >> MdpMinorShift;
257 257
258 init_MUTEX(&new->reconfig_sem); 258 mutex_init(&new->reconfig_mutex);
259 INIT_LIST_HEAD(&new->disks); 259 INIT_LIST_HEAD(&new->disks);
260 INIT_LIST_HEAD(&new->all_mddevs); 260 INIT_LIST_HEAD(&new->all_mddevs);
261 init_timer(&new->safemode_timer); 261 init_timer(&new->safemode_timer);
@@ -277,22 +277,22 @@ static mddev_t * mddev_find(dev_t unit)
277 277
278static inline int mddev_lock(mddev_t * mddev) 278static inline int mddev_lock(mddev_t * mddev)
279{ 279{
280 return down_interruptible(&mddev->reconfig_sem); 280 return mutex_lock_interruptible(&mddev->reconfig_mutex);
281} 281}
282 282
283static inline void mddev_lock_uninterruptible(mddev_t * mddev) 283static inline void mddev_lock_uninterruptible(mddev_t * mddev)
284{ 284{
285 down(&mddev->reconfig_sem); 285 mutex_lock(&mddev->reconfig_mutex);
286} 286}
287 287
288static inline int mddev_trylock(mddev_t * mddev) 288static inline int mddev_trylock(mddev_t * mddev)
289{ 289{
290 return down_trylock(&mddev->reconfig_sem); 290 return mutex_trylock(&mddev->reconfig_mutex);
291} 291}
292 292
293static inline void mddev_unlock(mddev_t * mddev) 293static inline void mddev_unlock(mddev_t * mddev)
294{ 294{
295 up(&mddev->reconfig_sem); 295 mutex_unlock(&mddev->reconfig_mutex);
296 296
297 md_wakeup_thread(mddev->thread); 297 md_wakeup_thread(mddev->thread);
298} 298}
@@ -4893,7 +4893,7 @@ void md_check_recovery(mddev_t *mddev)
4893 )) 4893 ))
4894 return; 4894 return;
4895 4895
4896 if (mddev_trylock(mddev)==0) { 4896 if (mddev_trylock(mddev)) {
4897 int spares =0; 4897 int spares =0;
4898 4898
4899 spin_lock_irq(&mddev->write_lock); 4899 spin_lock_irq(&mddev->write_lock);
@@ -5029,7 +5029,7 @@ static int md_notify_reboot(struct notifier_block *this,
5029 printk(KERN_INFO "md: stopping all md devices.\n"); 5029 printk(KERN_INFO "md: stopping all md devices.\n");
5030 5030
5031 ITERATE_MDDEV(mddev,tmp) 5031 ITERATE_MDDEV(mddev,tmp)
5032 if (mddev_trylock(mddev)==0) 5032 if (mddev_trylock(mddev))
5033 do_md_stop (mddev, 1); 5033 do_md_stop (mddev, 1);
5034 /* 5034 /*
5035 * certain more exotic SCSI devices are known to be 5035 * certain more exotic SCSI devices are known to be
diff --git a/include/linux/raid/md_k.h b/include/linux/raid/md_k.h
index c0d3097846a7..e2df61f5b09a 100644
--- a/include/linux/raid/md_k.h
+++ b/include/linux/raid/md_k.h
@@ -185,7 +185,7 @@ struct mddev_s
185 unsigned long recovery; 185 unsigned long recovery;
186 186
187 int in_sync; /* know to not need resync */ 187 int in_sync; /* know to not need resync */
188 struct semaphore reconfig_sem; 188 struct mutex reconfig_mutex;
189 atomic_t active; 189 atomic_t active;
190 190
191 int changed; /* true if we might need to reread partition info */ 191 int changed; /* true if we might need to reread partition info */