Skip to content

Mount fix fstab nofail - #2036

Closed
fbuihuu wants to merge 4 commits into
systemd:masterfrom
fbuihuu:mount-fix-fstab-nofail
Closed

fbuihuu wants to merge 4 commits into
systemd:masterfrom
fbuihuu:mount-fix-fstab-nofail

Conversation

@fbuihuu

@fbuihuu fbuihuu commented Nov 26, 2015

Copy link
Copy Markdown
Contributor

This patchset to make sure we always stop mount/swap units (generated by the fstab-generator) after all service units during shutdown specially when 'nofail' or 'noauto' are used.

@keszybz

keszybz commented Nov 26, 2015

Copy link
Copy Markdown
Member

So... this looks like it could work.

Yeah, technically this would work, but the user experience is not nice:

  • during boot we will get the following messages:
level notice: dev-xxx.device: Job dev-xxx.device/start timed out.
lever error: Timed out waiting for device dev-xxx.device.
level notice: Dependency failed for yyy.
level notice: yyy.mount: Job yyy.mount/start failed with result 'dependency'.
level notice: dev-xxx.device: Job dev-xxx.device/start failed with result 'timeout'.

Those message are harmless, but we don't emit error (or notice messages) as a principle unless there is a real problem. So your solution unfortunately is not going to work, unless we somehow redesign the system to avoid those messages. But this doesn't seem like the right approach. The whole thing is a bit of a hack, and we shouldn't add scaffolding for it.

A better option might be an asymmetrical Before/After option, which would only apply during shutdown (stop). There have been various times where something like this would have been useful, but we always managed to do with existing dependencies. Maybe it's time to revisit this.

@fbuihuu

fbuihuu commented Nov 26, 2015

Copy link
Copy Markdown
Contributor Author

On 11/26/2015 08:37 PM, Zbigniew Jędrzejewski-Szmek wrote:

So... this looks like it could work.

Yeah, technically this would work, but the user experience is not nice:

  • during boot we will get the following messages:

|level notice: dev-xxx.device: Job dev-xxx.device/start timed out. lever
error: Timed out waiting for device dev-xxx.device. level notice:
Dependency failed for yyy. level notice: yyy.mount: Job yyy.mount/start
failed with result 'dependency'. level notice: dev-xxx.device: Job
dev-xxx.device/start failed with result 'timeout'. |

Those message /are/ harmless, but we don't emit error (or notice
messages) as a principle unless there is a real problem. So your
solution unfortunately is not going to work, unless we somehow redesign
the system to avoid those messages. But this doesn't seem like the right
approach. The whole thing is a bit of a hack, and we shouldn't add
scaffolding for it.

Agreed.

However I think this is better than the current situation: I would
prefer a harmless warning over an incorrect behavior during shutdown.

A better option might be an asymmetrical Before/After option, which
would only apply during shutdown (stop). There have been various times
where something like this would have been useful, but we always managed
to do with existing dependencies. Maybe it's time to revisit this.

Yes it might be the right thing to do. However until this is done, I
preferred sending a temporary workaround.

Thanks.

…g JobTimeoutSec

There was no need for such conversion and it was actually wrong since
any device timeout less than a second was converted into 0 which means
waits forever.
…shutdown

For mount units generated by the fstab-generator, the ordering dep
"Before=local-fs.target' was conditionnaly added depending on some
options such as 'nofail' or 'noauto'.

I don't see any reason to not add it when 'noauto' is passed.

For the 'nofail' case, this allowed the local-fs.target unit to become
active without the need to wait for the mount unit to timeout when the
associated device node was missing.

Removing this ordering dep had an unwanted side effect however: during
shutdown, the affected mount units were not ordered against
local-fs.target anymore and could be stopped at any times, specially
before service units.

This patch unconditionnaly set "Before=local-fs.target" and order all
mount units to be stopped *after* local-fs.target is.

The side effect is that the boot process will wait for the timeout to
expire for missing disks even if the corresponding mount units have
'nofail' set.

A following patch will restore the correct behaviour regarding
'nofail' by setting the smallest possible timeout value for the device
units.
When 'nofail' is set, we shouldn't wait for the device timeout to
expire. This was the case before but the way it was done was broken.

This patch restores this behaviour by setting the smallest timeout
value (1us) when 'nofail' is set.

This also applies to swap units since they use the same path to setup
device timeout.
@fbuihuu
fbuihuu force-pushed the mount-fix-fstab-nofail branch from 3b9ddce to 4e90ab1 Compare November 26, 2015 22:04
@fbuihuu

fbuihuu commented Nov 26, 2015

Copy link
Copy Markdown
Contributor Author

@keszybz I've updated the branch according to your feedback, Feel free to drop the workaround.

@keszybz

keszybz commented Nov 27, 2015

Copy link
Copy Markdown
Member

Sorry, if I wasn't clear: this approach cannot be merged (apart from the first commit, which I now merged). I left the pull request open to discuss a better solution.

@fbuihuu

fbuihuu commented Nov 27, 2015

Copy link
Copy Markdown
Contributor Author

On 11/27/2015 03:52 AM, Zbigniew Jędrzejewski-Szmek wrote:

Sorry, if I wasn't clear: this approach cannot be merged

As I wrote, the current behaviour is wrong and is worse: you'll also get
a warning when shutting down the machine because systemd will try to
unmount mount units with 'nofail' or 'noauto' before stopping any services.

IMHO, getting a harmless warning is still better...

(apart from the first commit, which I now merged).

You might have missed the new patch I added during my last update:

"fstab-gen: don't convert device timeout into seconds when initializing
JobTimeOutSec"

As I wrote in my one of my previous comments, converting device timeout
into seconds is incorrect.

PS: I'm not sure you got notifications for my replies to your commit
comments. BTW, is it allowed to send patches directly to the systemd
mailing list ? I don't really see the point to use this webui...

Thanks.

@poettering poettering added needs-reporter-feedback ❓ There's an unanswered question, the reporter needs to answer fstab-generator labels Nov 27, 2015
@centos-ci

Copy link
Copy Markdown

Can one of the admins verify this patch?

@martinpitt

Copy link
Copy Markdown
Contributor

This PR is almsot year old and thus stale, and got rejected in its present form. Hence I am closing it now. If this is still relevant, please fix and rebase to current master, and either reopen this PR or open a new one. Thank you for understanding!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fstab-generator needs-reporter-feedback ❓ There's an unanswered question, the reporter needs to answer

Development

Successfully merging this pull request may close these issues.

5 participants