Commit 7beab6c0 authored by Matthias Gerstner's avatar Matthias Gerstner Committed by patelia
Browse files

watchdog: be robust against unrelated localhost based nfs mounts

While a bit exotic there can exist mounts of locally exported nfs
shares that aren't related to EFS. In this case the watchdog fails,
because it tries to access the port option that is not present in these
unrelated mount entries.

To fix this discard entries from /proc/mounts that don't carry a port
option.
parent 8a71316e
......@@ -95,6 +95,9 @@ def get_file_safe_mountpoint(mount):
mountpoint = mountpoint[1:]
opts = parse_options(mount.options)
if 'port' not in opts:
# some other localhost nfs mount not running over stunnel
return None
return mountpoint + '.' + opts['port']
......@@ -113,7 +116,9 @@ def get_current_local_nfs_mounts(mount_file='/proc/mounts'):
mount_dict = {}
for m in mounts:
mount_dict[get_file_safe_mountpoint(m)] = m
safe_mnt = get_file_safe_mountpoint(m)
if safe_mnt:
mount_dict[safe_mnt] = m
return mount_dict
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment