From: Christoph Hellwig <hch@lst.de>
To: Trond Myklebust <trond.myklebust@fys.uio.no>
Cc: Christoph Hellwig <hch@lst.de>, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH, RFC] lockd: stop abusing file_lock_list
Date: Thu, 16 Feb 2006 14:57:34 +0100 [thread overview]
Message-ID: <20060216135734.GA3393@lst.de> (raw)
In-Reply-To: <1140065071.8209.3.camel@lade.trondhjem.org>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=unknown-8bit, Size: 1975 bytes --]
On Wed, Feb 15, 2006 at 11:44:31PM -0500, Trond Myklebust wrote:
> Author: Trond Myklebust <Trond.Myklebust@netapp.com>
> lockd: Fix Oopses due to list manipulation errors.
>
> The patch "stop abusing file_lock_list introduces a couple of bugs since
> the locks may be copied and need to be removed from the lists when they are
> destroyed.
>
> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
> ---
>
> fs/lockd/clntproc.c | 9 ++++++++-
> 1 files changed, 8 insertions(+), 1 deletions(-)
>
> diff --git a/fs/lockd/clntproc.c b/fs/lockd/clntproc.c
> index 211113a..b1b924d 100644
> --- a/fs/lockd/clntproc.c
> +++ b/fs/lockd/clntproc.c
> @@ -447,12 +447,17 @@ static void nlmclnt_locks_copy_lock(stru
> {
> memcpy(&new->fl_u.nfs_fl, &fl->fl_u.nfs_fl, sizeof(new->fl_u.nfs_fl));
> nlm_get_lockowner(new->fl_u.nfs_fl.owner);
> + INIT_LIST_HEAD(&new->fl_u.nfs_fl.list);
> + if (!list_empty(&fl->fl_u.nfs_fl.list))
> + list_add(&new->fl_u.nfs_fl.list, &fl->fl_u.nfs_fl.list);
list_add initializes ænough so we don't need the INIT_LIST_HEAD in that
case, so this could become:
if (list_empty(&fl->fl_u.nfs_fl.list))
INIT_LIST_HEAD(&new->fl_u.nfs_fl.list);
else
list_add(&new->fl_u.nfs_fl.list, &fl->fl_u.nfs_fl.list);
> * Remove from the granted list now so the lock doesn't get
> * reclaimed while we're stuck in the unlock call.
> */
> - list_del(&fl->fl_u.nfs_fl.list);
> + if (!list_empty(&fl->fl_u.nfs_fl.list))
> + list_del_init(&fl->fl_u.nfs_fl.list);
Probably should be just unconditionaly. list_del_init isn't a whole lot
of instructions, but we save a branch and have more readable code.
While we're at it, don't we need a INIT_LIST_HEAD in
nlmclnt_locks_init_private aswell?
-
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
next prev parent reply other threads:[~2006-02-16 13:57 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-02-14 19:20 [PATCH, RFC] lockd: stop abusing file_lock_list Christoph Hellwig
2006-02-14 22:27 ` Trond Myklebust
2006-02-16 4:44 ` Trond Myklebust
2006-02-16 10:23 ` Jens Axboe
2006-02-16 13:46 ` Trond Myklebust
2006-02-16 13:57 ` Christoph Hellwig [this message]
2006-02-16 14:21 ` 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=20060216135734.GA3393@lst.de \
--to=hch@lst.de \
--cc=linux-fsdevel@vger.kernel.org \
--cc=trond.myklebust@fys.uio.no \
/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;
as well as URLs for NNTP newsgroup(s).