diff options
author | Eric Wong <e@80x24.org> | 2015-03-09 20:22:23 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2015-03-09 20:39:10 +0000 |
commit | c659acbb8d7a6b0c8098646981124a47f15cceae (patch) | |
tree | 41667f3f21e4870cbfed41f89944921637779134 /mnt.c | |
parent | 1a7f32d0d8a48b9f26f595d0fa9f5db0c657bc3a (diff) | |
download | cmogstored-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.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -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; } |