summaryrefslogtreecommitdiffstats
path: root/xlators/nfs/server/src/nfs3.c
diff options
context:
space:
mode:
authorShehjar Tikoo <shehjart@gluster.com>2010-05-31 22:43:52 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-06-01 00:23:46 -0700
commitda08199c57cedb3dc922ed6bec07932cd2aefabd (patch)
treea528dc8a8b4de1a3b9d4b21d038964919e066f50 /xlators/nfs/server/src/nfs3.c
parent5e03484d1d24ae93f7cad5fe575edd9ce8e0195b (diff)
nfs3: Funge . and .. ino/gen in readdir of root
In the readdir reply for the root of the export, replace the ino and gen number for the . and .. entries with 1 and 0 respectively. On clients which inspect this field, the client will error out due to the change in inode number of the root directory when see for "." .. also needs to be replaced because we do not have a concept of the parent directory of root. The return of 1 and 0 is the same as the behaviour of: stat /.. command. Signed-off-by: Shehjar Tikoo <shehjart@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 942 (NFS crashes as a vmware ESX data store) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=942
Diffstat (limited to 'xlators/nfs/server/src/nfs3.c')
-rw-r--r--xlators/nfs/server/src/nfs3.c44
1 files changed, 15 insertions, 29 deletions
diff --git a/xlators/nfs/server/src/nfs3.c b/xlators/nfs/server/src/nfs3.c
index 385a4a374..f09ed95d9 100644
--- a/xlators/nfs/server/src/nfs3.c
+++ b/xlators/nfs/server/src/nfs3.c
@@ -993,21 +993,6 @@ nfs3err:
int
-nfs3_is_parentdir_entry (char *entry)
-{
- int ret = 0;
-
- if (!entry)
- return 0;
-
- if (strcmp (entry, "..") == 0)
- ret = 1;
-
- return ret;
-}
-
-
-int
nfs3_lookup (rpcsvc_request_t *req, struct nfs3_fh *fh, int fhlen, char *name)
{
xlator_t *vol = NULL;
@@ -3627,16 +3612,14 @@ nfs3_readdirp_reply (rpcsvc_request_t *req, nfsstat3 stat,struct nfs3_fh *dirfh,
int
-nfs3_readdir_reply (rpcsvc_request_t *req, nfsstat3 stat, uint64_t cverf,
- struct iatt *dirstat, gf_dirent_t *entries, count3 count,
- int is_eof)
+nfs3_readdir_reply (rpcsvc_request_t *req, nfsstat3 stat, struct nfs3_fh *dirfh,
+ uint64_t cverf, struct iatt *dirstat, gf_dirent_t *entries,
+ count3 count, int is_eof)
{
readdir3res res = {0, };
- uint16_t xlid = 0;
- xlid = nfs3_request_xlator_id (req);
- nfs3_fill_readdir3res (&res, stat, cverf, dirstat, entries, count,
- is_eof, xlid);
+ nfs3_fill_readdir3res (&res, stat, dirfh, cverf, dirstat, entries, count
+ , is_eof);
nfs3svc_submit_reply (req, (void *)&res,
(nfs3_serializer) xdr_serialize_readdir3res);
nfs3_free_readdir3res (&res);
@@ -3673,9 +3656,9 @@ nfs3err:
nfs3_log_readdir_res (rpcsvc_request_xid (cs->req), stat,
op_errno, (uintptr_t)cs->fd,
cs->dircount, is_eof);
- nfs3_readdir_reply (cs->req, stat, (uintptr_t)cs->fd,
- buf, &cs->entries, cs->dircount,
- is_eof);
+ nfs3_readdir_reply (cs->req, stat, &cs->parent,
+ (uintptr_t)cs->fd, buf, &cs->entries,
+ cs->dircount, is_eof);
} else {
nfs3_log_readdirp_res (rpcsvc_request_xid (cs->req), stat,
op_errno, (uintptr_t)cs->fd,
@@ -3730,7 +3713,7 @@ err:
if (cs->maxcount == 0) {
nfs3_log_common_res (rpcsvc_request_xid (cs->req), "READDIR",
stat, op_errno);
- nfs3_readdir_reply (cs->req, stat, 0, NULL, NULL, 0, 0);
+ nfs3_readdir_reply (cs->req, stat, NULL, 0, NULL, NULL, 0, 0);
} else {
nfs3_log_common_res (rpcsvc_request_xid (cs->req), "READDIRP"
, stat, op_errno);
@@ -3791,7 +3774,8 @@ nfs3err:
if (cs->maxcount == 0) {
nfs3_log_common_res (rpcsvc_request_xid (cs->req),
"READDIR", stat, -ret);
- nfs3_readdir_reply (cs->req, stat, 0, NULL, NULL, 0, 0);
+ nfs3_readdir_reply (cs->req, stat, NULL, 0, NULL, NULL,
+ 0, 0);
} else {
nfs3_log_common_res (rpcsvc_request_xid (cs->req),
"READDIRP", stat, -ret);
@@ -3826,7 +3810,8 @@ nfs3err:
if (cs->maxcount == 0) {
nfs3_log_common_res (rpcsvc_request_xid (cs->req),
"READDIR", stat, -ret);
- nfs3_readdir_reply (cs->req, stat, 0, NULL, NULL, 0, 0);
+ nfs3_readdir_reply (cs->req, stat, NULL, 0, NULL, NULL,
+ 0, 0);
} else {
nfs3_log_common_res (rpcsvc_request_xid (cs->req),
"READDIRP", stat, -ret);
@@ -3877,7 +3862,8 @@ nfs3err:
if (maxcount == 0) {
nfs3_log_common_res (rpcsvc_request_xid (req), "READDIR"
, stat, -ret);
- nfs3_readdir_reply (req, stat, 0, NULL, NULL, 0, 0);
+ nfs3_readdir_reply (req, stat, NULL, 0, NULL, NULL, 0,
+ 0);
} else {
nfs3_log_common_res (rpcsvc_request_xid (req),"READDIRP"
, stat, -ret);