Merge pull request #16143 from fbuihuu/fstab-generator-fix
fstab-generator: make sure explicit deps configured via mount options apply to .mount, not .automount unit
This commit is contained in:
commit
2e2f6a01a0
|
@ -204,7 +204,11 @@
|
||||||
system that merges multiple mount points). See
|
system that merges multiple mount points). See
|
||||||
<varname>After=</varname> and <varname>Requires=</varname> in
|
<varname>After=</varname> and <varname>Requires=</varname> in
|
||||||
<citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
|
<citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
|
||||||
for details.</para></listitem>
|
for details.</para>
|
||||||
|
|
||||||
|
<para>Note that this option always applies to the created mount unit
|
||||||
|
only regardless whether <option>x-systemd.automount</option> has been
|
||||||
|
specified.</para></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
|
@ -223,7 +227,11 @@
|
||||||
unit.
|
unit.
|
||||||
See <varname>Before=</varname> and <varname>After=</varname> in
|
See <varname>Before=</varname> and <varname>After=</varname> in
|
||||||
<citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
|
<citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
|
||||||
for details.</para></listitem>
|
for details.</para>
|
||||||
|
|
||||||
|
<para>Note that these options always apply to the created mount unit
|
||||||
|
only regardless whether <option>x-systemd.automount</option> has been
|
||||||
|
specified.</para></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
|
|
|
@ -314,6 +314,29 @@ static int write_requires_mounts_for(FILE *f, const char *opts) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int write_extra_dependencies(FILE *f, const char *opts) {
|
||||||
|
int r;
|
||||||
|
|
||||||
|
assert(f);
|
||||||
|
|
||||||
|
if (opts) {
|
||||||
|
r = write_after(f, opts);
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
r = write_requires_after(f, opts);
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
r = write_before(f, opts);
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
r = write_requires_mounts_for(f, opts);
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int add_mount(
|
static int add_mount(
|
||||||
const char *dest,
|
const char *dest,
|
||||||
const char *what,
|
const char *what,
|
||||||
|
@ -406,20 +429,9 @@ static int add_mount(
|
||||||
SET_FLAG(flags, NOFAIL, true);
|
SET_FLAG(flags, NOFAIL, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(flags & AUTOMOUNT) && opts) {
|
r = write_extra_dependencies(f, opts);
|
||||||
r = write_after(f, opts);
|
if (r < 0)
|
||||||
if (r < 0)
|
return r;
|
||||||
return r;
|
|
||||||
r = write_requires_after(f, opts);
|
|
||||||
if (r < 0)
|
|
||||||
return r;
|
|
||||||
r = write_before(f, opts);
|
|
||||||
if (r < 0)
|
|
||||||
return r;
|
|
||||||
r = write_requires_mounts_for(f, opts);
|
|
||||||
if (r < 0)
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (passno != 0) {
|
if (passno != 0) {
|
||||||
r = generator_write_fsck_deps(f, dest, what, where, fstype);
|
r = generator_write_fsck_deps(f, dest, what, where, fstype);
|
||||||
|
@ -530,21 +542,6 @@ static int add_mount(
|
||||||
"Documentation=man:fstab(5) man:systemd-fstab-generator(8)\n",
|
"Documentation=man:fstab(5) man:systemd-fstab-generator(8)\n",
|
||||||
source);
|
source);
|
||||||
|
|
||||||
if (opts) {
|
|
||||||
r = write_after(f, opts);
|
|
||||||
if (r < 0)
|
|
||||||
return r;
|
|
||||||
r = write_requires_after(f, opts);
|
|
||||||
if (r < 0)
|
|
||||||
return r;
|
|
||||||
r = write_before(f, opts);
|
|
||||||
if (r < 0)
|
|
||||||
return r;
|
|
||||||
r = write_requires_mounts_for(f, opts);
|
|
||||||
if (r < 0)
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf(f,
|
fprintf(f,
|
||||||
"\n"
|
"\n"
|
||||||
"[Automount]\n"
|
"[Automount]\n"
|
||||||
|
|
Loading…
Reference in New Issue