8000 suma/4.3: Prevent crash during Cobbler startup on NFS environments (bsc#1240666) by meaksh · Pull Request #130 · openSUSE/cobbler · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

suma/4.3: Prevent crash during Cobbler startup on NFS environments (bsc#1240666) #130

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 14, 2025
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
1 change: 1 addition & 0 deletions changelog.d/3905.fixed
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Prevent crash during Cobbler startup on NFS environments (bsc#1240666)
8 changes: 6 additions & 2 deletions cobbler/serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ def __grab_lock():
if not os.path.exists("/var/lib/cobbler/lock"):
fd = open("/var/lib/cobbler/lock", "w+")
fd.close()
LOCK_HANDLE = open("/var/lib/cobbler/lock", "r")
# exclusive lock requires writtable mode (r+) on NFS
# https://man7.org/linux/man-pages/man2/flock.2.html
LOCK_HANDLE = open("/var/lib/cobbler/lock", "r+")
fcntl.flock(LOCK_HANDLE.fileno(), fcntl.LOCK_EX)
except:
# this is pretty much FATAL, avoid corruption and quit now.
Expand All @@ -66,7 +68,9 @@ def __release_lock(with_changes=False):
fd.write("%f" % time.time())
fd.close()
if LOCK_ENABLED:
LOCK_HANDLE = open("/var/lib/cobbler/lock", "r")
# exclusive lock requires writtable mode (r+) on NFS
# https://man7.org/linux/man-pages/man2/flock.2.html
LOCK_HANDLE = open("/var/lib/cobbler/lock", "r+")
fcntl.flock(LOCK_HANDLE.fileno(), fcntl.LOCK_UN)
LOCK_HANDLE.close()

Expand Down
0