Skip to contentSkip to conversation

NFS filehandle check

PATCH New Wendy Cheng 2 participants 6 messages Feb 6, 2007 – Feb 23, 2007 GFS2 file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 NFS filehandle check

File handle checking error found in '07 NFS connectathon. The fh_type and fh_len are not necessarily identical. Some of the client machines could fail mount with stale filehandle without this patch.

 ops_export.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
fs/gfs2/ops_export.c +2 -4
@@ -39,14 +39,15 @@ static struct dentry *gfs2_decode_fh(str
 	struct gfs2_fh_obj fh_obj;
 	struct gfs2_inum_host *this, parent;
 
-	if (fh_type != fh_len)
-		return NULL;
-
 	this 		= &fh_obj.this;
 	fh_obj.imode 	= DT_UNKNOWN;
 	memset(&parent, 0, sizeof(struct gfs2_inum));
 
-	switch (fh_type) {
+	if (fh_type != fh_len) {
+                printk("warning: fh_type=%d != fh_len=%d\n", fh_type,

fh_len);
+ }
+
+ switch (fh_len) {
case GFS2_LARGE_FH_SIZE:
parent.no_formal_ino = ((u64)be32_to_cpu(fh[4])) << 32; parent.no_formal_ino |= be32_to_cpu(fh[5]);

#1 lore raw

PATCH 1/1 NFS filehandle check

Hi,

Did you intend to leave that printk in there?

Steve.

Quoted 34 lines · Wendy Cheng

File handle checking error found in '07 NFS connectathon. The fh_type and fh_len are not necessarily identical. Some of the client machines could fail mount with stale filehandle without this patch.

 ops_export.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
fs/gfs2/ops_export.c +5 -4
@@ -39,14 +39,15 @@ static struct dentry *gfs2_decode_fh(str
 	struct gfs2_fh_obj fh_obj;
 	struct gfs2_inum_host *this, parent;
 
-	if (fh_type != fh_len)
-		return NULL;
-
 	this 		= &fh_obj.this;
 	fh_obj.imode 	= DT_UNKNOWN;
 	memset(&parent, 0, sizeof(struct gfs2_inum));
 
-	switch (fh_type) {
+	if (fh_type != fh_len) {
+                printk("warning: fh_type=%d != fh_len=%d\n", fh_type,
 fh_len);
+        }
+
+	switch (fh_len) {
 	case GFS2_LARGE_FH_SIZE:
 		parent.no_formal_ino = ((u64)be32_to_cpu(fh[4])) << 32;

parent.no_formal_ino |= be32_to_cpu(fh[5]);

#2 lore raw

PATCH 1/1 NFS filehandle check

Quoted 3 lines · Steven Whitehouse

Hi,

Did you intend to leave that printk in there?

Yes .. will that be an issue ?

BTW, GFS2 can't support NFS V2 at this moment (since its max fh size is 32 bytes while GFS2 requires 40 bytes fh).

-- Wendy

#3 lore raw

PATCH 1/1 NFS filehandle check

Hi,

Quoted 7 lines · Wendy Cheng
Quoted 3 lines · Steven Whitehouse

Hi,

Did you intend to leave that printk in there?

Yes .. will that be an issue ?

I presume that it doesn't trigger in normal use? or at least the thing I'm worried about is that we'll fill up peoples logs if this happens too often.

Quoted 5 lines

BTW, GFS2 can't support NFS V2 at this moment (since its max fh size is 32 bytes while GFS2 requires 40 bytes fh).

-- Wendy

Ok, we might be able to make some changes there I think,

Steve.

#5 lore raw

PATCH 1/1 NFS filehandle check

Hi,

Quoted 8 lines · Wendy Cheng

Steve,

I removed the printk.....

Wendy
---

Now applied to the git tree. Thanks,

Steve.