* [PATCH] vfs: Release semaphore before returning in lock_mount().
@ 2012-06-24 9:18 santosh nayak
2012-06-24 9:37 ` Al Viro
0 siblings, 1 reply; 2+ messages in thread
From: santosh nayak @ 2012-06-24 9:18 UTC (permalink / raw)
To: viro; +Cc: linux-fsdevel, kernel-janitors, Santosh Nayak
From: Santosh Nayak <santoshprasadnayak@gmail.com>
There is a missing "up_write()" here. Semaphore should be released
before returning.
Signed-off-by: Santosh Nayak <santoshprasadnayak@gmail.com>
---
Destination tree "linux-next"
fs/namespace.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/fs/namespace.c b/fs/namespace.c
index 8f412ab..d5173df 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -1473,8 +1473,10 @@ retry:
}
down_write(&namespace_sem);
mnt = lookup_mnt(path);
- if (likely(!mnt))
+ if (likely(!mnt)) {
+ up_write(&namespace_sem);
return 0;
+ }
up_write(&namespace_sem);
mutex_unlock(&path->dentry->d_inode->i_mutex);
path_put(path);
--
1.7.4.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] vfs: Release semaphore before returning in lock_mount().
2012-06-24 9:18 [PATCH] vfs: Release semaphore before returning in lock_mount() santosh nayak
@ 2012-06-24 9:37 ` Al Viro
0 siblings, 0 replies; 2+ messages in thread
From: Al Viro @ 2012-06-24 9:37 UTC (permalink / raw)
To: santosh nayak; +Cc: linux-fsdevel, kernel-janitors
On Sun, Jun 24, 2012 at 02:48:35PM +0530, santosh nayak wrote:
> From: Santosh Nayak <santoshprasadnayak@gmail.com>
>
> There is a missing "up_write()" here. Semaphore should be released
> before returning.
Even in a function called lock_<something> with the main effect being
to grab that semaphore (and a mutex, while we are at it)? ;-)
The whole point of lock_mount() is to get us the situation when
1) path->{mnt,dentry} isn't overmounted by anything
2) path->dentry is known to be alive
3) we are guaranteed that these conditions will hold until
we do unlock_mount().
(1) is preserved by ->i_mutex; (2) - by namespace_sem. Retry loop in
there is for handling the case when someone has raced with us and
mounted something on top of path after we'd looked it up and before
we got namespace_sem. unlock_mount() right next to it drops both
->i_mutex and namespace_sem; these two are paired in all callers
(easily verified, since they are static in file; only 4 callers
of each in there), so we are OK.
IOW, NAK.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-06-24 9:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-24 9:18 [PATCH] vfs: Release semaphore before returning in lock_mount() santosh nayak
2012-06-24 9:37 ` Al Viro
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).