Re: [PATCH] Support for dx directories in ext3_get_parent (NFSD)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On May 09, 2005  10:57 +0200, Henrik Grubbström wrote:
> The 2.6.10 ext3_get_parent attempts to use ext3_find_entry to look up the
> entry "..", which fails for dx directories since ".." is not present in
> the directory hash table. The patch below solves this by looking up the
> dotdot entry in the dx_root block.
> 
> Typical symptoms of the above bug are intermittent claims by nfsd that
> files or directories are missing on exported ext3 filesystems.
> 
> cf https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=150759
> and https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=144556
> 
> Signed-off-by: Henrik Grubbström <[email protected]>

ext3_get_parent() is IMHO the wrong place to fix this bug as it introduces
a lot of internals from htree into that function.  Instead, I think this
should be fixed in ext3_find_entry() as in the below patch.  This has the
added advantage that it works for any callers of ext3_find_entry() and not
just ext3_lookup_parent().

I thought I submitted this patch to l-k at one point, but now I can't find
any mention of that in the archives...

Signed-off-by: Andreas Diler <[email protected]>

--- linux-2.6.orig/fs/ext3/namei.c	2005-04-04 05:06:46.000000000 -0600
+++ linux-2.6/fs/ext3/namei.c	2005-04-04 05:09:18.000000000 -0600
@@ -926,8 +926,16 @@
 	struct inode *dir = dentry->d_parent->d_inode;
 
 	sb = dir->i_sb;
-	if (!(frame = dx_probe(dentry, NULL, &hinfo, frames, err)))
-		return NULL;
+	/* NFS may look up ".." - look at dx_root directory block */
+	if (namelen > 2 || name[0] != '.'||(name[1] != '.' && name[1] != '\0')){
+		if (!(frame = dx_probe(dentry, NULL, &hinfo, frames, err)))
+			return NULL;
+	} else {
+		frame = frames;
+		frame->bh = NULL;			/* for dx_release() */
+		frame->at = (struct dx_entry *)frames;	/* hack for zero entry*/
+		dx_set_block(frame->at, 0);		/* dx_root block is 0 */
+	}
 	hash = hinfo.hash;
 	do {
 		block = dx_get_block(frame->at);

Cheers, Andreas
--
Andreas Dilger
Principal Software Engineer
Cluster File Systems, Inc.

Attachment: pgp4P9ktyRHpf.pgp
Description: PGP signature


[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux