diff options
author | Soumya Koduri <skoduri@redhat.com> | 2015-04-22 22:34:41 +0530 |
---|---|---|
committer | Kaleb KEITHLEY <kkeithle@redhat.com> | 2015-05-04 16:27:21 -0700 |
commit | f8bb9ac26aad8c0068bcc45a34ecb4a73cc06e7a (patch) | |
tree | 939408bbf26b663a94f53764d3b7c0579f541c34 | |
parent | 21515b3331d8d72011fef79008bcaff8ca43647a (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: 1213773
Signed-off-by: Soumya Koduri <skoduri@redhat.com>
Reviewed-on: http://review.gluster.org/10341
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
-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 b3f65e05fef..c3ac789569d 100644 --- a/api/src/glfs-handleops.c +++ b/api/src/glfs-handleops.c @@ -1705,26 +1705,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; |