FAT cache corruption - patch

SIDINF@fpsp.fapesp.br
Mon, 18 Mar 1996 14:36 BDB (-0200 C)


Hello,

If you are using the MSDOS or UMSDOS filesystem, sometimes appears the
message "FAT cache corruption".
This is caused when there is a rename of an open file. (The "crond" do this).
The following program shows the error:
#include <fcntl.h>
main()
{
int fd;
fd=open("/dosc/file1", O_RDWR|O_CREAT|O_TRUNC,0600);
write(fd, "1", 1);
rename("/dosc/file1", "/dosc/file2");
close(fd);
remove("/dosc/file2");
}
Where /dosc/file1 is in any MSDOS or UMSDOS file system.
If you execute this program twice the message above will appear and
you will lost one msdos disk cluster.

The following patch correts this problem: (linux-1.3.74)

--- linux/fs/msdos/namei.c.orig Thu Mar 14 16:33:43 1996
+++ linux/fs/msdos/namei.c Mon Mar 17 09:50:57 1996
@@ -590,7 +590,6 @@
mark_buffer_dirty(old_bh, 1);
/* update binary info for conversion, i_attrs */
if ((old_inode = iget(old_dir->i_sb,old_ino)) != NULL) {
- msdos_read_inode(old_inode);
MSDOS_I(old_inode)->i_attrs = is_hid
? (MSDOS_I(old_inode)->i_attrs | ATTR_HIDDEN)
: (MSDOS_I(old_inode)->i_attrs &~ ATTR_HIDDEN);

Jose Alonso <sidinf@fpsp.fapesp.br>