|
|
50dc83 |
From e41b4a45f9f5c07ffa38582d0bb4517f6a66eaa3 Mon Sep 17 00:00:00 2001
|
|
|
50dc83 |
From: Soumya Koduri <skoduri@redhat.com>
|
|
|
50dc83 |
Date: Fri, 7 Jun 2019 19:33:07 +0530
|
|
|
50dc83 |
Subject: [PATCH 199/221] upcall: Avoid sending notifications for invalid
|
|
|
50dc83 |
inodes
|
|
|
50dc83 |
|
|
|
50dc83 |
For nameless LOOKUPs, server creates a new inode which shall
|
|
|
50dc83 |
remain invalid until the fop is successfully processed post
|
|
|
50dc83 |
which it is linked to the inode table.
|
|
|
50dc83 |
|
|
|
50dc83 |
But incase if there is an already linked inode for that entry,
|
|
|
50dc83 |
it discards that newly created inode which results in upcall
|
|
|
50dc83 |
notification. This may result in client being bombarded with
|
|
|
50dc83 |
unnecessary upcalls affecting performance if the data set is huge.
|
|
|
50dc83 |
|
|
|
50dc83 |
This issue can be avoided by looking up and storing the upcall
|
|
|
50dc83 |
context in the original linked inode (if exists), thus saving up on
|
|
|
50dc83 |
those extra callbacks.
|
|
|
50dc83 |
|
|
|
50dc83 |
This is backport of below upstream fix -
|
|
|
50dc83 |
mainline: https://review.gluster.org/22840
|
|
|
50dc83 |
release-6: https://review.gluster.org/22873
|
|
|
50dc83 |
|
|
|
50dc83 |
Change-Id: I044a1737819bb40d1a049d2f53c0566e746d2a17
|
|
|
50dc83 |
fixes: bz#1717784
|
|
|
50dc83 |
Signed-off-by: Soumya Koduri <skoduri@redhat.com>
|
|
|
50dc83 |
Reviewed-on: https://code.engineering.redhat.com/gerrit/173507
|
|
|
50dc83 |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
50dc83 |
Reviewed-by: Kaleb Keithley <kkeithle@redhat.com>
|
|
|
50dc83 |
---
|
|
|
50dc83 |
xlators/features/upcall/src/upcall-internal.c | 19 ++++++++++++++++++-
|
|
|
50dc83 |
1 file changed, 18 insertions(+), 1 deletion(-)
|
|
|
50dc83 |
|
|
|
50dc83 |
diff --git a/xlators/features/upcall/src/upcall-internal.c b/xlators/features/upcall/src/upcall-internal.c
|
|
|
50dc83 |
index 46cf6f8..7998dd2 100644
|
|
|
50dc83 |
--- a/xlators/features/upcall/src/upcall-internal.c
|
|
|
50dc83 |
+++ b/xlators/features/upcall/src/upcall-internal.c
|
|
|
50dc83 |
@@ -520,6 +520,7 @@ upcall_cache_invalidate(call_frame_t *frame, xlator_t *this, client_t *client,
|
|
|
50dc83 |
upcall_client_t *tmp = NULL;
|
|
|
50dc83 |
upcall_inode_ctx_t *up_inode_ctx = NULL;
|
|
|
50dc83 |
gf_boolean_t found = _gf_false;
|
|
|
50dc83 |
+ inode_t *linked_inode = NULL;
|
|
|
50dc83 |
|
|
|
50dc83 |
if (!is_upcall_enabled(this))
|
|
|
50dc83 |
return;
|
|
|
50dc83 |
@@ -532,7 +533,20 @@ upcall_cache_invalidate(call_frame_t *frame, xlator_t *this, client_t *client,
|
|
|
50dc83 |
return;
|
|
|
50dc83 |
}
|
|
|
50dc83 |
|
|
|
50dc83 |
- if (inode)
|
|
|
50dc83 |
+ /* For nameless LOOKUPs, inode created shall always be
|
|
|
50dc83 |
+ * invalid. Hence check if there is any already linked inode.
|
|
|
50dc83 |
+ * If yes, update the inode_ctx of that valid inode
|
|
|
50dc83 |
+ */
|
|
|
50dc83 |
+ if (inode && (inode->ia_type == IA_INVAL) && stbuf) {
|
|
|
50dc83 |
+ linked_inode = inode_find(inode->table, stbuf->ia_gfid);
|
|
|
50dc83 |
+ if (linked_inode) {
|
|
|
50dc83 |
+ gf_log("upcall", GF_LOG_DEBUG,
|
|
|
50dc83 |
+ "upcall_inode_ctx_get of linked inode (%p)", inode);
|
|
|
50dc83 |
+ up_inode_ctx = upcall_inode_ctx_get(linked_inode, this);
|
|
|
50dc83 |
+ }
|
|
|
50dc83 |
+ }
|
|
|
50dc83 |
+
|
|
|
50dc83 |
+ if (inode && !up_inode_ctx)
|
|
|
50dc83 |
up_inode_ctx = upcall_inode_ctx_get(inode, this);
|
|
|
50dc83 |
|
|
|
50dc83 |
if (!up_inode_ctx) {
|
|
|
50dc83 |
@@ -600,6 +614,9 @@ upcall_cache_invalidate(call_frame_t *frame, xlator_t *this, client_t *client,
|
|
|
50dc83 |
}
|
|
|
50dc83 |
pthread_mutex_unlock(&up_inode_ctx->client_list_lock);
|
|
|
50dc83 |
out:
|
|
|
50dc83 |
+ /* release the ref from inode_find */
|
|
|
50dc83 |
+ if (linked_inode)
|
|
|
50dc83 |
+ inode_unref(linked_inode);
|
|
|
50dc83 |
return;
|
|
|
50dc83 |
}
|
|
|
50dc83 |
|
|
|
50dc83 |
--
|
|
|
50dc83 |
1.8.3.1
|
|
|
50dc83 |
|