Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions etc/systemd/system/var-lib-linstor.service
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ Type=oneshot
ExecStart=/bin/mount -w /dev/drbd/by-res/xcp-persistent-database/0 /var/lib/linstor
ExecStop=/opt/xensource/libexec/safe-umount /var/lib/linstor
RemainAfterExit=true
StandardOutput=journal

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we use inherit here instead (which is also the default value for StandardOutput)?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No preference. I pushed a change with inherit. As long as both vars are explicitly set and we don't use the default system configuration, it seems ok to me.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default for StandardError appear to be inherit already.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default values are configurable in system files. :)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know, I went to see what they were in XCP-ng before saying this ^^

StandardError=inherit
19 changes: 17 additions & 2 deletions scripts/safe-umount
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def safe_umount(path):
return 0

proc = subprocess.Popen(['umount', path], stderr=subprocess.PIPE)
(stdout, stderr) = proc.communicate()
(_stdout, stderr) = proc.communicate()
if not proc.returncode:
return 0

Expand All @@ -29,7 +29,22 @@ def safe_umount(path):
retry_count -= 1
last_code = proc.returncode
time.sleep(0.500)
return last_code

# Lazy attempt.
# Unmounting can fail for example due to a network outage of a DRBD volume mounted
# as `xcp-persistent-database` and which would be blocked in the kernel because of
# ext4 commands that cannot complete.
# In this kind of situation, it's necessary to force a umount call with lazy arg to
# ensure that the mountpoint does not remain present.
print(f'Failed to unmount `{path}`, trying with lazy option...', file=sys.stderr)
proc = subprocess.Popen(['umount', '-l', path], stderr=subprocess.PIPE)
(_stdout, stderr) = proc.communicate()
if proc.returncode:
print(f'Failed to unmount `{path}` with lazy option: `{stderr.strip()}`.', file=sys.stderr)
else:
print(f'Successfully unmounted `{path}`.', file=sys.stderr)

return proc.returncode


if __name__ == '__main__':
Expand Down