diff options
author | Kevin Vigor <kvigor@fb.com> | 2017-01-05 12:21:20 -0800 |
---|---|---|
committer | Kevin Vigor <kvigor@fb.com> | 2017-01-05 12:21:20 -0800 |
commit | c27aa58e72cf528583c585691e65abdb765535e5 (patch) | |
tree | fae75e5b924ac4fb80a3d4ed42203638732fbb52 /api/src/glfs-internal.h | |
parent | 63403742f53ec59a6acbe26ff4c39bab1b0842ed (diff) | |
parent | cb8bc3396d16e777d9a2683886fefd43e747e8a3 (diff) |
Merge remote-tracking branch 'origin/release-3.8' into merge-3.8-again
Change-Id: I844adf2aef161a44d446f8cd9b7ebcb224ee618a
Signed-off-by: Kevin Vigor <kvigor@fb.com>
Diffstat (limited to 'api/src/glfs-internal.h')
-rw-r--r-- | api/src/glfs-internal.h | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/api/src/glfs-internal.h b/api/src/glfs-internal.h index f69df15715c..6ff9aada0c5 100644 --- a/api/src/glfs-internal.h +++ b/api/src/glfs-internal.h @@ -327,17 +327,26 @@ do { \ we can give up the mutex during syncop calls so that bottom up calls (particularly CHILD_UP notify) can do a mutex_lock() on @glfs without deadlocking - the filesystem + the filesystem. + + All the fops should wait for graph migration to finish + before starting the fops. Therefore these functions should + call glfs_lock with wait_for_migration as true. But waiting + for migration to finish in call-back path can result thread + dead-locks. The reason for this is we only have finite + number of epoll threads. so if we wait on epoll threads + there will not be any thread left to handle outstanding + rpc replies. */ static inline int -glfs_lock (struct glfs *fs) +glfs_lock (struct glfs *fs, gf_boolean_t wait_for_migration) { pthread_mutex_lock (&fs->mutex); while (!fs->init) pthread_cond_wait (&fs->cond, &fs->mutex); - while (fs->migration_in_progress) + while (wait_for_migration && fs->migration_in_progress) pthread_cond_wait (&fs->cond, &fs->mutex); return 0; |