aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_vnodeops.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_vnodeops.c')
-rw-r--r--fs/xfs/xfs_vnodeops.c47
1 files changed, 16 insertions, 31 deletions
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c
index 5dbca95598e0..2067d0b0a10e 100644
--- a/fs/xfs/xfs_vnodeops.c
+++ b/fs/xfs/xfs_vnodeops.c
@@ -77,36 +77,6 @@ xfs_open(
77 return 0; 77 return 0;
78} 78}
79 79
80STATIC int
81xfs_close(
82 bhv_desc_t *bdp,
83 int flags,
84 lastclose_t lastclose,
85 cred_t *credp)
86{
87 bhv_vnode_t *vp = BHV_TO_VNODE(bdp);
88 xfs_inode_t *ip = XFS_BHVTOI(bdp);
89
90 if (XFS_FORCED_SHUTDOWN(ip->i_mount))
91 return XFS_ERROR(EIO);
92
93 if (lastclose != L_TRUE || !VN_ISREG(vp))
94 return 0;
95
96 /*
97 * If we previously truncated this file and removed old data in
98 * the process, we want to initiate "early" writeout on the last
99 * close. This is an attempt to combat the notorious NULL files
100 * problem which is particularly noticable from a truncate down,
101 * buffered (re-)write (delalloc), followed by a crash. What we
102 * are effectively doing here is significantly reducing the time
103 * window where we'd otherwise be exposed to that problem.
104 */
105 if (VUNTRUNCATE(vp) && VN_DIRTY(vp) && ip->i_delayed_blks > 0)
106 return bhv_vop_flush_pages(vp, 0, -1, XFS_B_ASYNC, FI_NONE);
107 return 0;
108}
109
110/* 80/*
111 * xfs_getattr 81 * xfs_getattr
112 */ 82 */
@@ -1566,6 +1536,22 @@ xfs_release(
1566 if (vp->v_vfsp->vfs_flag & VFS_RDONLY) 1536 if (vp->v_vfsp->vfs_flag & VFS_RDONLY)
1567 return 0; 1537 return 0;
1568 1538
1539 if (!XFS_FORCED_SHUTDOWN(ip->i_mount)) {
1540 /*
1541 * If we previously truncated this file and removed old data
1542 * in the process, we want to initiate "early" writeout on
1543 * the last close. This is an attempt to combat the notorious
1544 * NULL files problem which is particularly noticable from a
1545 * truncate down, buffered (re-)write (delalloc), followed by
1546 * a crash. What we are effectively doing here is
1547 * significantly reducing the time window where we'd otherwise
1548 * be exposed to that problem.
1549 */
1550 if (VUNTRUNCATE(vp) && VN_DIRTY(vp) && ip->i_delayed_blks > 0)
1551 bhv_vop_flush_pages(vp, 0, -1, XFS_B_ASYNC, FI_NONE);
1552 }
1553
1554
1569#ifdef HAVE_REFCACHE 1555#ifdef HAVE_REFCACHE
1570 /* If we are in the NFS reference cache then don't do this now */ 1556 /* If we are in the NFS reference cache then don't do this now */
1571 if (ip->i_refcache) 1557 if (ip->i_refcache)
@@ -4681,7 +4667,6 @@ xfs_change_file_space(
4681bhv_vnodeops_t xfs_vnodeops = { 4667bhv_vnodeops_t xfs_vnodeops = {
4682 BHV_IDENTITY_INIT(VN_BHV_XFS,VNODE_POSITION_XFS), 4668 BHV_IDENTITY_INIT(VN_BHV_XFS,VNODE_POSITION_XFS),
4683 .vop_open = xfs_open, 4669 .vop_open = xfs_open,
4684 .vop_close = xfs_close,
4685 .vop_read = xfs_read, 4670 .vop_read = xfs_read,
4686#ifdef HAVE_SPLICE 4671#ifdef HAVE_SPLICE
4687 .vop_splice_read = xfs_splice_read, 4672 .vop_splice_read = xfs_splice_read,