Re: VFAT patch (Re: 2.1.114: VFAT corrupts first block of a file)

Linus Torvalds (torvalds@transmeta.com)
Sat, 8 Aug 1998 10:35:28 -0700 (PDT)


On Sat, 8 Aug 1998, Gordon Chaffee wrote:
>
> Thanks for the very clear script. This patch should fix the problem.
> Unless there is some other type of corruption I'm not aware of, I think
> that takes care of one of the showstoppers that I saw on Alan's list.
>
> - Gordon
>
> --- linux-2.1.115-clean/fs/vfat/namei.c Tue Jul 28 10:17:49 1998
> +++ linux/fs/vfat/namei.c Sat Aug 8 03:09:01 1998
> @@ -1822,6 +1822,8 @@
> put_new_inode = 0;
> }
>
> + clear_inode(old_inode);
> +
> rename_done:
> if (locked)
> fat_unlock_creation();

This looks strange. It's almost never correct do do a clear_inode() on an
inode in this manner: the clear_inode should be called when the inode is
free'd.

I've applied the patch, but I'd ask you to look a bit deeper: as far as I
can tell there might for example be a missing "fat_delete_inode()" call
somewhere.

The VFS layer will call the "delete" function on iput(), and if it doesn't
get called it may mean that:

- the inode counts are wrong for some reason

OR

- you haven't cleared "inode->i_nlink" when you marked the old inode
deleted, so the VFS layer doesn't know that it should call the delete
function..

The i_nlink thing looks like the more likely suspect.

Linus

-
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.altern.org/andrebalsa/doc/lkml-faq.html