Skip to content

Commit bb71284

Browse files
zhangyi089Chandan Babu R
authored andcommitted
xfs: match lock mode in xfs_buffered_write_iomap_begin()
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 <[email protected]> Reviewed-by: "Darrick J. Wong" <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Chandan Babu R <[email protected]>
1 parent e58ac17 commit bb71284

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
@@ -1175,13 +1175,13 @@ xfs_buffered_write_iomap_begin(
11751175
* them out if the write happens to fail.
11761176
*/
11771177
seq = xfs_iomap_inode_sequence(ip, IOMAP_F_NEW);
1178-
xfs_iunlock(ip, XFS_ILOCK_EXCL);
1178+
xfs_iunlock(ip, lockmode);
11791179
trace_xfs_iomap_alloc(ip, offset, count, allocfork, &imap);
11801180
return xfs_bmbt_to_iomap(ip, iomap, &imap, flags, IOMAP_F_NEW, seq);
11811181

11821182
found_imap:
11831183
seq = xfs_iomap_inode_sequence(ip, 0);
1184-
xfs_iunlock(ip, XFS_ILOCK_EXCL);
1184+
xfs_iunlock(ip, lockmode);
11851185
return xfs_bmbt_to_iomap(ip, iomap, &imap, flags, 0, seq);
11861186

11871187
found_cow:
@@ -1191,17 +1191,17 @@ xfs_buffered_write_iomap_begin(
11911191
if (error)
11921192
goto out_unlock;
11931193
seq = xfs_iomap_inode_sequence(ip, IOMAP_F_SHARED);
1194-
xfs_iunlock(ip, XFS_ILOCK_EXCL);
1194+
xfs_iunlock(ip, lockmode);
11951195
return xfs_bmbt_to_iomap(ip, iomap, &cmap, flags,
11961196
IOMAP_F_SHARED, seq);
11971197
}
11981198

11991199
xfs_trim_extent(&cmap, offset_fsb, imap.br_startoff - offset_fsb);
1200-
xfs_iunlock(ip, XFS_ILOCK_EXCL);
1200+
xfs_iunlock(ip, lockmode);
12011201
return xfs_bmbt_to_iomap(ip, iomap, &cmap, flags, 0, seq);
12021202

12031203
out_unlock:
1204-
xfs_iunlock(ip, XFS_ILOCK_EXCL);
1204+
xfs_iunlock(ip, lockmode);
12051205
return error;
12061206
}
12071207

0 commit comments

Comments
 (0)