Skip to content

Commit

Permalink
dist: fix local-fs.target dependency
Browse files Browse the repository at this point in the history
systemd man page says:

systemd-fstab-generator(3) automatically adds dependencies of type Before= to
all mount units that refer to local mount points for this target unit.

So "Before=local-fs.taget" is the correct dependency for local mount
points, but we currently specify "After=local-fs.target", it should be
fixed.

Also replaced "WantedBy=multi-user.target" with "WantedBy=local-fs.target",
since .mount are not related with multi-user but depends local
filesystems.

Fixes #8761

Closes #15647
  • Loading branch information
syuu1228 authored and denesb committed Nov 6, 2023
1 parent fbd1aa4 commit bdf4cd0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
5 changes: 2 additions & 3 deletions dist/common/scripts/scylla_coredump_setup
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ ExternalSizeMax=1024G
[Unit]
Description=Save coredump to scylla data directory
Conflicts=umount.target
Before=scylla-server.service
After=local-fs.target
Before=local-fs.target scylla-server.service
DefaultDependencies=no
[Mount]
Expand All @@ -73,7 +72,7 @@ Type=none
Options=bind
[Install]
WantedBy=multi-user.target
WantedBy=local-fs.target
'''[1:-1]
with open('/etc/systemd/system/var-lib-systemd-coredump.mount', 'w') as f:
f.write(dot_mount)
Expand Down
12 changes: 6 additions & 6 deletions dist/common/scripts/scylla_raid_setup
Original file line number Diff line number Diff line change
Expand Up @@ -257,19 +257,19 @@ if __name__ == '__main__':
dev_type = 'realpath'
LOGGER.error(f'Failed to detect uuid, using {dev_type}: {mount_dev}')

after = 'local-fs.target'
after = ''
wants = ''
if raid and args.raid_level != '0':
after += f' {md_service}'
wants = f'\nWants={md_service}'
after = wants = 'md_service'
opt_discard = ''
if args.online_discard:
opt_discard = ',discard'
unit_data = f'''
[Unit]
Description=Scylla data directory
Before=scylla-server.service
After={after}{wants}
Before=local-fs.target scylla-server.service
After={after}
Wants={wants}
DefaultDependencies=no
[Mount]
Expand All @@ -279,7 +279,7 @@ Type=xfs
Options=noatime{opt_discard}
[Install]
WantedBy=multi-user.target
WantedBy=local-fs.target
'''[1:-1]
with open(f'/etc/systemd/system/{mntunit_bn}', 'w') as f:
f.write(unit_data)
Expand Down

0 comments on commit bdf4cd0

Please sign in to comment.