Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'fs.mount_setattr.v5.17-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux

Pull mount_setattr test/doc fixes from Christian Brauner:
"This contains a fix for one of the selftests for the mount_setattr
syscall to create idmapped mounts, an entry for idmapped mounts for
maintainers, and missing kernel documentation for the helper we split
out some time ago to get and yield write access to a mount when
changing mount properties"

* tag 'fs.mount_setattr.v5.17-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux:
fs: add kernel doc for mnt_{hold,unhold}_writers()
MAINTAINERS: add entry for idmapped mounts
tests: fix idmapped mount_setattr test

+41 -2
+9
MAINTAINERS
··· 9263 9263 W: https://github.com/o2genum/ideapad-slidebar 9264 9264 F: drivers/input/misc/ideapad_slidebar.c 9265 9265 9266 + IDMAPPED MOUNTS 9267 + M: Christian Brauner <brauner@kernel.org> 9268 + L: linux-fsdevel@vger.kernel.org 9269 + S: Maintained 9270 + T: git git://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux.git 9271 + F: Documentation/filesystems/idmappings.rst 9272 + F: tools/testing/selftests/mount_setattr/ 9273 + F: include/linux/mnt_idmapping.h 9274 + 9266 9275 IDT VersaClock 5 CLOCK DRIVER 9267 9276 M: Luca Ceresoli <luca@lucaceresoli.net> 9268 9277 S: Maintained
+30
fs/namespace.c
··· 469 469 } 470 470 EXPORT_SYMBOL(mnt_drop_write_file); 471 471 472 + /** 473 + * mnt_hold_writers - prevent write access to the given mount 474 + * @mnt: mnt to prevent write access to 475 + * 476 + * Prevents write access to @mnt if there are no active writers for @mnt. 477 + * This function needs to be called and return successfully before changing 478 + * properties of @mnt that need to remain stable for callers with write access 479 + * to @mnt. 480 + * 481 + * After this functions has been called successfully callers must pair it with 482 + * a call to mnt_unhold_writers() in order to stop preventing write access to 483 + * @mnt. 484 + * 485 + * Context: This function expects lock_mount_hash() to be held serializing 486 + * setting MNT_WRITE_HOLD. 487 + * Return: On success 0 is returned. 488 + * On error, -EBUSY is returned. 489 + */ 472 490 static inline int mnt_hold_writers(struct mount *mnt) 473 491 { 474 492 mnt->mnt.mnt_flags |= MNT_WRITE_HOLD; ··· 518 500 return 0; 519 501 } 520 502 503 + /** 504 + * mnt_unhold_writers - stop preventing write access to the given mount 505 + * @mnt: mnt to stop preventing write access to 506 + * 507 + * Stop preventing write access to @mnt allowing callers to gain write access 508 + * to @mnt again. 509 + * 510 + * This function can only be called after a successful call to 511 + * mnt_hold_writers(). 512 + * 513 + * Context: This function expects lock_mount_hash() to be held. 514 + */ 521 515 static inline void mnt_unhold_writers(struct mount *mnt) 522 516 { 523 517 /*
+2 -2
tools/testing/selftests/mount_setattr/mount_setattr_test.c
··· 1236 1236 } 1237 1237 1238 1238 /** 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. 1240 1240 * (The kernel enforces that the mount's mount namespace and the caller's mount 1241 1241 * namespace match.) 1242 1242 */ ··· 1259 1259 1260 1260 attr.userns_fd = get_userns_fd(0, 10000, 10000); 1261 1261 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); 1263 1263 ASSERT_EQ(close(attr.userns_fd), 0); 1264 1264 ASSERT_EQ(close(open_tree_fd), 0); 1265 1265 }