-
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
Change /etc/mtab to /proc/self/mounts #5029
Conversation
Could you please shed me some light on why the zfstests failed on all tests ? Additionally, any idea why script "zfs_003_neg.ksh" have to rename /dev/zfs and /etc/mnttab prior to run the ZFS cmds ? I'll need to workaround/fix this as well as it try to rename /proc/self/mounts now: But I don't think it's the reason why the zfstest (/sbin/zfs list) failed though: Eric |
That test is making sure that zfs fails if /dev/zfs or /etc/mtab is missing. Your changes made zfs succeed if /etc/mtab is missing (since it no longer cares about /etc/mtab). Ideally, we'd be able to unmount /proc as part of that test. But I doubt that's viable. So at a minimum, you'll have to remove all mentions from MNTTAB from that test. That is, make it stop testing with /etc/mtab moved out of the way. So it would only test with /dev/zfs. Then, the description should probably not mention "scenarios" (plural), but just mention "if zfs device is missing" or something. |
For Linux specific modifications like this to the test suite there exists an Regarding the other test failures keep in mind that it's not uncommon for one test failure to cause many or all of the subsequent tests to fail. So in this case it looks like a problem in zconfig.sh caused the modules not to be unloaded resulting in subsequent test failures. The same thing can obviously happen if say a proposed patch triggers an ASSERT in the kernel. |
All the tests succeed now but: |
@slashdd the tests failed on CentOS 6.7 and Ubuntu 14.04 because this patch break |
We need to figure out why that is failing and fix it. The intent of this patch is to remove all references to /etc/mtab. It shouldn't matter if they have a symlink or not, as nothing in ZFS should care about /etc/mtab after this patch. |
@behlendorf, as per @rlaager mentioned an hour ago (see above), the purpose of this patch is to remove /etc/mtab of the equation to rely on /proc/self/mounts only. |
It looks to me like that the problem is somewhere around here:
Where error 5 comes from: from scripts/zconfig.sh I just don't see yet how my patch can impact this on Ubuntu 14.04 and Centos 6.7 only. |
I see what you mean now: scripts/zfs.sh Probably that umount try to update /proc/self/mounts to reflect the new reality (zfs being umount) and can't because /proc/self/mounts is "-r--r--r--". |
I wonder if that would work: -n, --no-mtab Instead of -a: -a, --all |
71e4989
to
d0475e0
Compare
@slashdd @rlaager that's not going to be possible on older systems. We can definitely prefer
We need to keep this functionality to avoid accidentally breaking existing scripts/utilities which depend on it. However, we don't need to make this fatal. If for any reason we can't update the |
@behlendorf , What if replacing "umount -t zfs -a" by "zfs umount -a" ? |
@slashdd that will fix the automated tests. But it means we'll be breaking any script or utility which depends on the -a flag working as described in the |
How about this approach:
|
That sounds workable to me, just two comments.
This isn't an issue with an old version of
I'm OK with this, but what's the motivation for this when there already exists a command line option to do exactly this? |
I'm talking about disabling the mtab writing code in ZFS. There's not a command-line option for that, is there? And even so, I think the point would be to ensure that mtab is well-and-thoroughly dead. If umount(8) is still using mtab, then Ubuntu can/should/probably-will work on killing that separately. |
Both mount(8) and umount(8) take the |
I wonder if at this point, using libmount would be a more suitable solution. "The libmount library is used to parse /etc/fstab, /etc/mtab and /proc/self/mountinfo files, manage the mtab file, evaluate mount options, etc." |
@slashdd yes absolutely. That's what it's there for and it's the only safe way to lock to the mtab file when updating it. It just didn't exist on Linux when the mount helper code was originally written. |
d0475e0
to
7f1f3f1
Compare
@slashdd, it sounded like @behlendorf wanted the test changes conditionalized on the is_linux function. I will give this a more in depth review soon. |
Right, we wanted to keep the test suite in a form it'll run on other platforms so please use the |
I made some updates here: This hopefully addresses the is_linux thing in the tests. I haven't run this on the buildbots. It also actually fixes the error message that started this whole thing. ;) I realize the irony that one of my commits eliminates a /proc/self/mounts hardcoding, and another adds one. |
@behlendorf , sure I'll do another 'git push' by EOD with @rlaager 's suggestions. |
7f1f3f1
to
efa7bf1
Compare
@behlendorf, is your triggering for a fresh test run and my recent 'git push' interfere and created this tests failure ? How can I force the re-run the build/tests ? |
Strange, let me just resubmit these and see if they fail in the same way again. |
@behlendorf, still failing including @rlaager's suggestion. |
efa7bf1
to
5a5376e
Compare
rebuilding without rlaager's suggestion to see if test still succeed. |
@behlendorf is something wrong with the buildbot ? |
@slashdd you're going to need to rebase this on the very latest master. The version in the META file was updated recently to 0.7.0-rc1 which is causing it to fail to locate the correct version of the SPL. If you rebase on master and force update this branch it'll build correctly. Generally that's a good habit to get in to anyway since it minimizes the chance of merge conflicts when applying the patch. |
5a5376e
to
bc3cfba
Compare
@behlendorf, this latest push "bc3cfba" include @rlaager's suggestion. |
|
||
#verify zfs failed if ZFS_DEV cannot be opened | ||
ZFS_DEV=/dev/zfs | ||
|
||
for file in $ZFS_DEV $MNTTAB; do | ||
for file in $ZFS_DEV; do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The is_linux
conditionals from rlaager@79fd00a are missing.
It looks like you've just applied the top most patch in the stack. See my inline patch comments. |
@behlendorf ok thanks... for some reasons, I missed that portion ... will work on it today. |
bc3cfba
to
dc40597
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for refreshing this. @rlaager can you also give this one last review before it's merged.
@@ -259,9 +259,9 @@ zfs_is_mountable(zfs_handle_t *zhp, char *buf, size_t buflen, | |||
|
|||
/* | |||
* The filesystem is mounted by invoking the system mount utility rather | |||
* than by the system call mount(2). This ensures that the /etc/mtab | |||
* than by the system call mount(2). This ensures that the /proc/self/mounts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment is now wrong. We do not lock /proc/self/mounts for an update.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
* file is correctly locked for the update. Performing our own locking | ||
* and /etc/mtab update requires making an unsafe assumption about how | ||
* and /proc/self/mounts update requires making an unsafe assumption about how |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Likewise, /proc/self/mounts is not updated. Perhaps these should remain /etc/mtab, because there is /etc/mtab updating that still happens?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -348,7 +348,7 @@ zfs_add_option(zfs_handle_t *zhp, char *options, int len, | |||
|
|||
/* | |||
* zfs_prop_get_int() to not used to ensure our mount options |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this is existing, but should this be "is not used" rather than "to not used"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -348,7 +348,7 @@ zfs_add_option(zfs_handle_t *zhp, char *options, int len, | |||
|
|||
/* | |||
* zfs_prop_get_int() to not used to ensure our mount options | |||
* are not influenced by the current /etc/mtab contents. | |||
* are not influenced by the current /proc/self/mounts contents. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which file should this be?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For me, it sound like /proc/self/mounts is the file.
Misleading error message "The /dev/zfs device is missing and must be created.", if /etc/mtab is missing. Signed-off-by: Eric Desrochers <eric.desrochers@canonical.com>
dc40597
to
13fc619
Compare
LGTM |
Thanks guys! |
Misleading error message "The /dev/zfs device is missing and must be created.", if /etc/mtab is missing.
Signed-off-by: Eric Desrochers eric.desrochers@canonical.com
Closes #4680