diff options
Diffstat (limited to 'api')
-rw-r--r-- | api/src/glfs-fops.c | 3 | ||||
-rw-r--r-- | api/src/glfs-handleops.c | 4 | ||||
-rw-r--r-- | api/src/glfs-internal.h | 1 |
3 files changed, 7 insertions, 1 deletions
diff --git a/api/src/glfs-fops.c b/api/src/glfs-fops.c index 18bac8195d0..9c31502d725 100644 --- a/api/src/glfs-fops.c +++ b/api/src/glfs-fops.c @@ -4325,7 +4325,8 @@ priv_glfs_process_upcall_event (struct glfs *fs, void *data) { ctx = fs->ctx; - if (ctx->cleanup_started) { + /* if we're not interested in upcalls (anymore), skip them */ + if (ctx->cleanup_started || !fs->cache_upcalls) { pthread_mutex_unlock (&fs->mutex); goto out; } diff --git a/api/src/glfs-handleops.c b/api/src/glfs-handleops.c index 7623b29f0cb..47bdbcbec52 100644 --- a/api/src/glfs-handleops.c +++ b/api/src/glfs-handleops.c @@ -2026,6 +2026,10 @@ pub_glfs_h_poll_upcall (struct glfs *fs, struct glfs_callback_arg *up_arg) } fs->pin_refcnt++; + + /* once we call this function, the applications seems to be + * interested in events, enable caching them */ + fs->cache_upcalls = _gf_true; } pthread_mutex_unlock (&fs->mutex); diff --git a/api/src/glfs-internal.h b/api/src/glfs-internal.h index dc4c3f7c18e..471fa5fffc1 100644 --- a/api/src/glfs-internal.h +++ b/api/src/glfs-internal.h @@ -210,6 +210,7 @@ struct glfs { gf_boolean_t migration_in_progress; + gf_boolean_t cache_upcalls; /* add upcalls to the upcall_list? */ struct list_head upcall_list; pthread_mutex_t upcall_list_mutex; /* mutex for upcall entry list */ |