linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
To: Linus Torvalds <torvalds@osdl.org>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] vfat dentry handling fix (3/11)
Date: Tue, 22 Jul 2003 00:52:39 +0900	[thread overview]
Message-ID: <87fzkzx4fs.fsf@devron.myhome.or.jp> (raw)

Intent of this fixes following case of vfat_revalidate().

before:
	# mount -t vfat /dev/hda6 /mnt -o shortname=winnt
	# cd /mnt
	# cat File.Txt			# make negative dentry
	cat: File.Txt: No such file or directory
	# touch file.txt		# match negative dentry
	# ls
	File.Txt

after:
	# mount -t vfat /dev/hda6 /mnt -o shortname=winnt
	# cd /mnt
	# cat File.Txt			# make negative dentry
	cat: File.Txt: No such file or directory
	# touch file.txt		# match negative dentry
	# ls
	file.txt


 fs/vfat/namei.c |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)

diff -puN fs/vfat/namei.c~fat_dentry-handling-fix fs/vfat/namei.c
--- linux-2.6.0-test1/fs/vfat/namei.c~fat_dentry-handling-fix	2003-07-21 02:48:14.000000000 +0900
+++ linux-2.6.0-test1-hirofumi/fs/vfat/namei.c	2003-07-21 02:48:14.000000000 +0900
@@ -23,6 +23,7 @@
 #include <linux/slab.h>
 #include <linux/smp_lock.h>
 #include <linux/buffer_head.h>
+#include <linux/namei.h>
 
 #define DEBUG_LEVEL 0
 #if (DEBUG_LEVEL >= 1)
@@ -70,14 +71,20 @@ static struct dentry_operations vfat_den
 
 static int vfat_revalidate(struct dentry *dentry, struct nameidata *nd)
 {
+	int ret = 1;
 	PRINTK1(("vfat_revalidate: %s\n", dentry->d_name.name));
 	spin_lock(&dcache_lock);
-	if (dentry->d_time == dentry->d_parent->d_inode->i_version) {
-		spin_unlock(&dcache_lock);
-		return 1;
-	}
+	if (nd && !(nd->flags & LOOKUP_CONTINUE) && (nd->flags & LOOKUP_CREATE))
+		/*
+		 * negative dentry is dropped, in order to make sure
+		 * to use the name which a user desires if this is
+		 * create path.
+		 */
+		ret = 0;
+	else if (dentry->d_time != dentry->d_parent->d_inode->i_version)
+		ret = 0;
 	spin_unlock(&dcache_lock);
-	return 0;
+	return ret;
 }
 
 static inline unsigned char

_

-- 
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

                 reply	other threads:[~2003-07-21 15:38 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87fzkzx4fs.fsf@devron.myhome.or.jp \
    --to=hirofumi@mail.parknet.co.jp \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).