diff options
| author | Soumya Koduri <skoduri@redhat.com> | 2015-04-22 22:34:41 +0530 | 
|---|---|---|
| committer | Vijay Bellur <vbellur@redhat.com> | 2015-05-07 04:21:38 -0700 | 
| commit | add1ee3a479395feba36afd37d16b9a635669715 (patch) | |
| tree | 1c43517c3cffac59d0a3f438ed17e921976b2385 /api/src | |
| parent | 544004cb941efebc13d2e8c296d209965507adc8 (diff) | |
gfapi: Skip and delete the upcall entry if not found
We could run into situations where in gfapi received a upcall
notification for a file and the file may have got deleted by then.
Hence, incase of error while trying to create handle from gfid,
log it, delete the entry and return with CBK_NULL reason.
Change-Id: I191f10f44d6804be07734a6be63a3ca08f455f0e
BUG: 1218566
Signed-off-by: Soumya Koduri <skoduri@redhat.com>
Reviewed-on: http://review.gluster.org/10341
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Reviewed-on: http://review.gluster.org/10565
Tested-by: NetBSD Build System
Diffstat (limited to 'api/src')
| -rw-r--r-- | api/src/glfs-handleops.c | 52 | 
1 files changed, 32 insertions, 20 deletions
diff --git a/api/src/glfs-handleops.c b/api/src/glfs-handleops.c index e22b541b4ac..b02aefc7477 100644 --- a/api/src/glfs-handleops.c +++ b/api/src/glfs-handleops.c @@ -1756,26 +1756,38 @@ pub_glfs_h_poll_upcall (struct glfs *fs, struct callback_arg *up_arg)                                                      NULL);                  if (!object) { -                        errno = ENOMEM; -                        goto out; -                } - -                upcall_data = &u_list->upcall_data; - -                switch (upcall_data->event_type) { -                case GF_UPCALL_CACHE_INVALIDATION: -                        /* XXX: Need to revisit this to support -                         * GFAPI_INODE_UPDATE if required. -                         */ -                        ca_data = upcall_data->data; -                        GF_VALIDATE_OR_GOTO ("glfs_h_poll_upcall", -                                             ca_data, out); -                        reason = GFAPI_INODE_INVALIDATE; -                        up_arg->flags = ca_data->flags; -                        up_arg->expire_time_attr = ca_data->expire_time_attr; -                        break; -                default: -                        break; +                        /* It could so happen that the file which got +                         * upcall notification may have got deleted +                         * by other thread. Irrespective of the error, +                         * log it and return with CBK_NULL reason. +                         * +                         * Applications will ignore this notification +                         * as up_arg->object will be NULL */ +                        gf_log (subvol->name, GF_LOG_WARNING, +                                "handle creation of %s failed: %s", +                                uuid_utoa (gfid), strerror (errno)); + +                        reason = GFAPI_CBK_EVENT_NULL; +                } else { + +                        upcall_data = &u_list->upcall_data; + +                        switch (upcall_data->event_type) { +                        case GF_UPCALL_CACHE_INVALIDATION: +                                /* XXX: Need to revisit this to support +                                 * GFAPI_INODE_UPDATE if required. +                                 */ +                                ca_data = upcall_data->data; +                                GF_VALIDATE_OR_GOTO ("glfs_h_poll_upcall", +                                                     ca_data, out); +                                reason = GFAPI_INODE_INVALIDATE; +                                up_arg->flags = ca_data->flags; +                                up_arg->expire_time_attr = ca_data->expire_time_attr; + +                                break; +                        default: +                                break; +                        }                  }                  up_arg->object = object;  | 
