aboutsummaryrefslogtreecommitdiffstats
path: root/lib/libshare
diff options
context:
space:
mode:
authorнаб <[email protected]>2021-05-17 18:08:35 +0200
committerBrian Behlendorf <[email protected]>2021-12-17 12:53:49 -0800
commitf50697f95b1601d40e7c33249ab1b5d8163d9f64 (patch)
treea76808a1c3a300ece32406c8971fd9033c2c055c /lib/libshare
parentbdf6464c6c7c79bb11f69298e8353f6db3b3c26f (diff)
libshare: nfs: retry flock() when interrupted
Reviewed-by: Don Brady <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: John Kennedy <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #12067
Diffstat (limited to 'lib/libshare')
-rw-r--r--lib/libshare/nfs.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/libshare/nfs.c b/lib/libshare/nfs.c
index e339ebc81..2b0c70001 100644
--- a/lib/libshare/nfs.c
+++ b/lib/libshare/nfs.c
@@ -50,7 +50,9 @@ nfs_exports_lock(const char *name)
return (err);
}
- if (flock(nfs_lock_fd, LOCK_EX) != 0) {
+ while ((err = flock(nfs_lock_fd, LOCK_EX)) != 0 && errno == EINTR)
+ ;
+ if (err != 0) {
err = errno;
fprintf(stderr, "failed to lock %s: %s\n", name, strerror(err));
(void) close(nfs_lock_fd);