the problem of dentry cache handling on vfat

OGAWA Hirofumi (hirofumi@mail.parknet.co.jp)
16 Aug 2001 00:04:47 +0900


Hi,

I found the problem of vfat, it miss handling the dentry cache.
This problem reproduce by the following operations.

------------------------------------------------------------
root@devron (/)[503]# mount -t vfat /dev/hda2 /mnt/
root@devron (/)[505]# touch /mnt/File.Txt
root@devron (/)[506]# ls /mnt/
File.Txt
root@devron (/)[507]# umount /mnt/
root@devron (/)[508]# mount -t vfat /dev/hda2 /mnt/
root@devron (/)[509]# rm -f /mnt/File.Txt
root@devron (/)[510]# touch /mnt/file.txt
root@devron (/)[511]# ls /mnt/
File.Txt
root@devron (/)[512]#
------------------------------------------------------------

The above created `File.Txt', although creating `file.txt'.
This problem hit the dentry cache, and vfat create the file by old
filename.

Umm, How should this problem be solved?
IMHO, the following.

a) delete the negative dentry cache

static struct dentry_operations vfat_relaxed_dentry_ops = {
d_hash: vfat_hashi,
d_compare: vfat_cmpi,
d_delete: vfat_dentry_delete,
};
static int vfat_dentry_delete(struct dentry *dentry)
{
PRINTK1(("vfat_dentry_delete: %s, %p\n",
dentry->d_name.name, dentry->d_inode));
if (dentry->d_inode != NULL)
return 0;

return 1;
}

b) add d_revalidate to all dentry cache

static struct dentry_operations vfat_dentry_ops = {
d_revalidate: vfat_revalidate,
d_hash: vfat_hashi,
d_compare: vfat_cmpi,
};
struct dentry *vfat_lookup(struct inode *dir,struct dentry *dentry)
{
inode = NULL;
res = vfat_find(dir,&dentry->d_name,&sinfo,&bh,&de);
if (res < 0)
goto error;

...

error:
dentry->d_op = dir->i_sb->s_root->d_op;
dentry->d_time = dentry->d_parent->d_inode->i_version;
d_add(dentry,inode);
return NULL;
}

c) other??

I don't know what is good. Please advise.

Thanks.

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

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/