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

From: Christoph Hellwig
Date: Wed Feb 04 2004 - 13:20:27 EST


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