summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSoumya Koduri <skoduri@redhat.com>2019-06-07 19:33:07 +0530
committergluster-ant <bugzilla-bot@gluster.org>2019-06-07 19:33:07 +0530
commitc643942635c5f9cf6959e08a8509ef33cb1e0bf3 (patch)
treeab25775d28cee1688ec8559b41c1bd7ce2dcd9e5
parent8cab5e6288bd4888b3083c443af9414aae66bc3d (diff)
downloadglusterfs-c643942635c5f9cf6959e08a8509ef33cb1e0bf3.tar.gz
glusterfs-c643942635c5f9cf6959e08a8509ef33cb1e0bf3.tar.xz
glusterfs-c643942635c5f9cf6959e08a8509ef33cb1e0bf3.zip
upcall: Avoid sending notifications for invalid inodes
For nameless LOOKUPs, server creates a new inode which shall remain invalid until the fop is successfully processed post which it is linked to the inode table. But incase if there is an already linked inode for that entry, it discards that newly created inode which results in upcall notification. This may result in client being bombarded with unnecessary upcalls affecting performance if the data set is huge. This issue can be avoided by looking up and storing the upcall context in the original linked inode (if exists), thus saving up on those extra callbacks. Change-Id: I044a1737819bb40d1a049d2f53c0566e746d2a17 fixes: bz#1718338 Signed-off-by: Soumya Koduri <skoduri@redhat.com>
-rw-r--r--xlators/features/upcall/src/upcall-internal.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/xlators/features/upcall/src/upcall-internal.c b/xlators/features/upcall/src/upcall-internal.c
index f042577c51..978825f6b5 100644
--- a/xlators/features/upcall/src/upcall-internal.c
+++ b/xlators/features/upcall/src/upcall-internal.c
@@ -479,6 +479,7 @@ upcall_cache_invalidate(call_frame_t *frame, xlator_t *this, client_t *client,
upcall_inode_ctx_t *up_inode_ctx = NULL;
gf_boolean_t found = _gf_false;
time_t time_now;
+ inode_t *linked_inode = NULL;
if (!is_upcall_enabled(this))
return;
@@ -491,7 +492,20 @@ upcall_cache_invalidate(call_frame_t *frame, xlator_t *this, client_t *client,
return;
}
- if (inode)
+ /* For nameless LOOKUPs, inode created shall always be
+ * invalid. Hence check if there is any already linked inode.
+ * If yes, update the inode_ctx of that valid inode
+ */
+ if (inode && (inode->ia_type == IA_INVAL) && stbuf) {
+ linked_inode = inode_find(inode->table, stbuf->ia_gfid);
+ if (linked_inode) {
+ gf_log("upcall", GF_LOG_DEBUG,
+ "upcall_inode_ctx_get of linked inode (%p)", inode);
+ up_inode_ctx = upcall_inode_ctx_get(linked_inode, this);
+ }
+ }
+
+ if (inode && !up_inode_ctx)
up_inode_ctx = upcall_inode_ctx_get(inode, this);
if (!up_inode_ctx) {
@@ -561,6 +575,9 @@ upcall_cache_invalidate(call_frame_t *frame, xlator_t *this, client_t *client,
}
pthread_mutex_unlock(&up_inode_ctx->client_list_lock);
out:
+ /* release the ref from inode_find */
+ if (linked_inode)
+ inode_unref(linked_inode);
return;
}