summaryrefslogtreecommitdiffstats
path: root/xlators/features/upcall
diff options
context:
space:
mode:
authorPoornima G <pgurusid@redhat.com>2016-08-25 10:09:20 +0530
committerNiels de Vos <ndevos@redhat.com>2016-08-31 06:44:01 -0700
commit9d8bbbb8f68a0c45bfbb2e891cdbd9b9a1121259 (patch)
tree7ca2123a7783fa268a6d49fcc21f67e9c826baf4 /xlators/features/upcall
parentadd85dda0127262164123c6373d55ff2cf9bb14b (diff)
upcall: Mark the clients as accessed on readdirp entries
Currently when a client performs a readdirp it is not stored in upcall, as one of the clients that have accessed the files. Hence, when any other client modifies the file, the client that had performed readdirp will not get any notifications. Fix this by adding the clients to upcall database when they perform readdirp. Change-Id: I7767f1e26bf1bd1f67702a6d01f8aa64526ccc46 BUG: 1369430 Signed-off-by: Poornima G <pgurusid@redhat.com> Reviewed-on: http://review.gluster.org/15313 Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: soumya k <skoduri@redhat.com> Reviewed-by: Niels de Vos <ndevos@redhat.com>
Diffstat (limited to 'xlators/features/upcall')
-rw-r--r--xlators/features/upcall/src/upcall.c43
1 files changed, 42 insertions, 1 deletions
diff --git a/xlators/features/upcall/src/upcall.c b/xlators/features/upcall/src/upcall.c
index c7b74ed3c29..2e1dd60187d 100644
--- a/xlators/features/upcall/src/upcall.c
+++ b/xlators/features/upcall/src/upcall.c
@@ -1304,6 +1304,47 @@ err:
}
int32_t
+up_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno, gf_dirent_t *entries,
+ dict_t *xdata)
+{
+ client_t *client = NULL;
+ uint32_t flags = 0;
+ upcall_local_t *local = NULL;
+ gf_dirent_t *entry = NULL;
+
+ EXIT_IF_UPCALL_OFF (this, out);
+
+ client = frame->root->client;
+ local = frame->local;
+
+ if ((op_ret < 0) || !local) {
+ goto out;
+ }
+ flags = UP_UPDATE_CLIENT;
+ upcall_cache_invalidate (frame, this, client, local->inode, flags,
+ NULL, NULL, NULL, NULL);
+
+ /* upcall_cache_invalidate optimises, by not calling inode_ctx_get
+ * if local->upcall_inode_ctx is set. Hence before processing
+ * the readdir entries unset this */
+ local->upcall_inode_ctx = NULL;
+ list_for_each_entry (entry, &entries->list, list) {
+ if (entry->inode == NULL) {
+ continue;
+ }
+ upcall_cache_invalidate (frame, this, client, entry->inode,
+ flags, &entry->d_stat, NULL, NULL,
+ NULL);
+ }
+
+out:
+ UPCALL_STACK_UNWIND (readdirp, frame, op_ret, op_errno, entries, xdata);
+
+ return 0;
+}
+
+int32_t
up_readdirp (call_frame_t *frame, xlator_t *this,
fd_t *fd, size_t size, off_t off, dict_t *dict)
{
@@ -1319,7 +1360,7 @@ up_readdirp (call_frame_t *frame, xlator_t *this,
}
out:
- STACK_WIND (frame, up_readdir_cbk,
+ STACK_WIND (frame, up_readdirp_cbk,
FIRST_CHILD(this), FIRST_CHILD(this)->fops->readdirp,
fd, size, off, dict);