From: Pavel Emelyanov <xemul@openvz.org>
To: "J. Bruce Fields" <bfields@fieldses.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
devel@openvz.org
Subject: Re: [PATCH] Wake up mandatory locks waiter on chmod
Date: Mon, 17 Sep 2007 10:37:56 +0400 [thread overview]
Message-ID: <46EE20C4.1060405@openvz.org> (raw)
In-Reply-To: <20070916194135.GC31801@fieldses.org>
J. Bruce Fields wrote:
> On Thu, Sep 13, 2007 at 06:30:43PM +0400, Pavel Emelyanov wrote:
>> When the process is blocked on mandatory lock and someone changes
>> the inode's permissions, so that the lock is no longer mandatory,
>> nobody wakes up the blocked process, but probably should.
>
> I suppose so. Does anyone actually use mandatory locking?
:) Good question.
> Would it be worth adding a
>
> if (MANDATORY_LOCK(inode))
> return;
>
> to the beginning of locks_wakeup_mandatory() to avoid walking the list
> of locks in that case? Perhaps setattr is rare enough that this just
> isn't worth caring about.
>
> Is there a small chance that a lock may be applied after this check:
>
>> + mandatory = (inode->i_flock && MANDATORY_LOCK(inode));
>> +
>
> but early enough that someone can still block on the lock while the file
> is still marked for mandatory locking? (And is the inode->i_flock check
> there really necessary?)
There is, but as you have noticed:
> Well, there are probably worse races in the mandatory locking code.
...there are. The inode->i_lock is protected with lock_kernel() only
and is not in sync with any other checks for inodes. This is sad :(
but a good locking for locks is to be done...
> (For example, my impression is that a mandatory lock can be applied just
> after the locks_mandatory_area() checks but before the io actually
> completes.)
>
> --b.
Thanks,
Pavel
next prev parent reply other threads:[~2007-09-17 6:40 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-13 14:30 [PATCH] Wake up mandatory locks waiter on chmod Pavel Emelyanov
2007-09-16 19:41 ` J. Bruce Fields
2007-09-17 6:37 ` Pavel Emelyanov [this message]
2007-09-17 14:59 ` J. Bruce Fields
2007-09-18 6:36 ` Pavel Emelyanov
2007-09-19 18:07 ` J. Bruce Fields
2007-09-19 18:16 ` Trond Myklebust
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=46EE20C4.1060405@openvz.org \
--to=xemul@openvz.org \
--cc=bfields@fieldses.org \
--cc=devel@openvz.org \
--cc=linux-kernel@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox