All of lore.kernel.org
 help / color / mirror / Atom feed
From: Trond Myklebust <trond.myklebust@fys.uio.no>
To: Christian Krafft <krafft@de.ibm.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [patch] nfs: fix locking in nfs/inode.c in nfs_free_open_context
Date: Wed, 25 Jul 2007 13:28:22 -0400	[thread overview]
Message-ID: <1185384502.6585.97.camel@localhost> (raw)
In-Reply-To: <20070725170837.5fba5fd1@localhost>

On Wed, 2007-07-25 at 17:08 +0200, Christian Krafft wrote:

> Obviously the locking code in nfs_free_open_context is wrong.
> Checking the list for entries and removing the entry should be an atomic operation.

Wrong. It is quite safe to test the structure member ctx->list for
emptiness outside the spinlock because we have an explicit guarantee
that nobody else has a reference to this structure, plus the
atomic_dec_and_test() in kref_put() has acted as a memory barrier for
us.

> Also list_del_init should be used, because list_del will leave the empty list in
> an undefined condition.

Huh? We're freeing the context. It will _never_ _ever_ _ever_ be used
again. If anything tries to use ctx->list after this, then that is a
major bug.

Patch rejected...

Trond


  reply	other threads:[~2007-07-25 17:28 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-25 15:08 [patch] nfs: fix locking in nfs/inode.c in nfs_free_open_context Christian Krafft
2007-07-25 17:28 ` Trond Myklebust [this message]
2007-07-26 11:23   ` Arnd Bergmann
2007-07-26 12:37     ` Trond Myklebust
2007-07-26 12:44     ` Christian Krafft
2007-07-26 13:23       ` Trond Myklebust
2007-07-26 15:13         ` Arnd Bergmann
2007-07-26 16:08           ` Trond Myklebust
2007-07-26 18:00             ` Christian Krafft
2007-07-27 10:02               ` Christian Krafft
2007-07-27  9:44             ` Arnd Bergmann

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=1185384502.6585.97.camel@localhost \
    --to=trond.myklebust@fys.uio.no \
    --cc=krafft@de.ibm.com \
    --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 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.