mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 10:31:46 +09:00
xfs: match lock mode in xfs_buffered_write_iomap_begin()
[ Upstream commit bb712842a85d595525e72f0e378c143e620b3ea2 ] Commit1aa91d9c99("xfs: Add async buffered write support") replace xfs_ilock(XFS_ILOCK_EXCL) with xfs_ilock_for_iomap() when locking the writing inode, and a new variable lockmode is used to indicate the lock mode. Although the lockmode should always be XFS_ILOCK_EXCL, it's still better to use this variable instead of useing XFS_ILOCK_EXCL directly when unlocking the inode. Fixes:1aa91d9c99("xfs: Add async buffered write support") Signed-off-by: Zhang Yi <yi.zhang@huawei.com> Reviewed-by: "Darrick J. Wong" <djwong@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Chandan Babu R <chandanbabu@kernel.org> Signed-off-by: Leah Rumancik <leah.rumancik@gmail.com> Acked-by: "Darrick J. Wong" <djwong@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
7bfa86d204
commit
0e2fcf273b
@@ -1129,13 +1129,13 @@ retry:
|
|||||||
* them out if the write happens to fail.
|
* them out if the write happens to fail.
|
||||||
*/
|
*/
|
||||||
seq = xfs_iomap_inode_sequence(ip, IOMAP_F_NEW);
|
seq = xfs_iomap_inode_sequence(ip, IOMAP_F_NEW);
|
||||||
xfs_iunlock(ip, XFS_ILOCK_EXCL);
|
xfs_iunlock(ip, lockmode);
|
||||||
trace_xfs_iomap_alloc(ip, offset, count, allocfork, &imap);
|
trace_xfs_iomap_alloc(ip, offset, count, allocfork, &imap);
|
||||||
return xfs_bmbt_to_iomap(ip, iomap, &imap, flags, IOMAP_F_NEW, seq);
|
return xfs_bmbt_to_iomap(ip, iomap, &imap, flags, IOMAP_F_NEW, seq);
|
||||||
|
|
||||||
found_imap:
|
found_imap:
|
||||||
seq = xfs_iomap_inode_sequence(ip, 0);
|
seq = xfs_iomap_inode_sequence(ip, 0);
|
||||||
xfs_iunlock(ip, XFS_ILOCK_EXCL);
|
xfs_iunlock(ip, lockmode);
|
||||||
return xfs_bmbt_to_iomap(ip, iomap, &imap, flags, 0, seq);
|
return xfs_bmbt_to_iomap(ip, iomap, &imap, flags, 0, seq);
|
||||||
|
|
||||||
found_cow:
|
found_cow:
|
||||||
@@ -1145,17 +1145,17 @@ found_cow:
|
|||||||
if (error)
|
if (error)
|
||||||
goto out_unlock;
|
goto out_unlock;
|
||||||
seq = xfs_iomap_inode_sequence(ip, IOMAP_F_SHARED);
|
seq = xfs_iomap_inode_sequence(ip, IOMAP_F_SHARED);
|
||||||
xfs_iunlock(ip, XFS_ILOCK_EXCL);
|
xfs_iunlock(ip, lockmode);
|
||||||
return xfs_bmbt_to_iomap(ip, iomap, &cmap, flags,
|
return xfs_bmbt_to_iomap(ip, iomap, &cmap, flags,
|
||||||
IOMAP_F_SHARED, seq);
|
IOMAP_F_SHARED, seq);
|
||||||
}
|
}
|
||||||
|
|
||||||
xfs_trim_extent(&cmap, offset_fsb, imap.br_startoff - offset_fsb);
|
xfs_trim_extent(&cmap, offset_fsb, imap.br_startoff - offset_fsb);
|
||||||
xfs_iunlock(ip, XFS_ILOCK_EXCL);
|
xfs_iunlock(ip, lockmode);
|
||||||
return xfs_bmbt_to_iomap(ip, iomap, &cmap, flags, 0, seq);
|
return xfs_bmbt_to_iomap(ip, iomap, &cmap, flags, 0, seq);
|
||||||
|
|
||||||
out_unlock:
|
out_unlock:
|
||||||
xfs_iunlock(ip, XFS_ILOCK_EXCL);
|
xfs_iunlock(ip, lockmode);
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user