Skip to content

Commit be13eeb

Browse files
authored
Merge pull request #28544 from yuwata/fstab-generator-fsck
fstab-generator: enable fsck for block device mounts specified in sys…
2 parents 96197e9 + 239cce3 commit be13eeb

File tree

11 files changed

+54
-1
lines changed

11 files changed

+54
-1
lines changed

src/fstab-generator/fstab-generator.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -888,6 +888,9 @@ static int parse_fstab_one(
888888
if (is_swap)
889889
return add_swap(source, what, options, flags);
890890

891+
if (passno < 0)
892+
passno = is_device_path(what);
893+
891894
assert(where_original); /* 'where' is not necessary for swap entry. */
892895

893896
if (!is_path(where_original)) {
@@ -1302,7 +1305,7 @@ static int add_mounts_from_cmdline(void) {
13021305
m->where,
13031306
m->fstype,
13041307
m->options,
1305-
/* passno = */ 0,
1308+
/* passno = */ -1,
13061309
/* prefix_sysroot = */ !m->for_initrd && in_initrd(),
13071310
/* accept_root = */ true,
13081311
/* use_swap_enabled = */ false);

test/test-fstab-generator/test-19-mounts-from-cmdline.expected.sysroot/foo-also_in_initrd.mount

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
Documentation=man:fstab(5) man:systemd-fstab-generator(8)
55
SourcePath=/proc/cmdline
66
Before=local-fs.target
7+
8+
79
810

911
[Mount]

test/test-fstab-generator/test-19-mounts-from-cmdline.expected.sysroot/foo-not_in_initrd.mount

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
Documentation=man:fstab(5) man:systemd-fstab-generator(8)
55
SourcePath=/proc/cmdline
66
Before=local-fs.target
7+
8+
79
810

911
[Mount]

test/test-fstab-generator/test-19-mounts-from-cmdline.expected.sysroot/usr.mount

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
Documentation=man:fstab(5) man:systemd-fstab-generator(8)
55
SourcePath=/proc/cmdline
66
Before=local-fs.target
7+
8+
79
810

911
[Mount]

test/test-fstab-generator/test-19-mounts-from-cmdline.expected/hoge-without_fstype.mount

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
Documentation=man:fstab(5) man:systemd-fstab-generator(8)
55
SourcePath=/proc/cmdline
66
Before=local-fs.target
7+
8+
79
810

911
[Mount]

test/test-fstab-generator/test-19-mounts-from-cmdline.expected/hoge-without_options.mount

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
Documentation=man:fstab(5) man:systemd-fstab-generator(8)
55
SourcePath=/proc/cmdline
66
Before=local-fs.target
7+
8+
79
810

911
[Mount]

test/test-fstab-generator/test-19-mounts-from-cmdline.expected/sysroot-foo-also_in_initrd.mount

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
Documentation=man:fstab(5) man:systemd-fstab-generator(8)
55
SourcePath=/proc/cmdline
66
Before=initrd-fs.target
7+
8+
79
810

911
[Mount]

test/test-fstab-generator/test-19-mounts-from-cmdline.expected/sysroot.mount

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
Documentation=man:fstab(5) man:systemd-fstab-generator(8)
55
SourcePath=/proc/cmdline
66
Before=initrd-root-fs.target
7+
Requires=systemd-fsck-root.service
8+
After=systemd-fsck-root.service
79
810

911
[Mount]
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Automatically generated by systemd-fstab-generator
2+
3+
[Unit]
4+
Description=File System Check on /dev/sdx1
5+
Documentation=man:systemd-fsck-root.service(8)
6+
7+
DefaultDependencies=no
8+
BindsTo=dev-sdx1.device
9+
Conflicts=shutdown.target
10+
After=initrd-root-device.target local-fs-pre.target dev-sdx1.device
11+
Before=shutdown.target
12+
13+
[Service]
14+
Type=oneshot
15+
RemainAfterExit=yes
16+
ExecStart=/usr/lib/systemd/systemd-fsck /dev/sdx1
17+
TimeoutSec=infinity
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Automatically generated by systemd-fstab-generator
2+
3+
[Unit]
4+
Description=File System Check on /dev/sdx5
5+
Documentation=man:systemd-fsck-usr.service(8)
6+
7+
DefaultDependencies=no
8+
BindsTo=dev-sdx5.device
9+
Conflicts=shutdown.target
10+
After=local-fs-pre.target dev-sdx5.device
11+
Before=shutdown.target
12+
13+
[Service]
14+
Type=oneshot
15+
RemainAfterExit=yes
16+
ExecStart=/usr/lib/systemd/systemd-fsck /dev/sdx5
17+
TimeoutSec=infinity

0 commit comments

Comments
 (0)