Re: [PATCH v2 1/5] fat: allocate persistent inode numbers
From: Al Viro
Date: Tue Sep 04 2012 - 12:17:46 EST
On Wed, Sep 05, 2012 at 12:57:44AM +0900, Namjae Jeon wrote:
> From: Namjae Jeon <namjae.jeon@xxxxxxxxxxx>
>
> All the files on a FAT partition have an on-disk directory entry.
> The location of these entries, i_pos, is unique and is constructed by the
> fat_make_i_pos() function.We can use this as the inode number making it
> peristent across remounts.
> --- a/fs/fat/namei_vfat.c
> +++ b/fs/fat/namei_vfat.c
> @@ -954,6 +954,8 @@ static int vfat_rename(struct inode *old_dir, struct dentry *old_dentry,
> new_dir->i_version++;
>
> fat_detach(old_inode);
> + if (MSDOS_SB(sb)->options.nfs)
> + old_inode->i_ino = new_i_pos;
Sigh... Inode numbers are reported by fstat() in stat.st_ino. They must
* remain constant from open() to close(), even if file gets
unlinked or renamed.
* be equal for two simultaneously opened descriptors with the same
st_dev *ONLY* if those descriptors refer to the same file (i.e. if writing
through one of those would change the data read through another, etc.)
And yes, the userland code does depend on those properties. There's a damn
good reason why we had gone for all those convolutions with separate hash,
etc.
inode->i_ino on a live struct inode is _never_ changed. Period.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/