f2fs: use shared inode lock during f2fs_fiemap()

f2fs_fiemap() will only traverse metadata of inode, let's use shared
inode lock for it to avoid unnecessary race on inode lock.

Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
Chao Yu 2023-11-16 14:25:55 +08:00 committed by Jaegeuk Kim
parent ff6584ac2c
commit 9458915036
1 changed files with 2 additions and 2 deletions

View File

@ -1992,7 +1992,7 @@ int f2fs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
if (ret)
return ret;
inode_lock(inode);
inode_lock_shared(inode);
maxbytes = max_file_blocks(inode) << F2FS_BLKSIZE_BITS;
if (start > maxbytes) {
@ -2112,7 +2112,7 @@ out:
if (ret == 1)
ret = 0;
inode_unlock(inode);
inode_unlock_shared(inode);
return ret;
}