xfs
[Top] [All Lists]

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

To: Steve Lord <lord@xxxxxxx>
Subject: Re: 2.6.2-rc2 nfsd+xfs spins in i_size_read()
From: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Date: Wed, 4 Feb 2004 18:17:09 +0000
Cc: Christoph Hellwig <hch@xxxxxxxxxxxxx>, Miquel van Smoorenburg <miquels@xxxxxxxxxx>, Andrew Morton <akpm@xxxxxxxx>, Nathan Scott <nathans@xxxxxxx>, linux-kernel@xxxxxxxxxxxxxxx, linux-xfs@xxxxxxxxxxx
In-reply-to: <401FAC70.8070104@xxxxxxx>; from lord@xxxxxxx on Tue, Feb 03, 2004 at 08:13:04AM -0600
Mail-followup-to: Christoph Hellwig <hch@xxxxxxxxxxxxx>, Steve Lord <lord@xxxxxxx>, Miquel van Smoorenburg <miquels@xxxxxxxxxx>, Andrew Morton <akpm@xxxxxxxx>, Nathan Scott <nathans@xxxxxxx>, linux-kernel@xxxxxxxxxxxxxxx, linux-xfs@xxxxxxxxxxx
References: <bv8qr7$m2v$1@xxxxxxxxxxxxxxx> <20040129063009.GD2474@frodo> <bv8qr7$m2v$1@xxxxxxxxxxxxxxx> <20040128222521.75a7d74f.akpm@xxxxxxxx> <20040129063009.GD2474@frodo> <20040129232033.GA10541@xxxxxxxxxx> <20040204000315.A12127@xxxxxxxxxxxxx> <401FAC70.8070104@xxxxxxx>
Sender: linux-xfs-bounce@xxxxxxxxxxx
User-agent: Mutt/1.2.5.1i
Here's a new diff, that should get rid of all the warnings except for
O_DIRECT.  I've also addressed the comments from Dave and Steve.

Index: fs/xfs/linux-2.6/xfs_iops.c
===================================================================
RCS file: /cvs/linux-2.6-xfs/fs/xfs/linux-2.6/xfs_iops.c,v
retrieving revision 1.212
diff -u -p -r1.212 xfs_iops.c
--- fs/xfs/linux-2.6/xfs_iops.c 12 Dec 2003 04:17:52 -0000      1.212
+++ fs/xfs/linux-2.6/xfs_iops.c 4 Feb 2004 17:56:34 -0000
@@ -82,9 +82,14 @@ validate_fields(
 
        va.va_mask = XFS_AT_NLINK|XFS_AT_SIZE|XFS_AT_NBLOCKS;
        VOP_GETATTR(vp, &va, ATTR_LAZY, NULL, error);
-       ip->i_nlink = va.va_nlink;
-       ip->i_size = va.va_size;
-       ip->i_blocks = va.va_nblocks;
+       if (likely(!error)) {
+               ip->i_nlink = va.va_nlink;
+               ip->i_blocks = va.va_nblocks;
+
+               /* we're under i_sem so i_size can't change under us */
+               if (i_size_read(ip) != va.va_size)
+                       i_size_write(ip, va.va_size);
+       }
 }
 
 /*
@@ -536,6 +541,7 @@ linvfs_setattr(
        if (error)
                return(-error); /* Positive error up from XFS */
        if (ia_valid & ATTR_SIZE) {
+               i_size_write(inode, vattr.va_size);
                error = vmtruncate(inode, attr->ia_size);
        }
 
Index: fs/xfs/linux-2.6/xfs_super.c
===================================================================
RCS file: /cvs/linux-2.6-xfs/fs/xfs/linux-2.6/xfs_super.c,v
retrieving revision 1.294
diff -u -p -r1.294 xfs_super.c
--- fs/xfs/linux-2.6/xfs_super.c        21 Jan 2004 16:46:06 -0000      1.294
+++ fs/xfs/linux-2.6/xfs_super.c        4 Feb 2004 17:56:55 -0000
@@ -178,7 +178,7 @@ xfs_revalidate_inode(
        }
        inode->i_blksize = PAGE_CACHE_SIZE;
        inode->i_generation = ip->i_d.di_gen;
-       i_size_write(inode, ip->i_d.di_size);
+       inode->i_size = ip->i_d.di_size;
        inode->i_blocks =
                XFS_FSB_TO_BB(mp, ip->i_d.di_nblocks + ip->i_delayed_blks);
        inode->i_atime.tv_sec   = ip->i_d.di_atime.t_sec;
Index: fs/xfs/linux-2.6/xfs_vnode.c
===================================================================
RCS file: /cvs/linux-2.6-xfs/fs/xfs/linux-2.6/xfs_vnode.c,v
retrieving revision 1.120
diff -u -p -r1.120 xfs_vnode.c
--- fs/xfs/linux-2.6/xfs_vnode.c        20 Oct 2003 02:08:58 -0000      1.120
+++ fs/xfs/linux-2.6/xfs_vnode.c        4 Feb 2004 17:56:55 -0000
@@ -213,7 +213,6 @@ vn_revalidate(
                inode->i_mtime      = va.va_mtime;
                inode->i_ctime      = va.va_ctime;
                inode->i_atime      = va.va_atime;
-               i_size_write(inode, va.va_size);
                if (va.va_xflags & XFS_XFLAG_IMMUTABLE)
                        inode->i_flags |= S_IMMUTABLE;
                else


<Prev in Thread] Current Thread [Next in Thread>