]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blobdiff - fs/xfs/xfs_pnfs.c
xfs: saner xfs_trans_commit interface
[mirror_ubuntu-zesty-kernel.git] / fs / xfs / xfs_pnfs.c
index 365dd57ea760ddd5beaa87d78dc6a1f31d7feb94..ab4a6066f7ca7b24fbe4cdf2db0f2c1ddfdab3df 100644 (file)
@@ -31,7 +31,8 @@
 int
 xfs_break_layouts(
        struct inode            *inode,
-       uint                    *iolock)
+       uint                    *iolock,
+       bool                    with_imutex)
 {
        struct xfs_inode        *ip = XFS_I(inode);
        int                     error;
@@ -40,8 +41,12 @@ xfs_break_layouts(
 
        while ((error = break_layout(inode, false) == -EWOULDBLOCK)) {
                xfs_iunlock(ip, *iolock);
+               if (with_imutex && (*iolock & XFS_IOLOCK_EXCL))
+                       mutex_unlock(&inode->i_mutex);
                error = break_layout(inode, true);
                *iolock = XFS_IOLOCK_EXCL;
+               if (with_imutex)
+                       mutex_lock(&inode->i_mutex);
                xfs_ilock(ip, *iolock);
        }
 
@@ -301,7 +306,7 @@ xfs_fs_commit_blocks(
        tp = xfs_trans_alloc(mp, XFS_TRANS_SETATTR_NOT_SIZE);
        error = xfs_trans_reserve(tp, &M_RES(mp)->tr_ichange, 0, 0);
        if (error) {
-               xfs_trans_cancel(tp, 0);
+               xfs_trans_cancel(tp);
                goto out_drop_iolock;
        }
 
@@ -316,7 +321,7 @@ xfs_fs_commit_blocks(
        }
 
        xfs_trans_set_sync(tp);
-       error = xfs_trans_commit(tp, 0);
+       error = xfs_trans_commit(tp);
 
 out_drop_iolock:
        xfs_iunlock(ip, XFS_IOLOCK_EXCL);