提交 df5b89b3 编写于 作者: N NeilBrown 提交者: Linus Torvalds

[PATCH] md: Convert reconfig_sem to reconfig_mutex

... being careful that mutex_trylock is inverted wrt down_trylock
Signed-off-by: NNeil Brown <neilb@suse.de>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 48c9c27b
...@@ -255,7 +255,7 @@ static mddev_t * mddev_find(dev_t unit) ...@@ -255,7 +255,7 @@ static mddev_t * mddev_find(dev_t unit)
else else
new->md_minor = MINOR(unit) >> MdpMinorShift; new->md_minor = MINOR(unit) >> MdpMinorShift;
init_MUTEX(&new->reconfig_sem); mutex_init(&new->reconfig_mutex);
INIT_LIST_HEAD(&new->disks); INIT_LIST_HEAD(&new->disks);
INIT_LIST_HEAD(&new->all_mddevs); INIT_LIST_HEAD(&new->all_mddevs);
init_timer(&new->safemode_timer); init_timer(&new->safemode_timer);
...@@ -277,22 +277,22 @@ static mddev_t * mddev_find(dev_t unit) ...@@ -277,22 +277,22 @@ static mddev_t * mddev_find(dev_t unit)
static inline int mddev_lock(mddev_t * mddev) static inline int mddev_lock(mddev_t * mddev)
{ {
return down_interruptible(&mddev->reconfig_sem); return mutex_lock_interruptible(&mddev->reconfig_mutex);
} }
static inline void mddev_lock_uninterruptible(mddev_t * mddev) static inline void mddev_lock_uninterruptible(mddev_t * mddev)
{ {
down(&mddev->reconfig_sem); mutex_lock(&mddev->reconfig_mutex);
} }
static inline int mddev_trylock(mddev_t * mddev) static inline int mddev_trylock(mddev_t * mddev)
{ {
return down_trylock(&mddev->reconfig_sem); return mutex_trylock(&mddev->reconfig_mutex);
} }
static inline void mddev_unlock(mddev_t * mddev) static inline void mddev_unlock(mddev_t * mddev)
{ {
up(&mddev->reconfig_sem); mutex_unlock(&mddev->reconfig_mutex);
md_wakeup_thread(mddev->thread); md_wakeup_thread(mddev->thread);
} }
...@@ -4893,7 +4893,7 @@ void md_check_recovery(mddev_t *mddev) ...@@ -4893,7 +4893,7 @@ void md_check_recovery(mddev_t *mddev)
)) ))
return; return;
if (mddev_trylock(mddev)==0) { if (mddev_trylock(mddev)) {
int spares =0; int spares =0;
spin_lock_irq(&mddev->write_lock); spin_lock_irq(&mddev->write_lock);
...@@ -5029,7 +5029,7 @@ static int md_notify_reboot(struct notifier_block *this, ...@@ -5029,7 +5029,7 @@ static int md_notify_reboot(struct notifier_block *this,
printk(KERN_INFO "md: stopping all md devices.\n"); printk(KERN_INFO "md: stopping all md devices.\n");
ITERATE_MDDEV(mddev,tmp) ITERATE_MDDEV(mddev,tmp)
if (mddev_trylock(mddev)==0) if (mddev_trylock(mddev))
do_md_stop (mddev, 1); do_md_stop (mddev, 1);
/* /*
* certain more exotic SCSI devices are known to be * certain more exotic SCSI devices are known to be
......
...@@ -185,7 +185,7 @@ struct mddev_s ...@@ -185,7 +185,7 @@ struct mddev_s
unsigned long recovery; unsigned long recovery;
int in_sync; /* know to not need resync */ int in_sync; /* know to not need resync */
struct semaphore reconfig_sem; struct mutex reconfig_mutex;
atomic_t active; atomic_t active;
int changed; /* true if we might need to reread partition info */ int changed; /* true if we might need to reread partition info */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册