summaryrefslogtreecommitdiff
path: root/fs/xfs/linux-2.6/xfs_file.c
diff options
context:
space:
mode:
authorNathan Scott <nathans@sgi.com>2006-06-09 15:27:16 +1000
committerNathan Scott <nathans@sgi.com>2006-06-09 15:27:16 +1000
commit7d4fb40ad7efe4586d1341d4731377fb4530836f (patch)
treebf802cce6bc60627186b02b71014a683f6cb4a05 /fs/xfs/linux-2.6/xfs_file.c
parent59c1b082f5fff8269565039600a2ef18d48649b5 (diff)
downloadlinux-stable-7d4fb40ad7efe4586d1341d4731377fb4530836f.tar.gz
linux-stable-7d4fb40ad7efe4586d1341d4731377fb4530836f.tar.bz2
linux-stable-7d4fb40ad7efe4586d1341d4731377fb4530836f.zip
[XFS] Start writeout earlier (on last close) in the case where we have a
truncate down followed by delayed allocation (buffered writes) - worst case scenario for the notorious NULL files problem. This reduces the window where we are exposed to that problem significantly. SGI-PV: 917976 SGI-Modid: xfs-linux-melb:xfs-kern:26100a Signed-off-by: Nathan Scott <nathans@sgi.com>
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_file.c')
-rw-r--r--fs/xfs/linux-2.6/xfs_file.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/fs/xfs/linux-2.6/xfs_file.c b/fs/xfs/linux-2.6/xfs_file.c
index 7c9f7598807f..97615cc74ef5 100644
--- a/fs/xfs/linux-2.6/xfs_file.c
+++ b/fs/xfs/linux-2.6/xfs_file.c
@@ -324,6 +324,17 @@ xfs_file_open(
}
STATIC int
+xfs_file_close(
+ struct file *filp)
+{
+ vnode_t *vp = vn_from_inode(filp->f_dentry->d_inode);
+ int error;
+
+ VOP_CLOSE(vp, 0, file_count(filp) > 1 ? L_FALSE : L_TRUE, NULL, error);
+ return -error;
+}
+
+STATIC int
xfs_file_release(
struct inode *inode,
struct file *filp)
@@ -349,6 +360,8 @@ xfs_file_fsync(
if (datasync)
flags |= FSYNC_DATA;
+ if (VN_TRUNC(vp))
+ VUNTRUNCATE(vp);
VOP_FSYNC(vp, flags, NULL, (xfs_off_t)0, (xfs_off_t)-1, error);
return -error;
}
@@ -578,6 +591,7 @@ const struct file_operations xfs_file_operations = {
#endif
.mmap = xfs_file_mmap,
.open = xfs_file_open,
+ .flush = xfs_file_close,
.release = xfs_file_release,
.fsync = xfs_file_fsync,
#ifdef HAVE_FOP_OPEN_EXEC
@@ -602,6 +616,7 @@ const struct file_operations xfs_invis_file_operations = {
#endif
.mmap = xfs_file_mmap,
.open = xfs_file_open,
+ .flush = xfs_file_close,
.release = xfs_file_release,
.fsync = xfs_file_fsync,
};