Skip to content

Commit d1c56bf

Browse files
committed
tests: fix idmapped mount_setattr test
The test treated zero as a successful run when it really should treat non-zero as a successful run. A mount's idmapping can't change once it has been attached to the filesystem. Link: https://lore.kernel.org/r/20220203131411.3093040-2-brauner@kernel.org Fixes: 01eadc8 ("tests: add mount_setattr() selftests") Cc: Seth Forshee <seth.forshee@digitalocean.com> Cc: Christoph Hellwig <hch@lst.de> Cc: linux-fsdevel@vger.kernel.org Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Christian Brauner <brauner@kernel.org>
1 parent 26291c5 commit d1c56bf

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

tools/testing/selftests/mount_setattr/mount_setattr_test.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1236,7 +1236,7 @@ static int get_userns_fd(unsigned long nsid, unsigned long hostid, unsigned long
12361236
}
12371237

12381238
/**
1239-
* Validate that an attached mount in our mount namespace can be idmapped.
1239+
* Validate that an attached mount in our mount namespace cannot be idmapped.
12401240
* (The kernel enforces that the mount's mount namespace and the caller's mount
12411241
* namespace match.)
12421242
*/
@@ -1259,7 +1259,7 @@ TEST_F(mount_setattr_idmapped, attached_mount_inside_current_mount_namespace)
12591259

12601260
attr.userns_fd = get_userns_fd(0, 10000, 10000);
12611261
ASSERT_GE(attr.userns_fd, 0);
1262-
ASSERT_EQ(sys_mount_setattr(open_tree_fd, "", AT_EMPTY_PATH, &attr, sizeof(attr)), 0);
1262+
ASSERT_NE(sys_mount_setattr(open_tree_fd, "", AT_EMPTY_PATH, &attr, sizeof(attr)), 0);
12631263
ASSERT_EQ(close(attr.userns_fd), 0);
12641264
ASSERT_EQ(close(open_tree_fd), 0);
12651265
}

0 commit comments

Comments
 (0)