Commit f5cf34e6 authored by Christoph Hellwig's avatar Christoph Hellwig

[XFS] make sure i_size_write is called under i_sem

SGI Modid: xfs-linux:xfs-kern:166504a
parent 7b080b4c
...@@ -82,9 +82,14 @@ validate_fields( ...@@ -82,9 +82,14 @@ validate_fields(
va.va_mask = XFS_AT_NLINK|XFS_AT_SIZE|XFS_AT_NBLOCKS; va.va_mask = XFS_AT_NLINK|XFS_AT_SIZE|XFS_AT_NBLOCKS;
VOP_GETATTR(vp, &va, ATTR_LAZY, NULL, error); VOP_GETATTR(vp, &va, ATTR_LAZY, NULL, error);
ip->i_nlink = va.va_nlink; if (likely(!error)) {
ip->i_size = va.va_size; ip->i_nlink = va.va_nlink;
ip->i_blocks = va.va_nblocks; 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( ...@@ -536,6 +541,7 @@ linvfs_setattr(
if (error) if (error)
return(-error); /* Positive error up from XFS */ return(-error); /* Positive error up from XFS */
if (ia_valid & ATTR_SIZE) { if (ia_valid & ATTR_SIZE) {
i_size_write(inode, vattr.va_size);
error = vmtruncate(inode, attr->ia_size); error = vmtruncate(inode, attr->ia_size);
} }
......
...@@ -213,7 +213,6 @@ vn_revalidate( ...@@ -213,7 +213,6 @@ vn_revalidate(
inode->i_mtime = va.va_mtime; inode->i_mtime = va.va_mtime;
inode->i_ctime = va.va_ctime; inode->i_ctime = va.va_ctime;
inode->i_atime = va.va_atime; inode->i_atime = va.va_atime;
i_size_write(inode, va.va_size);
if (va.va_xflags & XFS_XFLAG_IMMUTABLE) if (va.va_xflags & XFS_XFLAG_IMMUTABLE)
inode->i_flags |= S_IMMUTABLE; inode->i_flags |= S_IMMUTABLE;
else else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment