Re: Linux-2.0.32..

Gordon Chaffee (chaffee@CS.Berkeley.EDU)
Mon, 17 Nov 1997 02:00:53 -0800 (PST)


Florian Weimer writes:
> A few weeks ago (just before 2.0.31 ;-), I reported a bug in the vfat
> filesystem: if you use rename(2) to change filenames from upper to
> lower case, you'll end up with a severely screwed up filesystem with
> cross-linked clusters. Shouldn't this problem be addressed in 2.0.32
> as well? (Unfortunately, the article containing a short patch, which
> made rename(2) return an errror in such cases, has alrady expired from
> my linux-kernel archive.)

I think this should qualify as a serious problem with vfat in 2.0.31.
This small patch fixes it so it will no longer corrupt vfat filesystems.

- Gordon

--- linux-2.0.31-clean/fs/vfat/namei.c Thu Dec 5 10:58:28 1996
+++ linux/fs/vfat/namei.c Mon Nov 17 13:57:06 1997
@@ -1439,10 +1439,13 @@
PRINTK(("vfat_rename 8\n"));
if (res < 0) goto rename_done;
} else {
- PRINTK(("vfat_rename 9\n"));
- res = vfat_unlinkx(new_dir,new_name,new_len,1);
- PRINTK(("vfat_rename 10\n"));
- if (res < 0) goto rename_done;
+ /* Is this the same file, different case? */
+ if (new_inode != old_inode) {
+ PRINTK(("vfat_rename 9\n"));
+ res = vfat_unlinkx(new_dir,new_name,new_len,1);
+ PRINTK(("vfat_rename 10\n"));
+ if (res < 0) goto rename_done;
+ }
}
}