about summary refs log tree commit homepage
path: root/mnt.c
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2015-03-09 20:22:23 +0000
committerEric Wong <e@80x24.org>2015-03-09 20:39:10 +0000
commitc659acbb8d7a6b0c8098646981124a47f15cceae (patch)
tree41667f3f21e4870cbfed41f89944921637779134 /mnt.c
parent1a7f32d0d8a48b9f26f595d0fa9f5db0c657bc3a (diff)
downloadcmogstored-c659acbb8d7a6b0c8098646981124a47f15cceae.tar.gz
During the initial device scan, it is possible for the waiter to be
interrupted while awaiting cancellation.  We must account for this
on all platforms regardless of whether pselect or ppoll is used.

Reported-by: Mykola Golub <trociny@FreeBSD.org>
Diffstat (limited to 'mnt.c')
-rw-r--r--mnt.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/mnt.c b/mnt.c
index 0de0bb9..ca4bdf8 100644
--- a/mnt.c
+++ b/mnt.c
@@ -122,6 +122,7 @@ skip:
 static void * init_once(void *ptr)
 {
         struct init_args *ia = ptr;
+        int err;
 
         CHECK(int, 0, pthread_mutex_lock(&by_dev_lock) );
         assert(by_dev == NULL &&
@@ -135,7 +136,10 @@ static void * init_once(void *ptr)
         CHECK(int, 0, pthread_cond_signal(&ia->cond));
         CHECK(int, 0, pthread_mutex_unlock(&ia->cond_lock));
 
-        mog_sleep(-1); /* wait for cancellation */
+        /* wait for cancellation, mog_sleep may return ENOMEM or EINTR */
+        do {
+                err = mog_sleep(-1);
+        } while (err == EINTR || err == ENOMEM);
         assert(0 && "init_once did not get cancelled");
         return NULL;
 }