diff options
author | Raghavendra Bhat <raghavendra@redhat.com> | 2014-07-03 17:13:38 +0530 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2014-07-16 02:27:50 -0700 |
commit | 1dea949cb60c3814c9206df6ba8dddec8d471a94 (patch) | |
tree | 4685ce644e5d4f813eb4dd9309b7b335e20ffd6c /xlators/performance | |
parent | dcc1696045f12127ff37e6312a04c0024c8a4e24 (diff) |
make snapview-server more compatible with NFS server
* There was no handle based API for listxattr. With this change, glfs_h_getxattrs
also handles the listxattr functionality by checking whether the name is NULL
or not (like posix). But all the gfapi functions for listxattr
(glfs_h_getxattrs AND glfs_listxattr AND glfs_flistxattr) returns the names of
the xattrs in a buffer provided by the caller. But snapview-server has to
return the list of xattrs in a dict itself (similar to posix xlator). But
the buffer just contains the names of the xattrs. So for each xattr, a zero
byte value is set (i.e. "") into the dict and sent back. Translators which
do xattr caching (as of now md-cache which caches selinux and acl related
xattrs) should not cache those xattrs whose value is a zero byte data ("").
So made changes in md-cache to ignore zero byte values.
* NFS server was not linking the inodes to inode table in readdirp. This was
leading to applications getting errors. The below set of operations would
lead to applications getting error
1) ls -l in one of the snaopshots (snapview-server would generate gfids for
each entry on the fly and link the inodes associated with those entries)
2) NFS server upon getting readdirp reply would not link the inodes of the
entries. But it used to generate filehandles for each entry and associate
the gfid of that entry with the filehandle and send it as part of the
reply to nfs client.
3) NFS client would send the filehandle of one of those entries when some
activity is done on it.
4) NFS server would not be able to find the inode for the gfid present in the
filehandle (as the inode was not linked) and would go for hard resolution
by sending a lookup on the gfid by creating a new inode.
5) snapview-client will not able to identify whether the inode is a real inode
existing in the main volume or a virtual inode existing in the snapshots
as there would not be any inode context.
6) Since the gfid upon which lookup is sent is a virtual gfid which is not
present in the disk, lookup would fail and the application would get an
error.
To handle above situation, now nfs server also does inode linking in readdirp.
Change-Id: Ibb191408347b6b5f21cff72319ccee619ea77bcd
BUG: 1115949
Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com>
Reviewed-on: http://review.gluster.org/8230
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Niels de Vos <ndevos@redhat.com>
Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/performance')
-rw-r--r-- | xlators/performance/md-cache/src/md-cache.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/xlators/performance/md-cache/src/md-cache.c b/xlators/performance/md-cache/src/md-cache.c index 7588463b891..782d258f47c 100644 --- a/xlators/performance/md-cache/src/md-cache.c +++ b/xlators/performance/md-cache/src/md-cache.c @@ -486,6 +486,25 @@ updatefn(dict_t *dict, char *key, data_t *value, void *data) } } + /* posix xlator as part of listxattr will send both names + * and values of the xattrs in the dict. But as per man page + * listxattr is mainly supposed to send names of the all the + * xattrs. gfapi, as of now will put all the keys it obtained + * in the dict (sent by posix) into a buffer provided by the + * caller (thus the values of those xattrs are lost). If some + * xlator makes gfapi based calls (ex: snapview-server), then + * it has to unwind the calls by putting those names it got + * in the buffer again into the dict. But now it would not be + * having the values for those xattrs. So it might just put + * a 0 byte value ("") into the dict for each xattr and unwind + * the call. So the xlators which cache the xattrs (as of now + * md-cache caches the acl and selinux related xattrs), should + * not update their cache if the value of a xattr is a 0 byte + * data (i.e. ""). + */ + if (!strcmp (value->data, "")) + continue; + if (dict_set(u->dict, key, value) < 0) { u->ret = -1; return -1; |