mirror of
https://github.com/nilfs-dev/nilfs-utils.git
synced 2026-01-26 13:43:15 +00:00
mount.nilfs2: fix broken overlapping rw-mount protection
The check for overlapping rw-mounts in nilfs_prepare_mount() detects the condition and prints an error message, but fails to stop the mount process. This occurs because the return variable 'res' remains 0 (success) when jumping to the failure label. Consequently, the mount succeeds illegally, leading to a state where umount fails with -EBUSY (due to unhandled garbage collector shutdown), forcing manual process termination. Fix this by setting 'res' to -EBUSY. While any negative value would abort the mount, -EBUSY is chosen to accurately reflect the cause and align with libmount's error reporting granularity. Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
This commit is contained in:
parent
d0e8cc2caf
commit
53a23b7069
@ -334,6 +334,7 @@ static int nilfs_prepare_mount(struct nilfs_mount_info *mi)
|
||||
error(_("%s: the device already has a rw-mount on %s.\n"
|
||||
"\t\tmultiple rw-mount is not allowed."),
|
||||
progname, mnt_fs_get_target(fs));
|
||||
res = -EBUSY;
|
||||
goto failed;
|
||||
case MS_RDONLY: /* ro-mount (a rw-mount exists) */
|
||||
break;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user