Skip to contentSkip to conversation

xfs: remove incorrect ASSERT in xfs_rename

PATCH In review Kuniyuki Iwashima 2 participants 2 messages Jul 7, 2022 – Jul 8, 2022 Stable branch

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfs: remove incorrect ASSERT in xfs_rename

From: Eric Sandeen <[email protected]>

commit e445976537ad139162980bee015b7364e5b64fff upstream.

Ayushman Dutta reported our 5.10 kernel hit the warning. It was because the original commit misses a Fixes tag and was not backported to the stable tree. The fix is merged in 5.16, but it conflicts in 4.9 - 5.10 because of the idmapped mount changes:

++<<<<<<< HEAD
+ ASSERT(!(flags & (RENAME_NOREPLACE | RENAME_EXCHANGE)));
+ error = xfs_rename_alloc_whiteout(target_dp, &wip);
++=======
+ error = xfs_rename_alloc_whiteout(mnt_userns, target_dp, &wip);
++>>>>>>> e445976537ad (xfs: remove incorrect ASSERT in xfs_rename)

We can resolve this by removing mnt_userns from the argument.

This ASSERT in xfs_rename is a) incorrect, because (RENAME_WHITEOUT|RENAME_NOREPLACE) is a valid combination, and
b) unnecessary, because actual invalid flag combinations are already handled at the vfs level in do_renameat2() before we get called. So, remove it.

Fixes 7dcf5c3e4527 ("xfs: add RENAME_WHITEOUT support")

---
I confirmed this can be applied cleanly on the latest 4.9 - 5.10 stable branch, but if there is any problem, please let me know.

---
 fs/xfs/xfs_inode.c | 1 -
 1 file changed, 1 deletion(-)
fs/xfs/xfs_inode.c +0 -1
index e958b1c74561..03497741aef7 100644
@@ -3170,7 +3170,6 @@ xfs_rename(
 	 * appropriately.
 	 */
 	if (flags & RENAME_WHITEOUT) {
-		ASSERT(!(flags & (RENAME_NOREPLACE | RENAME_EXCHANGE)));
 		error = xfs_rename_alloc_whiteout(target_dp, &wip);
 		if (error)
 			return error;
Signature · 1 line
2.30.2
Acked-by on v1 1/1
#1 lore raw
Quoted 30 lines · Kuniyuki Iwashima

From: Eric Sandeen <[email protected]>

commit e445976537ad139162980bee015b7364e5b64fff upstream.

Ayushman Dutta reported our 5.10 kernel hit the warning. It was because the original commit misses a Fixes tag and was not backported to the stable tree. The fix is merged in 5.16, but it conflicts in 4.9 - 5.10 because of the idmapped mount changes:

++<<<<<<< HEAD
+ ASSERT(!(flags & (RENAME_NOREPLACE | RENAME_EXCHANGE)));
+ error = xfs_rename_alloc_whiteout(target_dp, &wip);
++=======
+ error = xfs_rename_alloc_whiteout(mnt_userns, target_dp, &wip);
++>>>>>>> e445976537ad (xfs: remove incorrect ASSERT in xfs_rename)

We can resolve this by removing mnt_userns from the argument.

This ASSERT in xfs_rename is a) incorrect, because (RENAME_WHITEOUT|RENAME_NOREPLACE) is a valid combination, and
b) unnecessary, because actual invalid flag combinations are already handled at the vfs level in do_renameat2() before we get called. So, remove it.

Fixes 7dcf5c3e4527 ("xfs: add RENAME_WHITEOUT support")
Quoted 3 lines

---
I confirmed this can be applied cleanly on the latest 4.9 - 5.10 stable branch, but if there is any problem, please let me know.

LGTM

--D

Quoted 19 lines
---
 fs/xfs/xfs_inode.c | 1 -
 1 file changed, 1 deletion(-)
fs/xfs/xfs_inode.c +0 -1
index e958b1c74561..03497741aef7 100644
@@ -3170,7 +3170,6 @@ xfs_rename(
 	 * appropriately.
 	 */
 	if (flags & RENAME_WHITEOUT) {
-		ASSERT(!(flags & (RENAME_NOREPLACE | RENAME_EXCHANGE)));
 		error = xfs_rename_alloc_whiteout(target_dp, &wip);
 		if (error)
 			return error;
Signature · 1 line
2.30.2