Re: dcache problems with vfat

Gordon Chaffee (chaffee@cs.berkeley.edu)
Wed, 6 Jan 1999 01:32:59 -0800 (PST)


Alexander Viro writes:
> All this aliases-related stuff looks ugly. Try
> $ mkdir a.long
> $ cd a~1.lon
> $ mkdir b
> $ cd b
> $ mv ../../a.long .
>
> ... and watch the fun.

Didn't quite get the untested patch to compile. Here is the version
that at least compiles. Don't know if it works although it looks reasonble
to me.

- Gordon

--- fs/vfat/namei.c~ Tue Dec 1 23:52:55 1998
+++ fs/vfat/namei.c Wed Jan 6 01:28:24 1999
@@ -1639,6 +1639,26 @@
return res;
}

+int vfat_equiv(struct dentry *dentry1, struct dentry *dentry2)
+{
+ struct list_head *head, *tmp;
+ struct dentry *alias;
+
+ if (dentry1 == dentry2) return 1;
+
+ head = &dentry1->d_inode->i_dentry;
+ if (dentry1->d_inode) {
+ tmp = dentry1->d_inode->i_dentry.next;
+ while (tmp != head) {
+ alias = list_entry(tmp, struct dentry, d_alias);
+ if (alias == dentry2)
+ return 1;
+ tmp = tmp->next;
+ }
+ }
+ return 0;
+}
+
int vfat_rename(struct inode *old_dir,struct dentry *old_dentry,
struct inode *new_dir,struct dentry *new_dentry)
{
@@ -1690,7 +1710,7 @@
walk = new_dentry;
/* prevent moving directory below itself */
for (;;) {
- if (walk == old_dentry) return -EINVAL;
+ if (vfat_equiv(walk, old_dentry)) return -EINVAL;
if (walk == walk->d_parent) break;
walk = walk->d_parent;
}

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