From: "J. Bruce Fields" <bfields@fieldses.org>
To: Filipe Brandenburger <filbranden@gmail.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>,
Matthew Wilcox <matthew@wil.cx>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCHv3] locks: prevent side-effects of locks_release_private before file_lock is initialized
Date: Sun, 29 Jul 2012 11:56:42 -0400 [thread overview]
Message-ID: <20120729155642.GJ6388@fieldses.org> (raw)
In-Reply-To: <20120727204552.GA6388@fieldses.org>
On Fri, Jul 27, 2012 at 04:45:52PM -0400, J. Bruce Fields wrote:
> On Fri, Jul 27, 2012 at 12:42:52AM -0400, Filipe Brandenburger wrote:
> > When calling fcntl(fd, F_SETLEASE, lck) [with lck=F_WRLCK or F_RDLCK],
> > the custom signal or owner (if any were previously set using F_SETSIG
> > or F_SETOWN fcntls) would be reset when F_SETLEASE was called for the
> > second time on the same file descriptor.
> >
> > This bug is a regression of 2.6.37 and is described here:
> > https://bugzilla.kernel.org/show_bug.cgi?id=43336
> >
> > This patch reverts a commit from Oct 2004 (with subject "nfs4 lease:
> > move the f_delown processing") which originally introduced the
> > lm_release_private callback.
>
> Looks fine, thanks. I think can also do something like the following
> (on top of your patch).
(Committing this as well.)--b.
>
> --b.
>
> commit 96d6d59ceaeaacba4088862f3c57fcd011f52832
> Author: J. Bruce Fields <bfields@redhat.com>
> Date: Fri Jul 27 16:18:00 2012 -0400
>
> locks: move lease-specific code out of locks_delete_lock
>
> No point putting something only used by one caller into common code.
>
> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
>
> diff --git a/fs/locks.c b/fs/locks.c
> index 86668dd..541075a 100644
> --- a/fs/locks.c
> +++ b/fs/locks.c
> @@ -570,12 +570,6 @@ static void locks_delete_lock(struct file_lock **thisfl_p)
> fl->fl_next = NULL;
> list_del_init(&fl->fl_link);
>
> - fasync_helper(0, fl->fl_file, 0, &fl->fl_fasync);
> - if (fl->fl_fasync != NULL) {
> - printk(KERN_ERR "locks_delete_lock: fasync == %p\n", fl->fl_fasync);
> - fl->fl_fasync = NULL;
> - }
> -
> if (fl->fl_nspid) {
> put_pid(fl->fl_nspid);
> fl->fl_nspid = NULL;
> @@ -1150,6 +1144,11 @@ int lease_modify(struct file_lock **before, int arg)
>
> f_delown(filp);
> filp->f_owner.signum = 0;
> + fasync_helper(0, fl->fl_file, 0, &fl->fl_fasync);
> + if (fl->fl_fasync != NULL) {
> + printk(KERN_ERR "locks_delete_lock: fasync == %p\n", fl->fl_fasync);
> + fl->fl_fasync = NULL;
> + }
> locks_delete_lock(before);
> }
> return 0;
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
prev parent reply other threads:[~2012-07-29 15:56 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-16 3:06 [PATCH 0/1] " Filipe Brandenburger
2012-06-16 3:06 ` [PATCH 1/1] " Filipe Brandenburger
2012-06-18 20:01 ` J. Bruce Fields
2012-06-20 2:39 ` Filipe Brandenburger
2012-06-26 0:29 ` J. Bruce Fields
2012-06-26 0:48 ` Filipe Brandenburger
2012-06-26 2:10 ` Filipe Brandenburger
2012-06-26 15:23 ` J. Bruce Fields
2012-06-27 1:50 ` [PATCH v2 " Filipe Brandenburger
2012-07-05 22:42 ` J. Bruce Fields
2012-07-07 19:04 ` J. Bruce Fields
2012-07-27 4:42 ` [PATCHv3] " Filipe Brandenburger
2012-07-27 20:45 ` J. Bruce Fields
2012-07-29 15:56 ` J. Bruce Fields [this message]
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=20120729155642.GJ6388@fieldses.org \
--to=bfields@fieldses.org \
--cc=filbranden@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=matthew@wil.cx \
--cc=viro@zeniv.linux.org.uk \
/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
Powered by JetHome