Skip to content

Commit

Permalink
udf: Set i_generation field
Browse files Browse the repository at this point in the history
Currently UDF doesn't initialize i_generation in any way and thus NFS
can easily get reallocated inodes from stale file handles. Luckily UDF
already has a unique object identifier associated with each inode -
i_unique. Use that for initialization of i_generation.

Signed-off-by: Jan Kara <jack@suse.cz>
  • Loading branch information
Jan Kara committed Sep 4, 2014
1 parent 4071b91 commit 470cca5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions fs/udf/ialloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ struct inode *udf_new_inode(struct inode *dir, umode_t mode, int *err)
lvidiu = udf_sb_lvidiu(sb);
if (lvidiu) {
iinfo->i_unique = lvid_get_unique_id(sb);
inode->i_generation = iinfo->i_unique;
mutex_lock(&sbi->s_alloc_mutex);
if (S_ISDIR(mode))
le32_add_cpu(&lvidiu->numDirs, 1);
Expand Down
1 change: 1 addition & 0 deletions fs/udf/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1484,6 +1484,7 @@ static int udf_read_inode(struct inode *inode)
iinfo->i_lenAlloc = le32_to_cpu(efe->lengthAllocDescs);
iinfo->i_checkpoint = le32_to_cpu(efe->checkpoint);
}
inode->i_generation = iinfo->i_unique;

switch (fe->icbTag.fileType) {
case ICBTAG_FILE_TYPE_DIRECTORY:
Expand Down

0 comments on commit 470cca5

Please sign in to comment.