On Fri, 21 Apr 2023, Al Viro wrote: > On Tue, Apr 18, 2023 at 07:26:34AM +1000, NeilBrown wrote: > > > MNT_FORCE is, I think, a good idea and a needed functionality that has > > never been implemented well. > > MNT_FORCE causes nfs_umount_begin to be called as you noted, which > > aborts all pending RPCs on that filesystem. > > Suppose it happens to be mounted in another namespace as well. Or bound > at different mountpoint, for that matter. What should MNT_FORCE do? > 1/ set a "forced-unmount" flag on the vfs_mount which causes any syscall that uses the vfsmount (whether from an fd, or found in a path walk, or elsewhere), except for close(), to abort with an error; 2/ call ->umount_begin passing in the vfs_mount. The fs can abort any outstanding transaction on any fd from that vfs_mount. Possibly it might instead abort a wait rather than the whole transaction, particularly if requests using some other vfs_mount might also be interested in the transaction 3/ ->close() on a force-unmount vfs_mount would clean up without blocking indefinitely, discarding dirty data if necessary. This still depends on the application to close all fds that return errors (and to chdir out of a problematic directory). But at least it *allows* applications to do that without requiring that they be killed. Thanks, NeilBrown