* [PATCH 1/2] Fix mnt_count typo
@ 2010-05-13 0:45 john stultz
2010-05-13 0:52 ` [PATCH 2/2] Resolve mntput_no_expire issues john stultz
0 siblings, 1 reply; 2+ messages in thread
From: john stultz @ 2010-05-13 0:45 UTC (permalink / raw)
To: Thomas Gleixner, linux-rt-users; +Cc: Clark Williams, Darren Hart
Clark noticed the following snippit in commit
070976b5b038218900648ea4cc88786d5dfcd58d :
if (mnt->mnt_pinned) {
- inc_mnt_count(mnt);
+ preempt_disable();
+ dec_mnt_count(mnt);
+ preempt_enable();
mnt->mnt_pinned--;
}
vfsmount_write_unlock();
I accidentally replaced an inc_mnt_count() with a dec_mnt_count().
The issue went unnoticed, as the only user of mnt_unpin in the acct
syscall.
This patch corrects the mistake.
Signed-off-by: John Stultz <johnstul@us.ibm.com>
diff --git a/fs/namespace.c b/fs/namespace.c
index 35c56c2..ed4a3ea 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -825,7 +825,7 @@ void mnt_unpin(struct vfsmount *mnt)
vfsmount_write_lock();
if (mnt->mnt_pinned) {
preempt_disable();
- dec_mnt_count(mnt);
+ inc_mnt_count(mnt);
preempt_enable();
mnt->mnt_pinned--;
}
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH 2/2] Resolve mntput_no_expire issues.
2010-05-13 0:45 [PATCH 1/2] Fix mnt_count typo john stultz
@ 2010-05-13 0:52 ` john stultz
0 siblings, 0 replies; 2+ messages in thread
From: john stultz @ 2010-05-13 0:52 UTC (permalink / raw)
To: Thomas Gleixner; +Cc: linux-rt-users, Clark Williams, Darren Hart, Nick Piggin
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>
diff --git a/fs/namespace.c b/fs/namespace.c
index 35c56c2..d8dcabb 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);
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-05-13 0:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-13 0:45 [PATCH 1/2] Fix mnt_count typo john stultz
2010-05-13 0:52 ` [PATCH 2/2] Resolve mntput_no_expire issues john stultz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).