Re: [patch] nfs: fix locking in nfs/inode.c innfs_free_open_context

From: Christian Krafft
Date: Thu Jul 26 2007 - 14:02:00 EST


On Thu, 26 Jul 2007 12:08:17 -0400
Trond Myklebust <trond.myklebust@xxxxxxxxxx> wrote:

> On Thu, 2007-07-26 at 17:13 +0200, Arnd Bergmann wrote:
> > Unfortunately, you didn't answer my question. The observed problem is
> > that the final kref_put gets called at a time where there are still
> > references to the context in nfsi->open_files, and other threads
> > therefore do get at them.
>
> Actually, I thought I did: I said we need to grab the lock atomically
> with the last put. See below.
>
> > The patch holds the i_lock around the kref_put to prevent others
> > from searching the list. Ugly, I know, but it seems that's the
> > price you pay for using a kref in such unconventional ways, i.e.
> > not counting every reference.
>
> Really ugly. Here's an alternative that is a lot more palatable.

Indeed, and it also compiles ;-)
I started a test run using this patch, we'll see in a few hours ...

--
Mit freundlichen Gruessen,
kind regards,

Christian Krafft
IBM Systems & Technology Group,
Linux Kernel Development
IT Specialist


Vorsitzender des Aufsichtsrats: Martin Jetter
Geschaeftsfuehrung: Herbert Kircher
Sitz der Gesellschaft: Boeblingen
Registriergericht: Amtsgericht Stuttgart, HRB 243294

Attachment: signature.asc
Description: PGP signature