diff options
author | Poornima G <pgurusid@redhat.com> | 2017-06-02 10:05:33 +0530 |
---|---|---|
committer | Niels de Vos <ndevos@redhat.com> | 2017-06-09 11:30:31 +0000 |
commit | 149db390fd89beee1e8a3d946d4224ba2a9b4711 (patch) | |
tree | a6b32b5441ec06b3dca2b472c107641f60d9d735 /xlators/features/upcall/src/upcall.c | |
parent | 68f2192df570b5ee615d440c2e0c88d49a75a34f (diff) |
upcall: Update the access time in missing cases
Issue: In fops like rename, link, unlink etc, the parent
dirrs' client access time was not being updated. And in fops like
create, link, symlink etc. the new file/dirs' client access time was
not updated.
Solution: Update the client access time for both parent and new entry.
Change-Id: Id9f63583216ae857f6251dca15797ac66fa85430
BUG: 1458127
Signed-off-by: Poornima G <pgurusid@redhat.com>
Reviewed-on: https://review.gluster.org/17450
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: Niels de Vos <ndevos@redhat.com>
Diffstat (limited to 'xlators/features/upcall/src/upcall.c')
-rw-r--r-- | xlators/features/upcall/src/upcall.c | 68 |
1 files changed, 51 insertions, 17 deletions
diff --git a/xlators/features/upcall/src/upcall.c b/xlators/features/upcall/src/upcall.c index 0e9919d41c4..e20a2e87093 100644 --- a/xlators/features/upcall/src/upcall.c +++ b/xlators/features/upcall/src/upcall.c @@ -404,6 +404,18 @@ up_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, upcall_cache_invalidate (frame, this, client, local->inode, flags, stbuf, postnewparent, postoldparent, NULL); + flags = UP_UPDATE_CLIENT; + upcall_cache_invalidate (frame, this, client, + local->rename_oldloc.parent, flags, + postoldparent, NULL, NULL, NULL); + + if (local->rename_oldloc.parent == local->loc.parent) + goto out; + + flags = UP_UPDATE_CLIENT; + upcall_cache_invalidate (frame, this, client, local->loc.parent, + flags, postnewparent, NULL, NULL, NULL); + out: UPCALL_STACK_UNWIND (rename, frame, op_ret, op_errno, stbuf, preoldparent, postoldparent, @@ -421,7 +433,7 @@ up_rename (call_frame_t *frame, xlator_t *this, EXIT_IF_UPCALL_OFF (this, out); - local = upcall_local_init (frame, this, NULL, NULL, oldloc->inode, NULL); + local = upcall_local_init (frame, this, newloc, NULL, oldloc->inode, NULL); if (!local) { op_errno = ENOMEM; goto err; @@ -464,6 +476,10 @@ up_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, upcall_cache_invalidate (frame, this, client, local->inode, flags, NULL, postparent, NULL, NULL); + flags = UP_UPDATE_CLIENT; + upcall_cache_invalidate (frame, this, client, local->loc.parent, + flags, postparent, NULL, NULL, NULL); + out: UPCALL_STACK_UNWIND (unlink, frame, op_ret, op_errno, preparent, postparent, xdata); @@ -480,7 +496,7 @@ up_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc, int xflag, EXIT_IF_UPCALL_OFF (this, out); - local = upcall_local_init (frame, this, NULL, NULL, loc->inode, NULL); + local = upcall_local_init (frame, this, loc, NULL, loc->inode, NULL); if (!local) { op_errno = ENOMEM; goto err; @@ -520,6 +536,10 @@ up_link_cbk (call_frame_t *frame, void *cookie, xlator_t *this, upcall_cache_invalidate (frame, this, client, local->inode, flags, stbuf, postparent, NULL, NULL); + flags = UP_UPDATE_CLIENT; + upcall_cache_invalidate (frame, this, client, local->loc.parent, + flags, postparent, NULL, NULL, NULL); + out: UPCALL_STACK_UNWIND (link, frame, op_ret, op_errno, inode, stbuf, preparent, postparent, xdata); @@ -536,7 +556,7 @@ up_link (call_frame_t *frame, xlator_t *this, loc_t *oldloc, EXIT_IF_UPCALL_OFF (this, out); - local = upcall_local_init (frame, this, NULL, NULL, oldloc->inode, NULL); + local = upcall_local_init (frame, this, newloc, NULL, oldloc->inode, NULL); if (!local) { op_errno = ENOMEM; goto err; @@ -578,6 +598,10 @@ up_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, upcall_cache_invalidate (frame, this, client, local->inode, flags, NULL, postparent, NULL, NULL); + flags = UP_UPDATE_CLIENT; + upcall_cache_invalidate (frame, this, client, local->loc.parent, + flags, postparent, NULL, NULL, NULL); + out: UPCALL_STACK_UNWIND (rmdir, frame, op_ret, op_errno, preparent, postparent, xdata); @@ -594,7 +618,7 @@ up_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc, int flags, EXIT_IF_UPCALL_OFF (this, out); - local = upcall_local_init (frame, this, NULL, NULL, loc->inode, NULL); + local = upcall_local_init (frame, this, loc, NULL, loc->inode, NULL); if (!local) { op_errno = ENOMEM; goto err; @@ -637,6 +661,10 @@ up_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, upcall_cache_invalidate (frame, this, client, local->inode, flags, postparent, NULL, NULL, NULL); + flags = UP_UPDATE_CLIENT; + upcall_cache_invalidate (frame, this, client, local->loc.inode, flags, + stbuf, NULL, NULL, NULL); + out: UPCALL_STACK_UNWIND (mkdir, frame, op_ret, op_errno, inode, stbuf, preparent, postparent, xdata); @@ -653,7 +681,7 @@ up_mkdir (call_frame_t *frame, xlator_t *this, EXIT_IF_UPCALL_OFF (this, out); - local = upcall_local_init (frame, this, NULL, NULL, loc->parent, NULL); + local = upcall_local_init (frame, this, loc, NULL, loc->parent, NULL); if (!local) { op_errno = ENOMEM; goto err; @@ -692,12 +720,17 @@ up_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, goto out; } - /* As its a new file create, no need of sending notification */ - /* However invalidate parent's entry */ + /* As its a new file create, no need of sending notification + * However invalidate parent's entry and update that fact that the + * client has accessed the newly created entry */ flags = UP_TIMES; upcall_cache_invalidate (frame, this, client, local->inode, flags, postparent, NULL, NULL, NULL); + flags = UP_UPDATE_CLIENT; + upcall_cache_invalidate (frame, this, client, local->loc.inode, flags, + stbuf, NULL, NULL, NULL); + out: UPCALL_STACK_UNWIND (create, frame, op_ret, op_errno, fd, inode, stbuf, preparent, postparent, xdata); @@ -715,7 +748,7 @@ up_create (call_frame_t *frame, xlator_t *this, EXIT_IF_UPCALL_OFF (this, out); - local = upcall_local_init (frame, this, NULL, NULL, loc->parent, NULL); + local = upcall_local_init (frame, this, loc, NULL, loc->parent, NULL); if (!local) { op_errno = ENOMEM; @@ -1041,6 +1074,10 @@ up_mknod_cbk (call_frame_t *frame, void *cookie, xlator_t *this, upcall_cache_invalidate (frame, this, client, local->inode, flags, postparent, NULL, NULL, NULL); + flags = UP_UPDATE_CLIENT; + upcall_cache_invalidate (frame, this, client, local->loc.inode, flags, + buf, NULL, NULL, NULL); + out: UPCALL_STACK_UNWIND (mknod, frame, op_ret, op_errno, inode, buf, preparent, postparent, xdata); @@ -1057,7 +1094,7 @@ up_mknod (call_frame_t *frame, xlator_t *this, loc_t *loc, EXIT_IF_UPCALL_OFF (this, out); - local = upcall_local_init (frame, this, NULL, NULL, loc->parent, NULL); + local = upcall_local_init (frame, this, loc, NULL, loc->parent, NULL); if (!local) { op_errno = ENOMEM; goto err; @@ -1101,6 +1138,10 @@ up_symlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, upcall_cache_invalidate (frame, this, client, local->inode, flags, postparent, NULL, NULL, NULL); + flags = UP_UPDATE_CLIENT; + upcall_cache_invalidate (frame, this, client, local->loc.inode, flags, + buf, NULL, NULL, NULL); + out: UPCALL_STACK_UNWIND (symlink, frame, op_ret, op_errno, inode, buf, preparent, postparent, xdata); @@ -1118,7 +1159,7 @@ up_symlink (call_frame_t *frame, xlator_t *this, EXIT_IF_UPCALL_OFF (this, out); - local = upcall_local_init (frame, this, NULL, NULL, loc->parent, NULL); + local = upcall_local_init (frame, this, loc, NULL, loc->parent, NULL); if (!local) { op_errno = ENOMEM; goto err; @@ -1325,10 +1366,6 @@ up_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this, 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; @@ -2258,9 +2295,6 @@ upcall_local_init (call_frame_t *frame, xlator_t *this, loc_t *loc, fd_t *fd, if (xattr) local->xattr = dict_copy_with_ref (xattr, NULL); - /* Shall we get inode_ctx and store it here itself? */ - local->upcall_inode_ctx = upcall_inode_ctx_get (inode, this); - if (loc) loc_copy (&local->loc, loc); if (fd) |