|
|
21ab4e |
From cd8d8bf659af5c7a159d3c65361fd140909f2232 Mon Sep 17 00:00:00 2001
|
|
|
21ab4e |
From: Poornima G <pgurusid@redhat.com>
|
|
|
21ab4e |
Date: Fri, 2 Jun 2017 10:05:33 +0530
|
|
|
21ab4e |
Subject: [PATCH 502/509] upcall: Update the access time in missing cases
|
|
|
21ab4e |
|
|
|
21ab4e |
Issue: In fops like rename, link, unlink etc, the parent
|
|
|
21ab4e |
dirrs' client access time was not being updated. And in fops like
|
|
|
21ab4e |
create, link, symlink etc. the new file/dirs' client access time was
|
|
|
21ab4e |
not updated.
|
|
|
21ab4e |
|
|
|
21ab4e |
Solution: Update the client access time for both parent and new entry.
|
|
|
21ab4e |
|
|
|
21ab4e |
> Reviewed-on: https://review.gluster.org/17450
|
|
|
21ab4e |
> Smoke: Gluster Build System <jenkins@build.gluster.org>
|
|
|
21ab4e |
> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
|
|
|
21ab4e |
> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
|
|
|
21ab4e |
> Reviewed-by: Niels de Vos <ndevos@redhat.com>
|
|
|
21ab4e |
> Signed-off-by: Poornima G <pgurusid@redhat.com>
|
|
|
21ab4e |
|
|
|
21ab4e |
Change-Id: Id9f63583216ae857f6251dca15797ac66fa85430
|
|
|
21ab4e |
BUG: 1450080
|
|
|
21ab4e |
Signed-off-by: Poornima G <pgurusid@redhat.com>
|
|
|
21ab4e |
Reviewed-on: https://code.engineering.redhat.com/gerrit/108886
|
|
|
21ab4e |
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
|
|
|
21ab4e |
---
|
|
|
21ab4e |
tests/bugs/upcall/bug-1458127.t | 36 ++++++++++++++
|
|
|
21ab4e |
xlators/features/upcall/src/upcall-internal.c | 6 +--
|
|
|
21ab4e |
xlators/features/upcall/src/upcall.c | 68 ++++++++++++++++++++-------
|
|
|
21ab4e |
xlators/features/upcall/src/upcall.h | 1 -
|
|
|
21ab4e |
4 files changed, 89 insertions(+), 22 deletions(-)
|
|
|
21ab4e |
create mode 100755 tests/bugs/upcall/bug-1458127.t
|
|
|
21ab4e |
|
|
|
21ab4e |
diff --git a/tests/bugs/upcall/bug-1458127.t b/tests/bugs/upcall/bug-1458127.t
|
|
|
21ab4e |
new file mode 100755
|
|
|
21ab4e |
index 0000000..e844f37
|
|
|
21ab4e |
--- /dev/null
|
|
|
21ab4e |
+++ b/tests/bugs/upcall/bug-1458127.t
|
|
|
21ab4e |
@@ -0,0 +1,36 @@
|
|
|
21ab4e |
+#!/bin/bash
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+. $(dirname $0)/../../include.rc
|
|
|
21ab4e |
+. $(dirname $0)/../../volume.rc
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+cleanup;
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+TEST glusterd
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+TEST $CLI volume create $V0 $H0:$B0/${V0}{0}
|
|
|
21ab4e |
+EXPECT 'Created' volinfo_field $V0 'Status'
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+TEST $CLI volume set $V0 performance.nl-cache on
|
|
|
21ab4e |
+TEST $CLI volume set $V0 nl-cache-positive-entry on
|
|
|
21ab4e |
+TEST $CLI volume set $V0 nl-cache-timeout 2
|
|
|
21ab4e |
+TEST $CLI volume set $V0 features.cache-invalidation on
|
|
|
21ab4e |
+TEST $CLI volume set $V0 features.cache-invalidation-timeout 2
|
|
|
21ab4e |
+TEST $CLI volume set $V0 md-cache-timeout 20
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+TEST $CLI volume start $V0;
|
|
|
21ab4e |
+EXPECT 'Started' volinfo_field $V0 'Status';
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+TEST glusterfs --volfile-id=/$V0 --volfile-server=$H0 $M0
|
|
|
21ab4e |
+TEST glusterfs --volfile-id=/$V0 --volfile-server=$H0 $M1
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+TEST mkdir $M0/dir
|
|
|
21ab4e |
+TEST touch $M0/dir/xyz
|
|
|
21ab4e |
+#Wait until upcall clears the fact that M0 had accessed dir
|
|
|
21ab4e |
+sleep 4
|
|
|
21ab4e |
+TEST mv $M0/dir/xyz $M0/dir/xyz1
|
|
|
21ab4e |
+TEST ! ls $M0/dir/file1
|
|
|
21ab4e |
+TEST touch $M1/dir/file1
|
|
|
21ab4e |
+TEST ls $M0/dir/file1
|
|
|
21ab4e |
+TEST ls $M0/dir/file1
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+cleanup;
|
|
|
21ab4e |
diff --git a/xlators/features/upcall/src/upcall-internal.c b/xlators/features/upcall/src/upcall-internal.c
|
|
|
21ab4e |
index 43a6b20..e577db4 100644
|
|
|
21ab4e |
--- a/xlators/features/upcall/src/upcall-internal.c
|
|
|
21ab4e |
+++ b/xlators/features/upcall/src/upcall-internal.c
|
|
|
21ab4e |
@@ -542,9 +542,7 @@ upcall_cache_invalidate (call_frame_t *frame, xlator_t *this, client_t *client,
|
|
|
21ab4e |
return;
|
|
|
21ab4e |
}
|
|
|
21ab4e |
|
|
|
21ab4e |
- up_inode_ctx = ((upcall_local_t *)frame->local)->upcall_inode_ctx;
|
|
|
21ab4e |
-
|
|
|
21ab4e |
- if (!up_inode_ctx)
|
|
|
21ab4e |
+ if (inode)
|
|
|
21ab4e |
up_inode_ctx = upcall_inode_ctx_get (inode, this);
|
|
|
21ab4e |
|
|
|
21ab4e |
if (!up_inode_ctx) {
|
|
|
21ab4e |
@@ -559,7 +557,7 @@ upcall_cache_invalidate (call_frame_t *frame, xlator_t *this, client_t *client,
|
|
|
21ab4e |
* invalid till it gets linked to inode table. Read gfid from
|
|
|
21ab4e |
* the stat returned in such cases.
|
|
|
21ab4e |
*/
|
|
|
21ab4e |
- if (gf_uuid_is_null (up_inode_ctx->gfid)) {
|
|
|
21ab4e |
+ if (gf_uuid_is_null (up_inode_ctx->gfid) && stbuf) {
|
|
|
21ab4e |
/* That means inode must have been invalid when this inode_ctx
|
|
|
21ab4e |
* is created. Copy the gfid value from stbuf instead.
|
|
|
21ab4e |
*/
|
|
|
21ab4e |
diff --git a/xlators/features/upcall/src/upcall.c b/xlators/features/upcall/src/upcall.c
|
|
|
21ab4e |
index abbe3ee..a9d3c8a 100644
|
|
|
21ab4e |
--- a/xlators/features/upcall/src/upcall.c
|
|
|
21ab4e |
+++ b/xlators/features/upcall/src/upcall.c
|
|
|
21ab4e |
@@ -404,6 +404,18 @@ up_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
|
|
21ab4e |
upcall_cache_invalidate (frame, this, client, local->inode, flags,
|
|
|
21ab4e |
stbuf, postnewparent, postoldparent, NULL);
|
|
|
21ab4e |
|
|
|
21ab4e |
+ flags = UP_UPDATE_CLIENT;
|
|
|
21ab4e |
+ upcall_cache_invalidate (frame, this, client,
|
|
|
21ab4e |
+ local->rename_oldloc.parent, flags,
|
|
|
21ab4e |
+ postoldparent, NULL, NULL, NULL);
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+ if (local->rename_oldloc.parent == local->loc.parent)
|
|
|
21ab4e |
+ goto out;
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+ flags = UP_UPDATE_CLIENT;
|
|
|
21ab4e |
+ upcall_cache_invalidate (frame, this, client, local->loc.parent,
|
|
|
21ab4e |
+ flags, postnewparent, NULL, NULL, NULL);
|
|
|
21ab4e |
+
|
|
|
21ab4e |
out:
|
|
|
21ab4e |
UPCALL_STACK_UNWIND (rename, frame, op_ret, op_errno,
|
|
|
21ab4e |
stbuf, preoldparent, postoldparent,
|
|
|
21ab4e |
@@ -421,7 +433,7 @@ up_rename (call_frame_t *frame, xlator_t *this,
|
|
|
21ab4e |
|
|
|
21ab4e |
EXIT_IF_UPCALL_OFF (this, out);
|
|
|
21ab4e |
|
|
|
21ab4e |
- local = upcall_local_init (frame, this, NULL, NULL, oldloc->inode, NULL);
|
|
|
21ab4e |
+ local = upcall_local_init (frame, this, newloc, NULL, oldloc->inode, NULL);
|
|
|
21ab4e |
if (!local) {
|
|
|
21ab4e |
op_errno = ENOMEM;
|
|
|
21ab4e |
goto err;
|
|
|
21ab4e |
@@ -464,6 +476,10 @@ up_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
|
|
21ab4e |
upcall_cache_invalidate (frame, this, client, local->inode, flags,
|
|
|
21ab4e |
NULL, postparent, NULL, NULL);
|
|
|
21ab4e |
|
|
|
21ab4e |
+ flags = UP_UPDATE_CLIENT;
|
|
|
21ab4e |
+ upcall_cache_invalidate (frame, this, client, local->loc.parent,
|
|
|
21ab4e |
+ flags, postparent, NULL, NULL, NULL);
|
|
|
21ab4e |
+
|
|
|
21ab4e |
out:
|
|
|
21ab4e |
UPCALL_STACK_UNWIND (unlink, frame, op_ret, op_errno,
|
|
|
21ab4e |
preparent, postparent, xdata);
|
|
|
21ab4e |
@@ -480,7 +496,7 @@ up_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc, int xflag,
|
|
|
21ab4e |
|
|
|
21ab4e |
EXIT_IF_UPCALL_OFF (this, out);
|
|
|
21ab4e |
|
|
|
21ab4e |
- local = upcall_local_init (frame, this, NULL, NULL, loc->inode, NULL);
|
|
|
21ab4e |
+ local = upcall_local_init (frame, this, loc, NULL, loc->inode, NULL);
|
|
|
21ab4e |
if (!local) {
|
|
|
21ab4e |
op_errno = ENOMEM;
|
|
|
21ab4e |
goto err;
|
|
|
21ab4e |
@@ -520,6 +536,10 @@ up_link_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
|
|
21ab4e |
upcall_cache_invalidate (frame, this, client, local->inode, flags,
|
|
|
21ab4e |
stbuf, postparent, NULL, NULL);
|
|
|
21ab4e |
|
|
|
21ab4e |
+ flags = UP_UPDATE_CLIENT;
|
|
|
21ab4e |
+ upcall_cache_invalidate (frame, this, client, local->loc.parent,
|
|
|
21ab4e |
+ flags, postparent, NULL, NULL, NULL);
|
|
|
21ab4e |
+
|
|
|
21ab4e |
out:
|
|
|
21ab4e |
UPCALL_STACK_UNWIND (link, frame, op_ret, op_errno,
|
|
|
21ab4e |
inode, stbuf, preparent, postparent, xdata);
|
|
|
21ab4e |
@@ -536,7 +556,7 @@ up_link (call_frame_t *frame, xlator_t *this, loc_t *oldloc,
|
|
|
21ab4e |
|
|
|
21ab4e |
EXIT_IF_UPCALL_OFF (this, out);
|
|
|
21ab4e |
|
|
|
21ab4e |
- local = upcall_local_init (frame, this, NULL, NULL, oldloc->inode, NULL);
|
|
|
21ab4e |
+ local = upcall_local_init (frame, this, newloc, NULL, oldloc->inode, NULL);
|
|
|
21ab4e |
if (!local) {
|
|
|
21ab4e |
op_errno = ENOMEM;
|
|
|
21ab4e |
goto err;
|
|
|
21ab4e |
@@ -578,6 +598,10 @@ up_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
|
|
21ab4e |
upcall_cache_invalidate (frame, this, client, local->inode, flags,
|
|
|
21ab4e |
NULL, postparent, NULL, NULL);
|
|
|
21ab4e |
|
|
|
21ab4e |
+ flags = UP_UPDATE_CLIENT;
|
|
|
21ab4e |
+ upcall_cache_invalidate (frame, this, client, local->loc.parent,
|
|
|
21ab4e |
+ flags, postparent, NULL, NULL, NULL);
|
|
|
21ab4e |
+
|
|
|
21ab4e |
out:
|
|
|
21ab4e |
UPCALL_STACK_UNWIND (rmdir, frame, op_ret, op_errno,
|
|
|
21ab4e |
preparent, postparent, xdata);
|
|
|
21ab4e |
@@ -594,7 +618,7 @@ up_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc, int flags,
|
|
|
21ab4e |
|
|
|
21ab4e |
EXIT_IF_UPCALL_OFF (this, out);
|
|
|
21ab4e |
|
|
|
21ab4e |
- local = upcall_local_init (frame, this, NULL, NULL, loc->inode, NULL);
|
|
|
21ab4e |
+ local = upcall_local_init (frame, this, loc, NULL, loc->inode, NULL);
|
|
|
21ab4e |
if (!local) {
|
|
|
21ab4e |
op_errno = ENOMEM;
|
|
|
21ab4e |
goto err;
|
|
|
21ab4e |
@@ -637,6 +661,10 @@ up_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
|
|
21ab4e |
upcall_cache_invalidate (frame, this, client, local->inode, flags,
|
|
|
21ab4e |
postparent, NULL, NULL, NULL);
|
|
|
21ab4e |
|
|
|
21ab4e |
+ flags = UP_UPDATE_CLIENT;
|
|
|
21ab4e |
+ upcall_cache_invalidate (frame, this, client, local->loc.inode, flags,
|
|
|
21ab4e |
+ stbuf, NULL, NULL, NULL);
|
|
|
21ab4e |
+
|
|
|
21ab4e |
out:
|
|
|
21ab4e |
UPCALL_STACK_UNWIND (mkdir, frame, op_ret, op_errno,
|
|
|
21ab4e |
inode, stbuf, preparent, postparent, xdata);
|
|
|
21ab4e |
@@ -653,7 +681,7 @@ up_mkdir (call_frame_t *frame, xlator_t *this,
|
|
|
21ab4e |
|
|
|
21ab4e |
EXIT_IF_UPCALL_OFF (this, out);
|
|
|
21ab4e |
|
|
|
21ab4e |
- local = upcall_local_init (frame, this, NULL, NULL, loc->parent, NULL);
|
|
|
21ab4e |
+ local = upcall_local_init (frame, this, loc, NULL, loc->parent, NULL);
|
|
|
21ab4e |
if (!local) {
|
|
|
21ab4e |
op_errno = ENOMEM;
|
|
|
21ab4e |
goto err;
|
|
|
21ab4e |
@@ -692,12 +720,17 @@ up_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
|
|
21ab4e |
goto out;
|
|
|
21ab4e |
}
|
|
|
21ab4e |
|
|
|
21ab4e |
- /* As its a new file create, no need of sending notification */
|
|
|
21ab4e |
- /* However invalidate parent's entry */
|
|
|
21ab4e |
+ /* As its a new file create, no need of sending notification
|
|
|
21ab4e |
+ * However invalidate parent's entry and update that fact that the
|
|
|
21ab4e |
+ * client has accessed the newly created entry */
|
|
|
21ab4e |
flags = UP_TIMES;
|
|
|
21ab4e |
upcall_cache_invalidate (frame, this, client, local->inode, flags,
|
|
|
21ab4e |
postparent, NULL, NULL, NULL);
|
|
|
21ab4e |
|
|
|
21ab4e |
+ flags = UP_UPDATE_CLIENT;
|
|
|
21ab4e |
+ upcall_cache_invalidate (frame, this, client, local->loc.inode, flags,
|
|
|
21ab4e |
+ stbuf, NULL, NULL, NULL);
|
|
|
21ab4e |
+
|
|
|
21ab4e |
out:
|
|
|
21ab4e |
UPCALL_STACK_UNWIND (create, frame, op_ret, op_errno, fd,
|
|
|
21ab4e |
inode, stbuf, preparent, postparent, xdata);
|
|
|
21ab4e |
@@ -715,7 +748,7 @@ up_create (call_frame_t *frame, xlator_t *this,
|
|
|
21ab4e |
|
|
|
21ab4e |
EXIT_IF_UPCALL_OFF (this, out);
|
|
|
21ab4e |
|
|
|
21ab4e |
- local = upcall_local_init (frame, this, NULL, NULL, loc->parent, NULL);
|
|
|
21ab4e |
+ local = upcall_local_init (frame, this, loc, NULL, loc->parent, NULL);
|
|
|
21ab4e |
|
|
|
21ab4e |
if (!local) {
|
|
|
21ab4e |
op_errno = ENOMEM;
|
|
|
21ab4e |
@@ -1041,6 +1074,10 @@ up_mknod_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
|
|
21ab4e |
upcall_cache_invalidate (frame, this, client, local->inode, flags,
|
|
|
21ab4e |
postparent, NULL, NULL, NULL);
|
|
|
21ab4e |
|
|
|
21ab4e |
+ flags = UP_UPDATE_CLIENT;
|
|
|
21ab4e |
+ upcall_cache_invalidate (frame, this, client, local->loc.inode, flags,
|
|
|
21ab4e |
+ buf, NULL, NULL, NULL);
|
|
|
21ab4e |
+
|
|
|
21ab4e |
out:
|
|
|
21ab4e |
UPCALL_STACK_UNWIND (mknod, frame, op_ret, op_errno, inode, buf,
|
|
|
21ab4e |
preparent, postparent, xdata);
|
|
|
21ab4e |
@@ -1057,7 +1094,7 @@ up_mknod (call_frame_t *frame, xlator_t *this, loc_t *loc,
|
|
|
21ab4e |
|
|
|
21ab4e |
EXIT_IF_UPCALL_OFF (this, out);
|
|
|
21ab4e |
|
|
|
21ab4e |
- local = upcall_local_init (frame, this, NULL, NULL, loc->parent, NULL);
|
|
|
21ab4e |
+ local = upcall_local_init (frame, this, loc, NULL, loc->parent, NULL);
|
|
|
21ab4e |
if (!local) {
|
|
|
21ab4e |
op_errno = ENOMEM;
|
|
|
21ab4e |
goto err;
|
|
|
21ab4e |
@@ -1101,6 +1138,10 @@ up_symlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
|
|
21ab4e |
upcall_cache_invalidate (frame, this, client, local->inode, flags,
|
|
|
21ab4e |
postparent, NULL, NULL, NULL);
|
|
|
21ab4e |
|
|
|
21ab4e |
+ flags = UP_UPDATE_CLIENT;
|
|
|
21ab4e |
+ upcall_cache_invalidate (frame, this, client, local->loc.inode, flags,
|
|
|
21ab4e |
+ buf, NULL, NULL, NULL);
|
|
|
21ab4e |
+
|
|
|
21ab4e |
out:
|
|
|
21ab4e |
UPCALL_STACK_UNWIND (symlink, frame, op_ret, op_errno, inode, buf,
|
|
|
21ab4e |
preparent, postparent, xdata);
|
|
|
21ab4e |
@@ -1118,7 +1159,7 @@ up_symlink (call_frame_t *frame, xlator_t *this,
|
|
|
21ab4e |
|
|
|
21ab4e |
EXIT_IF_UPCALL_OFF (this, out);
|
|
|
21ab4e |
|
|
|
21ab4e |
- local = upcall_local_init (frame, this, NULL, NULL, loc->parent, NULL);
|
|
|
21ab4e |
+ local = upcall_local_init (frame, this, loc, NULL, loc->parent, NULL);
|
|
|
21ab4e |
if (!local) {
|
|
|
21ab4e |
op_errno = ENOMEM;
|
|
|
21ab4e |
goto err;
|
|
|
21ab4e |
@@ -1325,10 +1366,6 @@ up_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
|
|
21ab4e |
upcall_cache_invalidate (frame, this, client, local->inode, flags,
|
|
|
21ab4e |
NULL, NULL, NULL, NULL);
|
|
|
21ab4e |
|
|
|
21ab4e |
- /* upcall_cache_invalidate optimises, by not calling inode_ctx_get
|
|
|
21ab4e |
- * if local->upcall_inode_ctx is set. Hence before processing
|
|
|
21ab4e |
- * the readdir entries unset this */
|
|
|
21ab4e |
- local->upcall_inode_ctx = NULL;
|
|
|
21ab4e |
list_for_each_entry (entry, &entries->list, list) {
|
|
|
21ab4e |
if (entry->inode == NULL) {
|
|
|
21ab4e |
continue;
|
|
|
21ab4e |
@@ -2263,9 +2300,6 @@ upcall_local_init (call_frame_t *frame, xlator_t *this, loc_t *loc, fd_t *fd,
|
|
|
21ab4e |
if (xattr)
|
|
|
21ab4e |
local->xattr = dict_copy_with_ref (xattr, NULL);
|
|
|
21ab4e |
|
|
|
21ab4e |
- /* Shall we get inode_ctx and store it here itself? */
|
|
|
21ab4e |
- local->upcall_inode_ctx = upcall_inode_ctx_get (inode, this);
|
|
|
21ab4e |
-
|
|
|
21ab4e |
if (loc)
|
|
|
21ab4e |
loc_copy (&local->loc, loc);
|
|
|
21ab4e |
if (fd)
|
|
|
21ab4e |
diff --git a/xlators/features/upcall/src/upcall.h b/xlators/features/upcall/src/upcall.h
|
|
|
21ab4e |
index 4554248..159193f 100644
|
|
|
21ab4e |
--- a/xlators/features/upcall/src/upcall.h
|
|
|
21ab4e |
+++ b/xlators/features/upcall/src/upcall.h
|
|
|
21ab4e |
@@ -83,7 +83,6 @@ struct upcall_local {
|
|
|
21ab4e |
* pointers in 'local' which may get freed
|
|
|
21ab4e |
* in future by other thread
|
|
|
21ab4e |
*/
|
|
|
21ab4e |
- upcall_inode_ctx_t *upcall_inode_ctx;
|
|
|
21ab4e |
inode_t *inode;
|
|
|
21ab4e |
loc_t rename_oldloc;
|
|
|
21ab4e |
loc_t loc; /* required for stat in *xattr_cbk */
|
|
|
21ab4e |
--
|
|
|
21ab4e |
1.8.3.1
|
|
|
21ab4e |
|