1 ext4: cleanup ext4_sync_parent()
3 From: Jan Kara <jack@suse.cz>
5 A condition !hlist_empty(&inode->i_dentry) is always true for open file.
6 Just remove it. Also ext4_sync_parent() could use some explanation why
7 races with rmdir() are not an issue - add a comment explaining that.
9 Reported-by: Al Viro <viro@ZenIV.linux.org.uk>
10 Signed-off-by: Jan Kara <jack@suse.cz>
11 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
13 fs/ext4/fsync.c | 9 ++++++++-
14 1 file changed, 8 insertions(+), 1 deletion(-)
16 diff --git a/fs/ext4/fsync.c b/fs/ext4/fsync.c
17 index 5c43725..88effb1 100644
20 @@ -61,6 +61,13 @@ static int ext4_sync_parent(struct inode *inode)
25 + * The directory inode may have gone through rmdir by now. But
26 + * the inode itself and its blocks are still allocated (we hold
27 + * a reference to the inode so it didn't go through
28 + * ext4_evict_inode()) and so we are safe to flush metadata
29 + * blocks and the inode.
31 ret = sync_mapping_buffers(inode->i_mapping);
34 @@ -107,7 +114,7 @@ int ext4_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
37 ret = __generic_file_fsync(file, start, end, datasync);
38 - if (!ret && !hlist_empty(&inode->i_dentry))
40 ret = ext4_sync_parent(inode);
41 if (test_opt(inode->i_sb, BARRIER))