diff options
author | john stultz <johnstul@us.ibm.com> | 2010-05-12 17:52:14 -0700 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2010-05-13 14:05:54 +0200 |
commit | d6434af22679ec15d7779f3f41a5d3aebbb704e3 (patch) | |
tree | cdca7945b1c1780a13542809c5d74ec144ae2ea5 /fs | |
parent | 56e4c7f24a6c08f2cce086f14ca5bf1772bb6d6f (diff) | |
download | lwn-d6434af22679ec15d7779f3f41a5d3aebbb704e3.tar.gz lwn-d6434af22679ec15d7779f3f41a5d3aebbb704e3.zip |
fs: Resolve mntput_no_expire issues.
In testing the mnt_count typo fix, I hit a few BUG_ON/WARN_ON messages
in the mntput_no_expire code.
The first issue was a race against the MNT_MOUNTED flag, where if after
the optimistic lock free check is done, someone changes the value, we
might BUG_ON after getting the lock. The fix is after getting the lock,
re-check the MNT_MOUNTED bit and drop the lock and try again if its
changed.
The second issue was a call to smp_processor_id() in add_mnt_count()
that was done while preemptable. This was missed in my earlier commit
070976b5b038218900648ea4cc88786d5dfcd58d.
Signed-off-by: John Stultz <johnstul@us.ibm.com>
Cc: Clark Williams <williams@redhat.com>
Cc: Darren Hart <dvhltc@us.ibm.com>
Cc: Nick Piggin <npiggin@suse.de>
LKML-Reference: <1273711934.2856.22.camel@localhost.localdomain>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/namespace.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/fs/namespace.c b/fs/namespace.c index ed4a3eaac48d..4e9a3de3319c 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -752,6 +752,7 @@ void mntput_no_expire(struct vfsmount *mnt) { int cpu = get_cpu(); put_cpu(); +repeat: if (likely(mnt->mnt_flags & MNT_MOUNTED)) { vfsmount_read_lock(cpu); if (unlikely(!(mnt->mnt_flags & MNT_MOUNTED))) { @@ -766,9 +767,11 @@ void mntput_no_expire(struct vfsmount *mnt) return; } -repeat: vfsmount_write_lock(); - BUG_ON(mnt->mnt_flags & MNT_MOUNTED); + if (unlikely((mnt->mnt_flags & MNT_MOUNTED))) { + vfsmount_write_unlock(); + goto repeat; + } preempt_disable(); dec_mnt_count(mnt); preempt_enable(); @@ -781,7 +784,9 @@ repeat: __mntput(mnt); return; } + preempt_disable(); add_mnt_count(mnt, mnt->mnt_pinned + 1); + preempt_enable(); mnt->mnt_pinned = 0; vfsmount_write_unlock(); acct_auto_close_mnt(mnt); |