* [PATCH] fstab: do not mount and fsck from fstab if using systemd
@ 2014-04-01 5:19 WANG Chao
[not found] ` <20140401051913.GA644-2coKmSd1Zb6BYdNaKHuJJRcY2uh10dtjAL8bYrjMMd8@public.gmane.org>
0 siblings, 1 reply; 6+ messages in thread
From: WANG Chao @ 2014-04-01 5:19 UTC (permalink / raw)
To: Harald Hoyer; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA
If using systemd in initramfs, we could run into a race condition when
dracut and systemd both are trying to mount and run fsck for the same
filesystem, and mount or fsck could be a failure.
To fix such failure, we should use systemd to mount/fsck from /etc/fstab
only.
Signed-off-by: WANG Chao <chaowang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
modules.d/95fstab-sys/mount-sys.sh | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/modules.d/95fstab-sys/mount-sys.sh b/modules.d/95fstab-sys/mount-sys.sh
index 12711a0..d65cafd 100755
--- a/modules.d/95fstab-sys/mount-sys.sh
+++ b/modules.d/95fstab-sys/mount-sys.sh
@@ -27,7 +27,11 @@ fstab_mount() {
return 0
}
-[ -f /etc/fstab ] && fstab_mount /etc/fstab
+# systemd will mount and run fsck from /etc/fstab and we don't want to
+# run into a race condition.
+if [ `readlink -f /init` != '/usr/lib/systemd/systemd' ]; then
+ [ -f /etc/fstab ] && fstab_mount /etc/fstab
+fi
# prefer $NEWROOT/etc/fstab.sys over local /etc/fstab.sys
if [ -f $NEWROOT/etc/fstab.sys ]; then
--
1.8.5.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] fstab: do not mount and fsck from fstab if using systemd
[not found] ` <20140401051913.GA644-2coKmSd1Zb6BYdNaKHuJJRcY2uh10dtjAL8bYrjMMd8@public.gmane.org>
@ 2014-04-01 7:06 ` Alexander Tsoy
2014-04-01 7:06 ` WANG Chao
0 siblings, 1 reply; 6+ messages in thread
From: Alexander Tsoy @ 2014-04-01 7:06 UTC (permalink / raw)
To: WANG Chao, Harald Hoyer; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA
On Tue Apr 1 09:19:13 2014 WANG Chao <chaowang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> wrote:
> If using systemd in initramfs, we could run into a race condition when
> dracut and systemd both are trying to mount and run fsck for the same
> filesystem, and mount or fsck could be a failure.
>
> To fix such failure, we should use systemd to mount/fsck from /etc/fstab
> only.
>
> Signed-off-by: WANG Chao <chaowang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> ---
> modules.d/95fstab-sys/mount-sys.sh | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/modules.d/95fstab-sys/mount-sys.sh
> b/modules.d/95fstab-sys/mount-sys.sh index 12711a0..d65cafd 100755
> --- a/modules.d/95fstab-sys/mount-sys.sh
> +++ b/modules.d/95fstab-sys/mount-sys.sh
> @@ -27,7 +27,11 @@ fstab_mount() {
> return 0
> }
>
> -[ -f /etc/fstab ] && fstab_mount /etc/fstab
> +# systemd will mount and run fsck from /etc/fstab and we don't want to
> +# run into a race condition.
> +if [ `readlink -f /init` != '/usr/lib/systemd/systemd' ]; then
It's better to test DRACUT_SYSTEMD variable here:
if [ -z "$DRACUT_SYSTEMD" ]; then
> + [ -f /etc/fstab ] && fstab_mount /etc/fstab
> +fi
>
> # prefer $NEWROOT/etc/fstab.sys over local /etc/fstab.sys
> if [ -f $NEWROOT/etc/fstab.sys ]; then
> --
> 1.8.5.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe initramfs" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Alexander Tsoy
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] fstab: do not mount and fsck from fstab if using systemd
2014-04-01 7:06 ` Alexander Tsoy
@ 2014-04-01 7:06 ` WANG Chao
0 siblings, 0 replies; 6+ messages in thread
From: WANG Chao @ 2014-04-01 7:06 UTC (permalink / raw)
To: Alexander Tsoy; +Cc: Harald Hoyer, initramfs-u79uwXL29TY76Z2rM5mHXA
On 04/01/14 at 11:06am, Alexander Tsoy wrote:
> On Tue Apr 1 09:19:13 2014 WANG Chao <chaowang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> wrote:
> > If using systemd in initramfs, we could run into a race condition when
> > dracut and systemd both are trying to mount and run fsck for the same
> > filesystem, and mount or fsck could be a failure.
> >
> > To fix such failure, we should use systemd to mount/fsck from /etc/fstab
> > only.
> >
> > Signed-off-by: WANG Chao <chaowang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> > ---
> > modules.d/95fstab-sys/mount-sys.sh | 6 +++++-
> > 1 file changed, 5 insertions(+), 1 deletion(-)
> >
> > diff --git a/modules.d/95fstab-sys/mount-sys.sh
> > b/modules.d/95fstab-sys/mount-sys.sh index 12711a0..d65cafd 100755
> > --- a/modules.d/95fstab-sys/mount-sys.sh
> > +++ b/modules.d/95fstab-sys/mount-sys.sh
> > @@ -27,7 +27,11 @@ fstab_mount() {
> > return 0
> > }
> >
> > -[ -f /etc/fstab ] && fstab_mount /etc/fstab
> > +# systemd will mount and run fsck from /etc/fstab and we don't want to
> > +# run into a race condition.
> > +if [ `readlink -f /init` != '/usr/lib/systemd/systemd' ]; then
>
> It's better to test DRACUT_SYSTEMD variable here:
>
> if [ -z "$DRACUT_SYSTEMD" ]; then
Right. Will post v2. Thanks.
WANG Chao
>
> > + [ -f /etc/fstab ] && fstab_mount /etc/fstab
> > +fi
> >
> > # prefer $NEWROOT/etc/fstab.sys over local /etc/fstab.sys
> > if [ -f $NEWROOT/etc/fstab.sys ]; then
> > --
> > 1.8.5.3
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe initramfs" in
> > the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
>
> --
> Alexander Tsoy
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] fstab: do not mount and fsck from fstab if using systemd
@ 2014-04-01 7:20 WANG Chao
[not found] ` <20140401072049.GA23588-2coKmSd1Zb6BYdNaKHuJJRcY2uh10dtjAL8bYrjMMd8@public.gmane.org>
0 siblings, 1 reply; 6+ messages in thread
From: WANG Chao @ 2014-04-01 7:20 UTC (permalink / raw)
To: Harald Hoyer, Alexander Tsoy; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA
If using systemd in initramfs, we could run into a race condition when
dracut and systemd both are trying to mount and run fsck for the same
filesystem, and mount or fsck could be a failure.
To fix such failure, we should use systemd to mount/fsck from /etc/fstab
only.
v2: check $DRACUT_SYSTEMD suggested by Alexander Tsoy
Signed-off-by: WANG Chao <chaowang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
modules.d/95fstab-sys/mount-sys.sh | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/modules.d/95fstab-sys/mount-sys.sh b/modules.d/95fstab-sys/mount-sys.sh
index 12711a0..a237810 100755
--- a/modules.d/95fstab-sys/mount-sys.sh
+++ b/modules.d/95fstab-sys/mount-sys.sh
@@ -27,7 +27,11 @@ fstab_mount() {
return 0
}
-[ -f /etc/fstab ] && fstab_mount /etc/fstab
+# systemd will mount and run fsck from /etc/fstab and we don't want to
+# run into a race condition.
+if [ -z "$DRACUT_SYSTEMD" ]; then
+ [ -f /etc/fstab ] && fstab_mount /etc/fstab
+fi
# prefer $NEWROOT/etc/fstab.sys over local /etc/fstab.sys
if [ -f $NEWROOT/etc/fstab.sys ]; then
--
1.8.5.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] fstab: do not mount and fsck from fstab if using systemd
[not found] ` <20140401072049.GA23588-2coKmSd1Zb6BYdNaKHuJJRcY2uh10dtjAL8bYrjMMd8@public.gmane.org>
@ 2014-04-01 7:24 ` WANG Chao
2014-04-02 7:59 ` Harald Hoyer
1 sibling, 0 replies; 6+ messages in thread
From: WANG Chao @ 2014-04-01 7:24 UTC (permalink / raw)
To: Harald Hoyer, Alexander Tsoy; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA
On 04/01/14 at 03:20pm, WANG Chao wrote:
> If using systemd in initramfs, we could run into a race condition when
> dracut and systemd both are trying to mount and run fsck for the same
> filesystem, and mount or fsck could be a failure.
>
> To fix such failure, we should use systemd to mount/fsck from /etc/fstab
> only.
>
> v2: check $DRACUT_SYSTEMD suggested by Alexander Tsoy
>
> Signed-off-by: WANG Chao <chaowang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
This is v2, I forgot to add v2 in the subject. Hope you don't mind.
Thanks
WANG Chao
> ---
> modules.d/95fstab-sys/mount-sys.sh | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/modules.d/95fstab-sys/mount-sys.sh b/modules.d/95fstab-sys/mount-sys.sh
> index 12711a0..a237810 100755
> --- a/modules.d/95fstab-sys/mount-sys.sh
> +++ b/modules.d/95fstab-sys/mount-sys.sh
> @@ -27,7 +27,11 @@ fstab_mount() {
> return 0
> }
>
> -[ -f /etc/fstab ] && fstab_mount /etc/fstab
> +# systemd will mount and run fsck from /etc/fstab and we don't want to
> +# run into a race condition.
> +if [ -z "$DRACUT_SYSTEMD" ]; then
> + [ -f /etc/fstab ] && fstab_mount /etc/fstab
> +fi
>
> # prefer $NEWROOT/etc/fstab.sys over local /etc/fstab.sys
> if [ -f $NEWROOT/etc/fstab.sys ]; then
> --
> 1.8.5.3
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] fstab: do not mount and fsck from fstab if using systemd
[not found] ` <20140401072049.GA23588-2coKmSd1Zb6BYdNaKHuJJRcY2uh10dtjAL8bYrjMMd8@public.gmane.org>
2014-04-01 7:24 ` WANG Chao
@ 2014-04-02 7:59 ` Harald Hoyer
1 sibling, 0 replies; 6+ messages in thread
From: Harald Hoyer @ 2014-04-02 7:59 UTC (permalink / raw)
To: WANG Chao; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA
Am 01.04.2014 09:20, schrieb WANG Chao:
> If using systemd in initramfs, we could run into a race condition when
> dracut and systemd both are trying to mount and run fsck for the same
> filesystem, and mount or fsck could be a failure.
>
> To fix such failure, we should use systemd to mount/fsck from /etc/fstab
> only.
>
> v2: check $DRACUT_SYSTEMD suggested by Alexander Tsoy
>
> Signed-off-by: WANG Chao <chaowang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> ---
> modules.d/95fstab-sys/mount-sys.sh | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/modules.d/95fstab-sys/mount-sys.sh b/modules.d/95fstab-sys/mount-sys.sh
> index 12711a0..a237810 100755
> --- a/modules.d/95fstab-sys/mount-sys.sh
> +++ b/modules.d/95fstab-sys/mount-sys.sh
> @@ -27,7 +27,11 @@ fstab_mount() {
> return 0
> }
>
> -[ -f /etc/fstab ] && fstab_mount /etc/fstab
> +# systemd will mount and run fsck from /etc/fstab and we don't want to
> +# run into a race condition.
> +if [ -z "$DRACUT_SYSTEMD" ]; then
> + [ -f /etc/fstab ] && fstab_mount /etc/fstab
> +fi
>
> # prefer $NEWROOT/etc/fstab.sys over local /etc/fstab.sys
> if [ -f $NEWROOT/etc/fstab.sys ]; then
>
Thanks. pushed
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-04-02 7:59 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-01 7:20 [PATCH] fstab: do not mount and fsck from fstab if using systemd WANG Chao
[not found] ` <20140401072049.GA23588-2coKmSd1Zb6BYdNaKHuJJRcY2uh10dtjAL8bYrjMMd8@public.gmane.org>
2014-04-01 7:24 ` WANG Chao
2014-04-02 7:59 ` Harald Hoyer
-- strict thread matches above, loose matches on Subject: below --
2014-04-01 5:19 WANG Chao
[not found] ` <20140401051913.GA644-2coKmSd1Zb6BYdNaKHuJJRcY2uh10dtjAL8bYrjMMd8@public.gmane.org>
2014-04-01 7:06 ` Alexander Tsoy
2014-04-01 7:06 ` WANG Chao
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox