-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Automount fails when accessing snapshots for root filesystem #9381
Comments
@janlam7 thank you for reporting this. Would it be possible for you to verify this small patch resolves the issue? Unfortunately, I don't have a test system handy which uses ZFS for the root filesystem. diff --git a/module/os/linux/zfs/zfs_ctldir.c b/module/os/linux/zfs/zfs_ctldir.c
index 1e61ef0..3b2a6eb 100644
--- a/module/os/linux/zfs/zfs_ctldir.c
+++ b/module/os/linux/zfs/zfs_ctldir.c
@@ -1053,7 +1053,8 @@ zfsctl_snapshot_mount(struct path *path, int flags)
* on mount.zfs(8).
*/
snprintf(full_path, MAXPATHLEN, "%s/.zfs/snapshot/%s",
- zfsvfs->z_vfs->vfs_mntpoint, dname(dentry));
+ zfsvfs->z_vfs->vfs_mntpoint ? zfsvfs->z_vfs->vfs_mntpoint : "",
+ dname(dentry));
/*
* Multiple concurrent automounts of a snapshot are never allowed. |
@behlendorf I ended up applying the patch below, and indeed it solves the issue, nice! I changed the paths to match the 0.8-release branch.
|
Commit 093bb64 resolved an automount failures for chroot'd processes but inadvertently broke automounting for root filesystems where the vfs_mntpoint is NULL. Resolve the issue by checking for NULL in order to generate the correct path. Signed-off-by: Brian Behlendorf <[email protected]> Issue openzfs#9381
The above patch does not seem to be enough for me. Even with it applied to zfs-0.8.2, snapshots under
|
I use initramfs created by dracut and openrc on the Funtoo distribution. |
This issue got me as well. I too am using an initrd (though a homegrown one and not dracut). I can mount a snapshot with the following mount -t zfs pool/root@snap /mnt but the snapshot files under /.zfs/snapshots are all empty. |
Running Devuan Ascii. Patch worked fine against Debian's 0.8.2-3. |
@Ryushin do you use initramfs? |
Yes, I use Sysvinit and initramfs. I also tested on a Debian Buster system with sysvinit and initramfs as well. So it worked on both Devuan and Debian. |
Seems I spoke too soon. Looks like I found a different kind of bug related to this. I've applied the patch listed above. My rpool looks like this: I can see inside snapshots for rpool/ROOT: Looking inside snapshots for any other dataset in rpool results in "Too many levels of symbolic links" error: |
Commit 093bb64 resolved an automount failures for chroot'd processes but inadvertently broke automounting for root filesystems where the vfs_mntpoint is NULL. Resolve the issue by checking for NULL in order to generate the correct path. Reviewed-by: Tom Caputi <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes openzfs#9381 Closes openzfs#9384
Commit 093bb64 resolved an automount failures for chroot'd processes but inadvertently broke automounting for root filesystems where the vfs_mntpoint is NULL. Resolve the issue by checking for NULL in order to generate the correct path. Reviewed-by: Tom Caputi <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes openzfs#9381 Closes openzfs#9384
Commit 093bb64 resolved an automount failures for chroot'd processes but inadvertently broke automounting for root filesystems where the vfs_mntpoint is NULL. Resolve the issue by checking for NULL in order to generate the correct path. Reviewed-by: Tom Caputi <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #9381 Closes #9384
* Now supports zfs versions that have the snapshot automount bug (openzfs/zfs#9381), as well as filesystems that are not mounted or have legacy mountpoints. * The recursive snapshot feature handles (skips) child objects that are not filesystems (but e.g. zvols). * We always leave the last successfully backed up snapshot (if any) intact, not the last snapshot as before. * No longer confused if the snapshot we're trying to create already exists (append numeric suffix to name). * Now supports recursive snapshots/backups of overlapping trees. * Share more code between recursive and nonrecursive snapshot case. * Switch to shared logging functions.
System information
Describe the problem you're observing
After upgrading from zfs-0.8.1 to zfs-0.8.2 the snapshots under the root filesystem do not automount anymore. I have my root on zfs. Snapshots below other filesystems automount normally.
The snapshots can be mounted manually, so I have a workaround.
Describe how to reproduce the problem
Include any warning/errors/backtraces from the system logs
I bisected it to commit 093bb64 in which case the following warning is logged in dmesg
The text was updated successfully, but these errors were encountered: