summaryrefslogtreecommitdiffstats
path: root/src/basic/mount-util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2017-12-11 20:01:55 +0100
committerLennart Poettering <lennart@poettering.net>2017-12-14 10:46:19 +0100
commit35bbbf85e01372cc5091fa5fbf3ca83e262de90d (patch)
treeadc0812fa0008ba8d411a68bb7a8c0e345f1df1b /src/basic/mount-util.c
parenttree-wide: use __fsetlocking() instead of fxyz_unlocked() (diff)
downloadsystemd-35bbbf85e01372cc5091fa5fbf3ca83e262de90d.tar.xz
systemd-35bbbf85e01372cc5091fa5fbf3ca83e262de90d.zip
basic: turn off stdio locking for a couple of helper calls
These helper calls are potentially called often, and allocate FILE* objects internally for a very short period of time, let's turn off locking for them too.
Diffstat (limited to 'src/basic/mount-util.c')
-rw-r--r--src/basic/mount-util.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/basic/mount-util.c b/src/basic/mount-util.c
index f8d615dd89..455c50fc9f 100644
--- a/src/basic/mount-util.c
+++ b/src/basic/mount-util.c
@@ -19,6 +19,7 @@
***/
#include <errno.h>
+#include <stdio_ext.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mount.h>
@@ -337,6 +338,8 @@ int umount_recursive(const char *prefix, int flags) {
if (!proc_self_mountinfo)
return -errno;
+ (void) __fsetlocking(proc_self_mountinfo, FSETLOCKING_BYCALLER);
+
for (;;) {
_cleanup_free_ char *path = NULL, *p = NULL;
int k;
@@ -583,6 +586,8 @@ int bind_remount_recursive(const char *prefix, bool ro, char **blacklist) {
if (!proc_self_mountinfo)
return -errno;
+ (void) __fsetlocking(proc_self_mountinfo, FSETLOCKING_BYCALLER);
+
return bind_remount_recursive_with_mountinfo(prefix, ro, blacklist, proc_self_mountinfo);
}