Commit 83bb8e18 authored by Hirofumi Ogawa's avatar Hirofumi Ogawa Committed by Linus Torvalds

[PATCH] vfat dentry handling fix (3/11)

This fixes filename case handling in 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
parent 749f6629
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/smp_lock.h> #include <linux/smp_lock.h>
#include <linux/buffer_head.h> #include <linux/buffer_head.h>
#include <linux/namei.h>
#define DEBUG_LEVEL 0 #define DEBUG_LEVEL 0
#if (DEBUG_LEVEL >= 1) #if (DEBUG_LEVEL >= 1)
...@@ -70,14 +71,20 @@ static struct dentry_operations vfat_dentry_ops[4] = { ...@@ -70,14 +71,20 @@ static struct dentry_operations vfat_dentry_ops[4] = {
static int vfat_revalidate(struct dentry *dentry, struct nameidata *nd) static int vfat_revalidate(struct dentry *dentry, struct nameidata *nd)
{ {
int ret = 1;
PRINTK1(("vfat_revalidate: %s\n", dentry->d_name.name)); PRINTK1(("vfat_revalidate: %s\n", dentry->d_name.name));
spin_lock(&dcache_lock); spin_lock(&dcache_lock);
if (dentry->d_time == dentry->d_parent->d_inode->i_version) { if (nd && !(nd->flags & LOOKUP_CONTINUE) && (nd->flags & LOOKUP_CREATE))
spin_unlock(&dcache_lock); /*
return 1; * 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); spin_unlock(&dcache_lock);
return 0; return ret;
} }
static inline unsigned char static inline unsigned char
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment