summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShehjar Tikoo <shehjart@gluster.com>2010-11-03 06:35:27 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-11-03 21:36:51 -0700
commitd6d7a85487d8ec8017d1d13aa36642ad0355b3e4 (patch)
tree19afd12a6943d9490ff3116e44ff211238e788c9
parent5afc77d585c480f185dd7b24b753a6924218bb86 (diff)
nfs3: More robust root gfid checks
Signed-off-by: Shehjar Tikoo <shehjart@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 2051 (find fails with loop detected error) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2051
-rw-r--r--xlators/nfs/server/src/nfs3-fh.c10
-rw-r--r--xlators/nfs/server/src/nfs3-helpers.c3
-rw-r--r--xlators/nfs/server/src/nfs3.c2
3 files changed, 10 insertions, 5 deletions
diff --git a/xlators/nfs/server/src/nfs3-fh.c b/xlators/nfs/server/src/nfs3-fh.c
index 2239148c15e..49236d609f8 100644
--- a/xlators/nfs/server/src/nfs3-fh.c
+++ b/xlators/nfs/server/src/nfs3-fh.c
@@ -68,10 +68,12 @@ nfs3_fh_build_indexed_root_fh (xlator_list_t *cl, xlator_t *xl)
{
struct nfs3_fh fh = {{0}, };
struct iatt buf = {0, };
+ uuid_t root = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1};
+
if ((!cl) || (!xl))
return fh;
- buf.ia_gfid[15] = 1;
+ uuid_copy (buf.ia_gfid, root);
nfs3_fh_init (&fh, &buf);
fh.exportid [15] = nfs_xlator_to_xlid (cl, xl);
@@ -84,8 +86,9 @@ nfs3_fh_build_uuid_root_fh (uuid_t volumeid)
{
struct nfs3_fh fh = {{0}, };
struct iatt buf = {0, };
+ uuid_t root = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1};
- buf.ia_gfid[15] = 1;
+ uuid_copy (buf.ia_gfid, root);
nfs3_fh_init (&fh, &buf);
uuid_copy (fh.exportid, volumeid);
@@ -96,12 +99,11 @@ nfs3_fh_build_uuid_root_fh (uuid_t volumeid)
int
nfs3_fh_is_root_fh (struct nfs3_fh *fh)
{
- uuid_t rootgfid = {0, 1};
+ uuid_t rootgfid = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1};
if (!fh)
return 0;
- rootgfid[15] = 1;
if (uuid_compare (fh->gfid, rootgfid) == 0)
return 1;
diff --git a/xlators/nfs/server/src/nfs3-helpers.c b/xlators/nfs/server/src/nfs3-helpers.c
index 298a5c858cf..cff029d6e72 100644
--- a/xlators/nfs/server/src/nfs3-helpers.c
+++ b/xlators/nfs/server/src/nfs3-helpers.c
@@ -94,12 +94,13 @@ struct nfs3stat_strerror nfs3stat_strerror_table[] = {
uint64_t
nfs3_iatt_gfid_to_ino (struct iatt *buf)
{
+ uuid_t gfid = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1};
uint64_t ino = 0;
if (!buf)
return 0;
- if ((buf->ia_ino != 1) && (buf->ia_gfid[15] != 1)) {
+ if ((buf->ia_ino != 1) && (uuid_compare (buf->ia_gfid, gfid) != 0)) {
if (gf_nfs_enable_ino32()) {
ino = (uint32_t )nfs_hash_gfid (buf->ia_gfid);
goto hashout;
diff --git a/xlators/nfs/server/src/nfs3.c b/xlators/nfs/server/src/nfs3.c
index 742c63aa208..d142a31f64a 100644
--- a/xlators/nfs/server/src/nfs3.c
+++ b/xlators/nfs/server/src/nfs3.c
@@ -244,12 +244,14 @@ out:
#define nfs3_funge_solaris_zerolen_fh(nfs3st, fhd, enam, nfsst, erl) \
do { \
xlator_t *fungexl = NULL; \
+ uuid_t zero = {0, }; \
fungexl =nfs_mntpath_to_xlator ((nfs3st)->exportslist,enam);\
if (!fungexl) { \
(nfsst) = NFS3ERR_NOENT; \
goto erl; \
} \
\
+ uuid_copy ((fhd)->gfid, zero); \
(fhd)->gfid[15] = 1; \
(enam) = NULL; \
if ((gf_nfs_dvm_off (nfs_state (nfs3st->nfsx)))) \