Skip to contentSkip to conversation

xfs: fix a missing unlock on error in xfs_fs_map_blocks

PATCH In review Christoph Hellwig 2 participants 2 messages Nov 11, 2020 XFS filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfs: fix a missing unlock on error in xfs_fs_map_blocks

We also need to drop the iolock when invalidate_inode_pages2 fails, not only on all other error or successful cases.

Fixes 527851124d10 ("xfs: implement pNFS export operations")
---
 fs/xfs/xfs_pnfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xfs/xfs_pnfs.c +1 -1
index b101feb2aab452..f3082a957d5e1a 100644
@@ -134,7 +134,7 @@ xfs_fs_map_blocks(
 		goto out_unlock;
 	error = invalidate_inode_pages2(inode->i_mapping);
 	if (WARN_ON_ONCE(error))
-		return error;
+		goto out_unlock;
 
 	end_fsb = XFS_B_TO_FSB(mp, (xfs_ufsize_t)offset + length);
 	offset_fsb = XFS_B_TO_FSBT(mp, offset);
Signature · 1 line
2.28.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Christoph Hellwig

We also need to drop the iolock when invalidate_inode_pages2 fails, not only on all other error or successful cases.

Fixes 527851124d10 ("xfs: implement pNFS export operations")

Looks good to me,

--D

Quoted 20 lines
---
 fs/xfs/xfs_pnfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xfs/xfs_pnfs.c +1 -1
index b101feb2aab452..f3082a957d5e1a 100644
@@ -134,7 +134,7 @@ xfs_fs_map_blocks(
 		goto out_unlock;
 	error = invalidate_inode_pages2(inode->i_mapping);
 	if (WARN_ON_ONCE(error))
-		return error;
+		goto out_unlock;
 
 	end_fsb = XFS_B_TO_FSB(mp, (xfs_ufsize_t)offset + length);
 	offset_fsb = XFS_B_TO_FSBT(mp, offset);
Signature · 1 line
2.28.0