Skip to content

Commit

Permalink
f2fs: fix i_name during f2fs_sync_file
Browse files Browse the repository at this point in the history
As similar as the i_pino fix, i_name also should be fixed when i_nlink is 1.

The errorneous scenario is like this.

1. touch test1
2. link test1 test2
3. unlink test2
4. fsync test1

After this, i_name should be test1.

CC: Al Viro <viro@ZenIV.linux.org.uk>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
  • Loading branch information
Jaegeuk Kim committed Jul 30, 2013
1 parent 1cd14ca commit f0947e5
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions fs/f2fs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,13 @@ static int get_parent_ino(struct inode *inode, nid_t *pino)
if (!dentry)
return 0;

inode = igrab(dentry->d_parent->d_inode);
dput(dentry);
if (update_dent_inode(inode, &dentry->d_name)) {
dput(dentry);
return 0;
}

*pino = inode->i_ino;
iput(inode);
*pino = parent_ino(dentry);
dput(dentry);
return 1;
}

Expand Down

0 comments on commit f0947e5

Please sign in to comment.