diff options
author | Andy Grover <andy@groveronline.com> | 2016-06-03 09:43:08 -0700 |
---|---|---|
committer | Andy Grover <andy@groveronline.com> | 2016-06-03 09:43:08 -0700 |
commit | a2f4165010eec2e5b9aee09dc1bd0ddecfd6dd33 (patch) | |
tree | f7509a1faaca8cc88adcfd2c843393a865812291 | |
parent | c58895226e62be26d3ef940b21e09289ca358eed (diff) | |
parent | 9134f76aab9a124e6aa1cb996c05fa8076f7debd (diff) | |
download | rtslib-fb-a2f4165010eec2e5b9aee09dc1bd0ddecfd6dd33.tar.gz |
Merge pull request #73 from colml/race-mount
On systems where loading the configfs module (modprobe configfs) automatically mounts /sys/kernel/config, a race condition can occur in the mount_configfs() function in utils.py.
As that function is called immediately after the modprode function, the os.path.ismount check can be called before configfs is finished mounting. The mount command is then run but fails because the mount is busy as it's mounted.
One possible workaround is to make a second os.path.ismount check if the mount command fails, and if it is mounted then we don't raise an exception.
if process.returncode != 0 and not os.path.ismount("/sys/kernel/config"):
raise RTSLibError("Cannot mount configfs")
-rw-r--r-- | rtslib/utils.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/rtslib/utils.py b/rtslib/utils.py index acf8aa5..c9f8213 100644 --- a/rtslib/utils.py +++ b/rtslib/utils.py @@ -440,7 +440,8 @@ def mount_configfs(): stdout=subprocess.PIPE, stderr=subprocess.PIPE) (stdoutdata, stderrdata) = process.communicate() - if process.returncode != 0: + if process.returncode != 0 and not os.path.ismount( + "/sys/kernel/config"): raise RTSLibError("Cannot mount configfs") def dict_remove(d, items): |