diff options
author | vmallika <vmallika@redhat.com> | 2016-02-02 14:34:19 +0530 |
---|---|---|
committer | Rajesh Joseph <rjoseph@redhat.com> | 2016-03-10 02:44:27 -0800 |
commit | ed98d128a9413f7b8af328ca27bf4b27514d61e9 (patch) | |
tree | a1626f7315cf730570e9dd78856d1852714ad5ca /xlators/features/snapview-client/src | |
parent | e0f71288d95469d7ae82473ef273c6ba43250a36 (diff) |
gluster/uss: change ctime attr of a dir when USS enabled
Consider a testcase:
mount -t nfs host1:/vol1 /mnt
ls /mnt
ls /mnt/.snaps (As expected this fails)
gluster volume set vol1 features.uss enable
Now `ls /mnt/.snaps` should work, but fails with No such file or
directory.
This is because NFS client and Kernel VFS caches the list of files in a
directory.
This cache is updated if there are any changes in the directory attributes.
This patch solves the problem by changing ctime attribute when USS is
enabled
Change-Id: I48b284100d0589f1c0285782a1302080c15d4e1f
BUG: 1163416
Signed-off-by: vmallika <vmallika@redhat.com>
Reviewed-on: http://review.gluster.org/9106
Smoke: Gluster Build System <jenkins@build.gluster.com>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Rajesh Joseph <rjoseph@redhat.com>
Diffstat (limited to 'xlators/features/snapview-client/src')
-rw-r--r-- | xlators/features/snapview-client/src/snapview-client.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/xlators/features/snapview-client/src/snapview-client.c b/xlators/features/snapview-client/src/snapview-client.c index 5b5bf6834bf..719fa532b5b 100644 --- a/xlators/features/snapview-client/src/snapview-client.c +++ b/xlators/features/snapview-client/src/snapview-client.c @@ -526,6 +526,30 @@ out: return 0; } +int32_t +svc_stat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, struct iatt *buf, + dict_t *xdata) +{ + /* Consider a testcase: + * #mount -t nfs host1:/vol1 /mnt + * #ls /mnt + * #ls /mnt/.snaps (As expected this fails) + * #gluster volume set vol1 features.uss enable + * Now `ls /mnt/.snaps` should work, + * but fails with No such file or directory. + * This is because NFS client caches the list of files in + * a directory. This cache is updated if there are any changes + * in the directory attributes. To solve this problem change + * a attribute 'ctime' when USS is enabled + */ + if (op_ret == 0 && IA_ISDIR(buf->ia_type)) + buf->ia_ctime_nsec++; + + SVC_STACK_UNWIND (stat, frame, op_ret, op_errno, buf, xdata); + return 0; +} + /* should all the fops be handled like lookup is supposed to be handled? i.e just based on inode type decide where the call should be sent and in the call back update the contexts. @@ -549,7 +573,8 @@ svc_stat (call_frame_t *frame, xlator_t *this, loc_t *loc, SVC_GET_SUBVOL_FROM_CTX (this, op_ret, op_errno, inode_type, ret, loc->inode, subvolume, out); - STACK_WIND_TAIL (frame,subvolume, subvolume->fops->stat, loc, xdata); + STACK_WIND (frame, svc_stat_cbk, subvolume, + subvolume->fops->stat, loc, xdata); wind = _gf_true; |