Skip to content

Commit f24ba21

Browse files
zhangyi089gregkh
authored andcommitted
xfs: match lock mode in xfs_buffered_write_iomap_begin()
commit bb71284 upstream. Commit 1aa91d9 ("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: 1aa91d9 ("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: Catherine Hoang <catherine.hoang@oracle.com> Acked-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 7c03b12 commit f24ba21

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

fs/xfs/xfs_iomap.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,13 +1141,13 @@ xfs_buffered_write_iomap_begin(
11411141
* them out if the write happens to fail.
11421142
*/
11431143
seq = xfs_iomap_inode_sequence(ip, IOMAP_F_NEW);
1144-
xfs_iunlock(ip, XFS_ILOCK_EXCL);
1144+
xfs_iunlock(ip, lockmode);
11451145
trace_xfs_iomap_alloc(ip, offset, count, allocfork, &imap);
11461146
return xfs_bmbt_to_iomap(ip, iomap, &imap, flags, IOMAP_F_NEW, seq);
11471147

11481148
found_imap:
11491149
seq = xfs_iomap_inode_sequence(ip, 0);
1150-
xfs_iunlock(ip, XFS_ILOCK_EXCL);
1150+
xfs_iunlock(ip, lockmode);
11511151
return xfs_bmbt_to_iomap(ip, iomap, &imap, flags, 0, seq);
11521152

11531153
found_cow:
@@ -1157,17 +1157,17 @@ xfs_buffered_write_iomap_begin(
11571157
if (error)
11581158
goto out_unlock;
11591159
seq = xfs_iomap_inode_sequence(ip, IOMAP_F_SHARED);
1160-
xfs_iunlock(ip, XFS_ILOCK_EXCL);
1160+
xfs_iunlock(ip, lockmode);
11611161
return xfs_bmbt_to_iomap(ip, iomap, &cmap, flags,
11621162
IOMAP_F_SHARED, seq);
11631163
}
11641164

11651165
xfs_trim_extent(&cmap, offset_fsb, imap.br_startoff - offset_fsb);
1166-
xfs_iunlock(ip, XFS_ILOCK_EXCL);
1166+
xfs_iunlock(ip, lockmode);
11671167
return xfs_bmbt_to_iomap(ip, iomap, &cmap, flags, 0, seq);
11681168

11691169
out_unlock:
1170-
xfs_iunlock(ip, XFS_ILOCK_EXCL);
1170+
xfs_iunlock(ip, lockmode);
11711171
return error;
11721172
}
11731173

0 commit comments

Comments
 (0)