potential race between zfs_suspend_fs+zfs_resume_fs and zfs_ioc_rename
If a filesystem is not unmounted while the rename is being performed, then, for example, a concurrect zfs rollback may call
zfs_suspend_fs followed by
zfs_resume_fs on the same filesystem.
The latter takes the filesystem's name as an argument. If the filesystem name changes as a result of the rename, then
dmu_objset_hold(osname, zfsvfs, &os) call in
zfs_resume_fs would fail resulting in a kernel panic.
So far I have been able to reproduce this problem on FreeBSD where
zfs rename has
-u option that skips the unmounting before doing the renaming.
But I think that in theory the same problem can occur on illumos as well, because the unmounting is done in userland before invoking the rename ioctl and there could be a race with, e.g., zfs mount.
panic: solaris assert: dmu_objset_hold(osname, zfsvfs, &zfsvfs->z_os) == 0 (0x2 == 0x0), file: /usr/devel/svn/head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c, line: 2210 KDB: stack backtrace: db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe004df30710 vpanic() at vpanic+0x182/frame 0xfffffe004df30790 panic() at panic+0x43/frame 0xfffffe004df307f0 assfail3() at assfail3+0x2c/frame 0xfffffe004df30810 zfs_resume_fs() at zfs_resume_fs+0xb9/frame 0xfffffe004df30860 zfs_ioc_rollback() at zfs_ioc_rollback+0x61/frame 0xfffffe004df308a0 zfsdev_ioctl() at zfsdev_ioctl+0x65c/frame 0xfffffe004df30940 devfs_ioctl_f() at devfs_ioctl_f+0x156/frame 0xfffffe004df309a0 kern_ioctl() at kern_ioctl+0x246/frame 0xfffffe004df30a00 sys_ioctl() at sys_ioctl+0x171/frame 0xfffffe004df30ae0 amd64_syscall() at amd64_syscall+0x2db/frame 0xfffffe004df30bf0 Xfast_syscall() at Xfast_syscall+0xfb/frame 0xfffffe004df30bf0
Updated by Electric Monk almost 3 years ago
- % Done changed from 0 to 100
- Status changed from New to Closed
commit 690041b9caf801816f2d0bac90bc7cecefb73523 Author: Andriy Gapon <firstname.lastname@example.org> Date: 2016-11-21T17:26:46.000Z 7180 potential race between zfs_suspend_fs+zfs_resume_fs and zfs_ioc_rename Reviewed by: Matt Ahrens <email@example.com> Reviewed by: Pavel Zakharov <firstname.lastname@example.org> Approved by: Richard Lowe <email@example.com>