-
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
Relatime is always turned on temporarily on ZFS root. #7947
Comments
This comment has been minimized.
This comment has been minimized.
I can reproduce this on Ubuntu 18.04 too. Unless we have some universal fix, I think the initramfs script should work around this. |
man zpool states:
what's happening is
The mount options are set according to its properties isn't happening as advertised when mounting using mount(8). Also
Which means also
as stated in man zfs isn't enforced (which it should, at least that's what I expect when reading that sentence). |
FWIW, I've seen this on gentoo as well. I had hacked around it with a local.d script and I don't remember what turns relatime on.
|
I believe the summary for your issue is: it doesn't matter. If atime is off, relatime has no meaning, because it is also off. |
@kpande You are right. It acts as relatime=on. Confirmed on Ubuntu 18.04 rpool exhibiting the relatime temporary issue. Of course it returned to noatime after issuing "mount -o remount -o noatime /" |
Basically, we need to revive #7948, support the other mount options, and extend that to the initramfs. |
I confirm the issue on Void Linux. I used the workaround suggested by @bunder2015 : I added to
|
i submitted a fix but no one wanted it: index 23c07af9e86..9bf80e14599 100755
--- a/contrib/dracut/90zfs/zfs-lib.sh.in
+++ b/contrib/dracut/90zfs/zfs-lib.sh.in
@@ -74,14 +74,22 @@ import_pool() {
# mount_dataset DATASET
# mounts the given zfs dataset.
mount_dataset() {
- dataset="${1}"
+ dataset="${1}"
mountpoint="$(zfs get -H -o value mountpoint "${dataset}")"
-
+ mountopts="strictatime"
+ ATIME_OPTION=$(zfs get -H -o value -s default,local,inherited atime ${dataset})
+ if [ "${ATIME_OPTION}" = "off" ]; then
+ mountopts="noatime"
+ fi
+ RELATIME_OPTION=$(zfs get -H -o value -s default,local,inherited relatime ${dataset})
+ if [ "${RELATIME_OPTION}" = "on" ]; then
+ mountopts="relatime"
+ fi
# We need zfsutil for non-legacy mounts and not for legacy mounts.
if [ "${mountpoint}" = "legacy" ] ; then
- mount -t zfs "${dataset}" "${NEWROOT}"
+ mount -t zfs -o ${mountopts} "${dataset}" "${NEWROOT}"
else
- mount -o zfsutil -t zfs "${dataset}" "${NEWROOT}"
+ mount -o zfsutil -t zfs -o ${mountopts} "${dataset}" "${NEWROOT}"
fi
return $? correction: it was viewed as a good idea, but people asked for waaaayyyy too many out-of-scope changes, so I withdrew the PR and said anyone could take the work up who wanted / needed it fixed. I've been maintaining my own local patch for this purpose. |
@rlaager assigned it to himself and then did nothing with it, must have forgotten. |
That patch looks reasonable.
This is probably what you meant by the change requests? |
yep. i just wanted to fix one issue and everyone suggested changes that were well outside of both what i wanted to fix and what i was able to test. i've rewritten my patch for master: diff --git a/contrib/dracut/90zfs/zfs-lib.sh.in b/contrib/dracut/90zfs/zfs-lib.sh.in
index defc0bfc8..2e09559d7 100755
--- a/contrib/dracut/90zfs/zfs-lib.sh.in
+++ b/contrib/dracut/90zfs/zfs-lib.sh.in
@@ -76,19 +76,26 @@ _mount_dataset_cb() {
# mount_dataset DATASET
# mounts the given zfs dataset.
mount_dataset() {
+ ret=0
dataset="${1}"
mountpoint="$(zfs get -H -o value mountpoint "${dataset}")"
- ret=0
-
+ mountopts="strictatime"
+ ATIME_OPTION=$(zfs get -H -o value -s default,local,inherited atime ${dataset})
+ if [ "${ATIME_OPTION}" = "off" ]; then
+ mountopts="noatime"
+ fi
+ RELATIME_OPTION=$(zfs get -H -o value -s default,local,inherited relatime ${dataset})
+ if [ "${RELATIME_OPTION}" = "on" ]; then
+ mountopts="relatime"
+ fi
# We need zfsutil for non-legacy mounts and not for legacy mounts.
if [ "${mountpoint}" = "legacy" ] ; then
- mount -t zfs "${dataset}" "${NEWROOT}" || ret=$?
+ mount -t zfs -o ${mountopts} "${dataset}" "${NEWROOT}" || ret=$?
else
- mount -o zfsutil -t zfs "${dataset}" "${NEWROOT}" || ret=$?
-
- if [ "$ret" = "0" ]; then
- for_relevant_root_children "${dataset}" _mount_dataset_cb || ret=$?
- fi
+ mount -o zfsutil -t zfs -o ${mountopts} "${dataset}" "${NEWROOT}" || ret=$?
+ fi
+ if [ "$ret" = "0" ]; then
+ for_relevant_root_children "${dataset}" _mount_dataset_cb || ret=$?
fi
return ${ret}
|
it's been 3 years so I don't know why I used the |
Why injecting here strictatime? It could overwrite the default mount options coming from the ZFS driver.
Why
|
@rlaager I slept on this issue and decided to run few experiments. Looks like this issue is not strictly connected to initrd, boot process or root-on-ZFS. This is a problem in System
Results
Test script
|
If you use the low level interface to mount, then you have to handle converting the properties into mount options yourself. That’s not a bug. Ordinary mounting by users should be done using |
Richard, I agree that zfs/contrib/initramfs/scripts/zfs Lines 925 to 934 in 4b87c19
(initramfs and dracut share their fate). That behavior makes us use mount -t zfs -o zfsutil to circumvent the mountpoint propagation.
Is it really true that we need to use EDIT EDIT2 |
@szubersk I don't really know much about all the low-level mount stuff. |
@rlaager Would you mind suggesting a project Member who could help evaluating this? Should I create a pull request to start the discussion? |
@szubersk Yeah, a PR would be a good way to go. |
Is there any progress on this? Fresh installation of Void Linux, and the same problem again. |
yeah, every time someone makes a suggested change, a few others come along to say it needs a huge number of unrelated changes. and those people are never the ones who are going to do that work. I've opened two PRs for this one and both times someone else asks for changes and we can currently blame @rlaager (or yourself, you didn't do much with the patch I proposed here) |
@bghira Would you mind sharing the PR you mentioned were rejected? I'm very interested in fixing this once and for all, I'm tired to rebasing local patches each time initramfs is updated. |
Using `zfs_mount_at()` gives opportunity to properly propagate mountopts from what's stored in a pool to the `mount(2)` syscall invocation. It fixes cases when mount options are set to incorrect values and rectification is impossible (e. g. Linux initrd boot sequence in #7947). Moved debug information printing after all variables are initialized - printed text reflects what is passed to `mount(2)`. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: szubersk <szuberskidamian@gmail.com> Issue #7947 Closes #13021
@rlaager, @bghira, @quicktrick and others in this thread please check if #13021 (the most recent master) fixed the issue for you. I hope we did not leave any loose ends. |
Using `zfs_mount_at()` gives opportunity to properly propagate mountopts from what's stored in a pool to the `mount(2)` syscall invocation. It fixes cases when mount options are set to incorrect values and rectification is impossible (e. g. Linux initrd boot sequence in openzfs#7947). Moved debug information printing after all variables are initialized - printed text reflects what is passed to `mount(2)`. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: szubersk <szuberskidamian@gmail.com> Issue openzfs#7947 Closes openzfs#13021
Using `zfs_mount_at()` gives opportunity to properly propagate mountopts from what's stored in a pool to the `mount(2)` syscall invocation. It fixes cases when mount options are set to incorrect values and rectification is impossible (e. g. Linux initrd boot sequence in openzfs#7947). Moved debug information printing after all variables are initialized - printed text reflects what is passed to `mount(2)`. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: szubersk <szuberskidamian@gmail.com> Issue openzfs#7947 Closes openzfs#13021
Using `zfs_mount_at()` gives opportunity to properly propagate mountopts from what's stored in a pool to the `mount(2)` syscall invocation. It fixes cases when mount options are set to incorrect values and rectification is impossible (e. g. Linux initrd boot sequence in openzfs#7947). Moved debug information printing after all variables are initialized - printed text reflects what is passed to `mount(2)`. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: szubersk <szuberskidamian@gmail.com> Issue openzfs#7947 Closes openzfs#13021
Closing, as mentioned above this should be resolved in the master branch. |
Using `zfs_mount_at()` gives opportunity to properly propagate mountopts from what's stored in a pool to the `mount(2)` syscall invocation. It fixes cases when mount options are set to incorrect values and rectification is impossible (e. g. Linux initrd boot sequence in openzfs#7947). Moved debug information printing after all variables are initialized - printed text reflects what is passed to `mount(2)`. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: szubersk <szuberskidamian@gmail.com> Issue openzfs#7947 Closes openzfs#13021
Using `zfs_mount_at()` gives opportunity to properly propagate mountopts from what's stored in a pool to the `mount(2)` syscall invocation. It fixes cases when mount options are set to incorrect values and rectification is impossible (e. g. Linux initrd boot sequence in openzfs#7947). Moved debug information printing after all variables are initialized - printed text reflects what is passed to `mount(2)`. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: szubersk <szuberskidamian@gmail.com> Issue openzfs#7947 Closes openzfs#13021
Using `zfs_mount_at()` gives opportunity to properly propagate mountopts from what's stored in a pool to the `mount(2)` syscall invocation. It fixes cases when mount options are set to incorrect values and rectification is impossible (e. g. Linux initrd boot sequence in openzfs#7947). Moved debug information printing after all variables are initialized - printed text reflects what is passed to `mount(2)`. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: szubersk <szuberskidamian@gmail.com> Issue openzfs#7947 Closes openzfs#13021
Using `zfs_mount_at()` gives opportunity to properly propagate mountopts from what's stored in a pool to the `mount(2)` syscall invocation. It fixes cases when mount options are set to incorrect values and rectification is impossible (e. g. Linux initrd boot sequence in openzfs#7947). Moved debug information printing after all variables are initialized - printed text reflects what is passed to `mount(2)`. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: szubersk <szuberskidamian@gmail.com> Issue openzfs#7947 Closes openzfs#13021
Using `zfs_mount_at()` gives opportunity to properly propagate mountopts from what's stored in a pool to the `mount(2)` syscall invocation. It fixes cases when mount options are set to incorrect values and rectification is impossible (e. g. Linux initrd boot sequence in openzfs#7947). Moved debug information printing after all variables are initialized - printed text reflects what is passed to `mount(2)`. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: szubersk <szuberskidamian@gmail.com> Issue openzfs#7947 Closes openzfs#13021
Commit 329e2ff has made mount.zfs(8) to call libzfs function 'zfs_mount_at', in order to propagate dataset properties into mount options. This fix however, is limited to a special use case where mount.zfs(8) is used in initrd with option '-o zfsutil'. If either initrd or the user need to use mount.zfs(8) to mount a file system with 'mountpoint' set to 'legacy', '-o zfsutil' can't be used and the original issue openzfs#7947 will still happen. Since the existing code already excluded the possibility of calling 'zfs_mount_at' when it was invoked as a helper program from zfs(8), by checking 'ZFS_MOUNT_HELPER' environment variable, it makes no sense to avoid calling 'zfs_mount_at' without '-o zfsutil'. Signed-off-by: WHR <whr@rivoreo.one>
Commit 329e2ff has made mount.zfs(8) to call libzfs function 'zfs_mount_at', in order to propagate dataset properties into mount options. This fix however, is limited to a special use case where mount.zfs(8) is used in initrd with option '-o zfsutil'. If either initrd or the user need to use mount.zfs(8) to mount a file system with 'mountpoint' set to 'legacy', '-o zfsutil' can't be used and the original issue openzfs#7947 will still happen. Since the existing code already excluded the possibility of calling 'zfs_mount_at' when it was invoked as a helper program from zfs(8), by checking 'ZFS_MOUNT_HELPER' environment variable, it makes no sense to avoid calling 'zfs_mount_at' without '-o zfsutil'. Signed-off-by: WHR <whr@rivoreo.one>
Commit 329e2ff has made mount.zfs(8) to call libzfs function 'zfs_mount_at', in order to propagate dataset properties into mount options. This fix however, is limited to a special use case where mount.zfs(8) is used in initrd with option '-o zfsutil'. If either initrd or the user need to use mount.zfs(8) to mount a file system with 'mountpoint' set to 'legacy', '-o zfsutil' can't be used and the original issue openzfs#7947 will still happen. Since the existing code already excluded the possibility of calling 'zfs_mount_at' when it was invoked as a helper program from zfs(8), by checking 'ZFS_MOUNT_HELPER' environment variable, it makes no sense to avoid calling 'zfs_mount_at' without '-o zfsutil'. An exception however, is when mount.zfs(8) was invoked with '-o remount' to update the mount options for an existing mount point. In this case call mount(2) directly without modifying the mount options passed from command line. Signed-off-by: WHR <whr@rivoreo.one>
Commit 329e2ff has made mount.zfs(8) to call libzfs function 'zfs_mount_at', in order to propagate dataset properties into mount options. This fix however, is limited to a special use case where mount.zfs(8) is used in initrd with option '-o zfsutil'. If either initrd or the user need to use mount.zfs(8) to mount a file system with 'mountpoint' set to 'legacy', '-o zfsutil' can't be used and the original issue #7947 will still happen. Since the existing code already excluded the possibility of calling 'zfs_mount_at' when it was invoked as a helper program from zfs(8), by checking 'ZFS_MOUNT_HELPER' environment variable, it makes no sense to avoid calling 'zfs_mount_at' without '-o zfsutil'. An exception however, is when mount.zfs(8) was invoked with '-o remount' to update the mount options for an existing mount point. In this case call mount(2) directly without modifying the mount options passed from command line. Furthermore, don't run mount.zfs(8) helper for automounting snapshot. The above change to make mount.zfs(8) to call 'zfs_mount_at' apparently caused it to trigger an automount for the snapshot directory. When the helper was invoked as a result of a snapshot automount, an infinite recursion will occur. Since the need of invoking user mode mount(8) for automounting was to overcome that the 'vfs_kern_mount' being GPL-only, just run mount(8) without the mount.zfs(8) helper by adding option '-i'. Reviewed-by: Umer Saleem <usaleem@ixsystems.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: WHR <whr@rivoreo.one> Closes #16393
Commit 329e2ff has made mount.zfs(8) to call libzfs function 'zfs_mount_at', in order to propagate dataset properties into mount options. This fix however, is limited to a special use case where mount.zfs(8) is used in initrd with option '-o zfsutil'. If either initrd or the user need to use mount.zfs(8) to mount a file system with 'mountpoint' set to 'legacy', '-o zfsutil' can't be used and the original issue openzfs#7947 will still happen. Since the existing code already excluded the possibility of calling 'zfs_mount_at' when it was invoked as a helper program from zfs(8), by checking 'ZFS_MOUNT_HELPER' environment variable, it makes no sense to avoid calling 'zfs_mount_at' without '-o zfsutil'. An exception however, is when mount.zfs(8) was invoked with '-o remount' to update the mount options for an existing mount point. In this case call mount(2) directly without modifying the mount options passed from command line. Furthermore, don't run mount.zfs(8) helper for automounting snapshot. The above change to make mount.zfs(8) to call 'zfs_mount_at' apparently caused it to trigger an automount for the snapshot directory. When the helper was invoked as a result of a snapshot automount, an infinite recursion will occur. Since the need of invoking user mode mount(8) for automounting was to overcome that the 'vfs_kern_mount' being GPL-only, just run mount(8) without the mount.zfs(8) helper by adding option '-i'. Reviewed-by: Umer Saleem <usaleem@ixsystems.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: WHR <whr@rivoreo.one> Closes openzfs#16393
Commit 329e2ff has made mount.zfs(8) to call libzfs function 'zfs_mount_at', in order to propagate dataset properties into mount options. This fix however, is limited to a special use case where mount.zfs(8) is used in initrd with option '-o zfsutil'. If either initrd or the user need to use mount.zfs(8) to mount a file system with 'mountpoint' set to 'legacy', '-o zfsutil' can't be used and the original issue openzfs#7947 will still happen. Since the existing code already excluded the possibility of calling 'zfs_mount_at' when it was invoked as a helper program from zfs(8), by checking 'ZFS_MOUNT_HELPER' environment variable, it makes no sense to avoid calling 'zfs_mount_at' without '-o zfsutil'. An exception however, is when mount.zfs(8) was invoked with '-o remount' to update the mount options for an existing mount point. In this case call mount(2) directly without modifying the mount options passed from command line. Furthermore, don't run mount.zfs(8) helper for automounting snapshot. The above change to make mount.zfs(8) to call 'zfs_mount_at' apparently caused it to trigger an automount for the snapshot directory. When the helper was invoked as a result of a snapshot automount, an infinite recursion will occur. Since the need of invoking user mode mount(8) for automounting was to overcome that the 'vfs_kern_mount' being GPL-only, just run mount(8) without the mount.zfs(8) helper by adding option '-i'. Reviewed-by: Umer Saleem <usaleem@ixsystems.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: WHR <whr@rivoreo.one> Closes openzfs#16393
System information
Describe the problem you're observing
I want to apply noatime to every single mount, but
/
is resisting my will.Describe how to reproduce the problem
Install root on a dataset, and set
bootfs
to that dataset. grub-mkconfig will take care of the rest.The text was updated successfully, but these errors were encountered: