Re: 2.6.2-rc2 nfsd+xfs spins in i_size_read()

From: Andrew Morton (akpm_at_osdl.org)
Date: 01/31/04

  • Next message: Shailabh Nagar: "[RFC] Revised CKRM API"
    Date:	Fri, 30 Jan 2004 17:38:51 -0800
    To: Miquel van Smoorenburg <miquels@cistron.nl>
    
    

    Miquel van Smoorenburg <miquels@cistron.nl> wrote:
    >
    > On Sat, 31 Jan 2004 00:13:16, Andrew Morton wrote:
    > > Christoph Hellwig <hch@infradead.org> wrote:
    > > >
    > > > On Fri, Jan 30, 2004 at 02:34:59PM -0800, Andrew Morton wrote:
    > > > > If two CPUs hit i_size_write() at the same time we have a bug. That
    > > > > function requires that the caller provide external serialisation, via i_sem.
    > > >
    > > > O_APPEND|O_DIRECT writes could do that under XFS..
    > >
    > > Sigh.
    > >
    > > diff -puN mm/filemap.c~i_size_write-check mm/filemap.c
    > > --- 25/mm/filemap.c~i_size_write-check Fri Jan 30 15:10:23 2004
    > > +++ 25-akpm/mm/filemap.c Fri Jan 30 15:11:41 2004
    > > @@ -2010,3 +2010,18 @@ out:
    > > }
    > >
    > > EXPORT_SYMBOL_GPL(generic_file_direct_IO);
    > > +
    > > +void i_size_write_check(struct inode *inode)
    > > +{
    > > + static int count = 0;
    > > +
    > > + if (down_trylock(&inode->i_sem) == 0) {
    > > + if (count < 10) {
    >
    > You want to set this to 100 at least, since at boot time the message
    > happens _often_ even without XFS.

    fun.

    > It's caused by sysfs:

    OK, sysfs_symlink() needs i_sem.

    > Also, bd_set_size runs unlocked:

    I don't expect we'll ever see a race over the blockdev's i_size in there.
    It might be simplest to just do a straight assignment. I'll work that with
    viro.

    > But the XFS problem appears to be vn_revalidate which calls i_size_write()
    > without holding i_sem:

    There's your bug.

    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/


  • Next message: Shailabh Nagar: "[RFC] Revised CKRM API"

    Relevant Pages

    • 2.6.0-test9 status report
      ... Radeon framebuffer ... At boot time, since like kernel 2.5.59, there is a pile of random junk ... and sometimes when I hit the backspace i get a little ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: The "best" value of HZ
      ... > boot time instead of at compile time? ... > Do you think it would be a desired feature the knowledge of the best value ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: [Linux-cluster] Re: GFS, whats remaining
      ... The point is a simple system that programs needing the basic ... A kiss is just a kiss, ... A sigh is just a sigh. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: 2.6.0-test9 vs sound
      ... |> saw an announcement regarding a new modutils tool set last night, ... | You need the new module-init-tools. ... boot time, otherwise write a script. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: rootdelay
      ... >> boot time because it wakes up the boot process right when the ... Since I saw your patch included, ... that mounting the root device happens exactly when it needs to, ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)