Date: Sun, 05 May 2019 19:18:52 +0000 From: bugzilla-noreply@freebsd.org To: fs@FreeBSD.org Subject: [Bug 237397] 'zfs mount -a' mounts filesystems in incorrect order Message-ID: <bug-237397-3630-vYMoEc935z@https.bugs.freebsd.org/bugzilla/> In-Reply-To: <bug-237397-3630@https.bugs.freebsd.org/bugzilla/> References: <bug-237397-3630@https.bugs.freebsd.org/bugzilla/>
next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D237397 --- Comment #3 from Jim Long <freebsd-bugzilla@umpquanet.com> --- Created attachment 204229 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D204229&action= =3Dedit truss output of 'zfs mount -a' showing incorrect mounting behaviour Another view of the behaviour: System running on ZFS: FreeBSD electron 12.0-STABLE FreeBSD 12.0-STABLE r346293 GENERIC amd64 # zfs mount electron/system/ROOT/default / electron/system/var /var electron/system/home /home electron/system/usr /usr electron/system/tmp /tmp electron/system/usr/local /usr/local Of the entire set of mountable filesystems (canmount !=3D off and mountpoin= t !=3D none), there are three filesystems not yet mounted. Those three mountpoints are /data, /data/backup, and /data/backup/jimsdesk: # zfs list -o canmount,mounted,mountpoint,name | egrep -vw '^[[:blank:]]*of= f' CANMOUNT MOUNTED MOUNTPOINT NAME on no none electron on no /data electron/data on no /data/backup electron/data/backup on no /data/backup/jimsdesk electron/data/backup/jimsdesk on no none electron/system on no none electron/system/ROOT on yes / electron/system/ROOT/default on yes /home electron/system/home on yes /tmp electron/system/tmp on yes /usr electron/system/usr on yes /usr/local electron/system/usr/local on yes /var electron/system/var Mountpoint /data does not exist in /: # find /data -ls | wc -l find: /data: No such file or directory 0 After manually mounting electron/data, /data is created, filesystem content appears, including an empty mountpoint directory for the next filesystem, electron/data/backup: # zfs mount electron/data # find /data | wc -l 8 # find /data/backup -ls 8 1 drwxr-xr-x 2 root wheel 2 May 3 12:55 /data/backup After mounting electron/data/backup, filesystem content is present under the mountpoint /data/backup, including an empty mountpoint directory for the ne= xt filesystem, electron/data/backup/jimsdesk: # find /data/backup | head -3000000 | wc -l 3000000 # find /data/backup/jimsdesk -ls=20 7904435 1 drwxr-xr-x 2 root wheel 2 Mar 5 16:48 /data/backup/jimsdesk After mounting electron/data/backup/jimsdesk, that filesystem content also appears under /data/backup/jimsdesk: # zfs mount electron/data/backup/jimsdesk # find /data/backup/jimsdesk | head -3000000 | wc -l 1481437 That's all excellent. Manual mounting works. Let's clean up: # zfs umount /data/backup/jimsdesk # find /data/backup/jimsdesk -ls 7904435 1 drwxr-xr-x 2 root wheel 2 Mar 5 16:48 /data/backup/jimsdesk # zfs umount /data/backup # find /data/backup -ls 8 1 drwxr-xr-x 2 root wheel 2 May 3 12:55 /data/backup # zfs umount /data=20 # find /data -ls 1488 1 drwxr-xr-x 2 root wheel 2 May 3 13:21 /data # rmdir /data # find /data -ls find: /data: No such file or directory Now we're back to our original mount state: everything mounted except /data /data/backup and /data/backup/jimsdesk: # zfs list -o canmount,mounted,mountpoint,name | egrep -vw '^[[:blank:]]*of= f' CANMOUNT MOUNTED MOUNTPOINT NAME on no none electron on no /data electron/data on no /data/backup electron/data/backup on no /data/backup/jimsdesk electron/data/backup/jimsdesk on no none electron/system on no none electron/system/ROOT on yes / electron/system/ROOT/default on yes /home electron/system/home on yes /tmp electron/system/tmp on yes /usr electron/system/usr on yes /usr/local electron/system/usr/local on yes /var electron/system/var Now let's 'truss zfs mount -a'. Instead of inlining all the output, it's attached. # truss zfs mount -a > truss-zfs-mount-a.out 2>&1 # egrep 'mount|mkdir' truss-zfs-mount-a.out=20 mkdir("/data/backup",0755) ERR#2 'No such file or directory' mkdir("/data",0755) =3D 0 (0x0) mkdir("/data/backup",0755) =3D 0 (0x0) nmount(0x801653000,8,0x0) =3D 0 (0x0) mkdir("/data",0755) ERR#17 'File exists' cannot mount '/data': failed to create mountpoint write(2,"cannot mount '/data': failed to "...,50) =3D 50 (0x32) nmount(0x801672000,8,0x0) =3D 0 (0x0) After 'zfs mount -a' only two of the expected three filesystems are mounted: electron : 13:35:05 /root# zfs list -o canmount,mounted,mountpoint,name | e= grep -vw '^[[:blank:]]*off' CANMOUNT MOUNTED MOUNTPOINT NAME on no none electron on no /data electron/data on yes /data/backup electron/data/backup on yes /data/backup/jimsdesk electron/data/backup/jimsdesk on no none electron/system on no none electron/system/ROOT on yes / electron/system/ROOT/default on yes /home electron/system/home on yes /tmp electron/system/tmp on yes /usr electron/system/usr on yes /usr/local electron/system/usr/local on yes /var electron/system/var electron/data is still not mounted, as per the 'cannot mount ...' error from 'zfs mount -a'. The truss output also shows that zfs was confused about the order in which to create mountpoints, and attempted to create the second-ti= er mountpoint (/data/backup) before creating the first-tier mountpoint (/data). The truss output file is attached to this PR. So, although the mode of failure varies a little, I hope that this truss fi= le will be sufficient for someone to look at and diagnose that 'zfs mount -a' = is not doing things correctly. Let me know if I can provide additional info. Thank you! Jim --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-237397-3630-vYMoEc935z>