All of lore.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: santosh nayak <santoshprasadnayak@gmail.com>
Cc: linux-fsdevel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] vfs: Release semaphore before returning in lock_mount().
Date: Sun, 24 Jun 2012 09:37:53 +0000	[thread overview]
Message-ID: <20120624093753.GQ14083@ZenIV.linux.org.uk> (raw)
In-Reply-To: <1340529515-23436-1-git-send-email-santoshprasadnayak@gmail.com>

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.

WARNING: multiple messages have this Message-ID (diff)
From: Al Viro <viro@ZenIV.linux.org.uk>
To: santosh nayak <santoshprasadnayak@gmail.com>
Cc: linux-fsdevel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] vfs: Release semaphore before returning in lock_mount().
Date: Sun, 24 Jun 2012 10:37:53 +0100	[thread overview]
Message-ID: <20120624093753.GQ14083@ZenIV.linux.org.uk> (raw)
In-Reply-To: <1340529515-23436-1-git-send-email-santoshprasadnayak@gmail.com>

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.

  reply	other threads:[~2012-06-24  9:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-24  9:18 [PATCH] vfs: Release semaphore before returning in lock_mount() santosh nayak
2012-06-24  9:30 ` santosh nayak
2012-06-24  9:37 ` Al Viro [this message]
2012-06-24  9:37   ` Al Viro

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120624093753.GQ14083@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=santoshprasadnayak@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.