From a9fdb78d3105b86623152c9583d2f42c6b9930ef Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Wed, 4 Jul 2012 11:13:31 -0400 Subject: [PATCH] --- yaml --- r: 319864 b: refs/heads/master c: 0b56185b0d64ef89dad1c85bb7403fa762cbe50d h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/fs/xfs/xfs_inode.c | 4 +++- trunk/fs/xfs/xfs_vnodeops.c | 29 ++++++++++++----------------- 3 files changed, 16 insertions(+), 19 deletions(-) diff --git a/[refs] b/[refs] index 43d0e36f3de3..5691afbdd6c5 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: fe67be036ff2f713b1c5f24dd4cdffae75bcb97a +refs/heads/master: 0b56185b0d64ef89dad1c85bb7403fa762cbe50d diff --git a/trunk/fs/xfs/xfs_inode.c b/trunk/fs/xfs/xfs_inode.c index 5c10825f2f80..2778258fcfa2 100644 --- a/trunk/fs/xfs/xfs_inode.c +++ b/trunk/fs/xfs/xfs_inode.c @@ -1123,7 +1123,9 @@ xfs_itruncate_extents( int error = 0; int done = 0; - ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL|XFS_IOLOCK_EXCL)); + ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL)); + ASSERT(!atomic_read(&VFS_I(ip)->i_count) || + xfs_isilocked(ip, XFS_IOLOCK_EXCL)); ASSERT(new_size <= XFS_ISIZE(ip)); ASSERT(tp->t_flags & XFS_TRANS_PERM_LOG_RES); ASSERT(ip->i_itemp != NULL); diff --git a/trunk/fs/xfs/xfs_vnodeops.c b/trunk/fs/xfs/xfs_vnodeops.c index 9a2ae8c0ecc4..79270430dafc 100644 --- a/trunk/fs/xfs/xfs_vnodeops.c +++ b/trunk/fs/xfs/xfs_vnodeops.c @@ -554,7 +554,7 @@ xfs_inactive( return VN_INACTIVE_CACHE; } - xfs_ilock(ip, XFS_IOLOCK_EXCL | XFS_ILOCK_EXCL); + xfs_ilock(ip, XFS_ILOCK_EXCL); xfs_trans_ijoin(tp, ip, 0); if (S_ISLNK(ip->i_d.di_mode)) { @@ -591,21 +591,24 @@ xfs_inactive( ASSERT(ip->i_d.di_forkoff != 0); error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES); - xfs_iunlock(ip, XFS_ILOCK_EXCL); if (error) - goto error_unlock; + goto out_unlock; + + xfs_iunlock(ip, XFS_ILOCK_EXCL); error = xfs_attr_inactive(ip); if (error) - goto error_unlock; + goto out; tp = xfs_trans_alloc(mp, XFS_TRANS_INACTIVE); error = xfs_trans_reserve(tp, 0, XFS_IFREE_LOG_RES(mp), 0, XFS_TRANS_PERM_LOG_RES, XFS_INACTIVE_LOG_COUNT); - if (error) - goto error_cancel; + if (error) { + xfs_trans_cancel(tp, 0); + goto out; + } xfs_ilock(ip, XFS_ILOCK_EXCL); xfs_trans_ijoin(tp, ip, 0); @@ -658,21 +661,13 @@ xfs_inactive( * Release the dquots held by inode, if any. */ xfs_qm_dqdetach(ip); - xfs_iunlock(ip, XFS_IOLOCK_EXCL | XFS_ILOCK_EXCL); - +out_unlock: + xfs_iunlock(ip, XFS_ILOCK_EXCL); out: return VN_INACTIVE_CACHE; out_cancel: xfs_trans_cancel(tp, XFS_TRANS_RELEASE_LOG_RES | XFS_TRANS_ABORT); - xfs_iunlock(ip, XFS_IOLOCK_EXCL | XFS_ILOCK_EXCL); - return VN_INACTIVE_CACHE; - -error_cancel: - ASSERT(XFS_FORCED_SHUTDOWN(mp)); - xfs_trans_cancel(tp, 0); -error_unlock: - xfs_iunlock(ip, XFS_IOLOCK_EXCL); - return VN_INACTIVE_CACHE; + goto out_unlock; } /*