xfs: make xfs_free_eofblocks() non-static, return EAGAIN on trylock failure
authorBrian Foster <bfoster@redhat.com>
Tue, 6 Nov 2012 14:50:41 +0000 (09:50 -0500)
committerBen Myers <bpm@sgi.com>
Thu, 8 Nov 2012 21:24:26 +0000 (15:24 -0600)
Turn xfs_free_eofblocks() into a non-static function, return EAGAIN to
indicate trylock failure and make sure this error is not propagated in
xfs_release().

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Mark Tinguely <tinguely@sgi.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
fs/xfs/xfs_vnodeops.c
fs/xfs/xfs_vnodeops.h

index c4c15390020569494d58662c2c2de2275c467c94..c2ddd7a439422ed56494d45bf60a64a00e8b76fd 100644 (file)
@@ -151,7 +151,7 @@ xfs_readlink(
  * when the link count isn't zero and by xfs_dm_punch_hole() when
  * punching a hole to EOF.
  */
-STATIC int
+int
 xfs_free_eofblocks(
        xfs_mount_t     *mp,
        xfs_inode_t     *ip,
@@ -200,7 +200,7 @@ xfs_free_eofblocks(
                if (need_iolock) {
                        if (!xfs_ilock_nowait(ip, XFS_IOLOCK_EXCL)) {
                                xfs_trans_cancel(tp, 0);
-                               return 0;
+                               return EAGAIN;
                        }
                }
 
@@ -463,7 +463,7 @@ xfs_release(
                        return 0;
 
                error = xfs_free_eofblocks(mp, ip, true);
-               if (error)
+               if (error && error != EAGAIN)
                        return error;
 
                /* delalloc blocks after truncation means it really is dirty */
index 447e146b2ba6d8ae1a9213841f6daae5a209f487..52fafc416a0cccd7adf5442ab86130b892466be3 100644 (file)
@@ -57,5 +57,6 @@ int xfs_flush_pages(struct xfs_inode *ip, xfs_off_t first,
 int xfs_wait_on_pages(struct xfs_inode *ip, xfs_off_t first, xfs_off_t last);
 
 int xfs_zero_eof(struct xfs_inode *, xfs_off_t, xfs_fsize_t);
+int xfs_free_eofblocks(struct xfs_mount *, struct xfs_inode *, bool);
 
 #endif /* _XFS_VNODEOPS_H */