diff options
Diffstat (limited to 'fs/namespace.c')
-rw-r--r-- | fs/namespace.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/fs/namespace.c b/fs/namespace.c index cfc6d4448aa5..311264b1002d 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -31,6 +31,7 @@ #include <linux/idr.h> #include <linux/fs_struct.h> #include <linux/fsnotify.h> +#include <linux/delay.h> #include <asm/uaccess.h> #include <asm/unistd.h> #include "pnode.h" @@ -341,8 +342,14 @@ int mnt_want_write(struct vfsmount *mnt) * incremented count after it has set MNT_WRITE_HOLD. */ smp_mb(); - while (mnt->mnt_flags & MNT_WRITE_HOLD) - cpu_relax(); + /* + * No need to keep preemption disabled accross the spin loop. + */ + while (mnt->mnt_flags & MNT_WRITE_HOLD) { + preempt_enable(); + cpu_chill(); + preempt_disable(); + } /* * After the slowpath clears MNT_WRITE_HOLD, mnt_is_readonly will * be set to match its requirements. So we must not load that until @@ -352,9 +359,7 @@ int mnt_want_write(struct vfsmount *mnt) if (__mnt_is_readonly(mnt)) { mnt_dec_writers(mnt); ret = -EROFS; - goto out; } -out: preempt_enable(); return ret; } |