Commit 6ae4c5a6 authored by Jan Kara's avatar Jan Kara Committed by Theodore Ts'o

ext4: cleanup ext4_sync_parent()

A condition !hlist_empty(&inode->i_dentry) is always true for open file.
Just remove it. Also ext4_sync_parent() could use some explanation why
races with rmdir() are not an issue - add a comment explaining that.
Reported-by: default avatarAl Viro <viro@ZenIV.linux.org.uk>
Signed-off-by: default avatarJan Kara <jack@suse.cz>
Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
parent 0b7b7779
...@@ -61,6 +61,13 @@ static int ext4_sync_parent(struct inode *inode) ...@@ -61,6 +61,13 @@ static int ext4_sync_parent(struct inode *inode)
break; break;
iput(inode); iput(inode);
inode = next; inode = next;
/*
* The directory inode may have gone through rmdir by now. But
* the inode itself and its blocks are still allocated (we hold
* a reference to the inode so it didn't go through
* ext4_evict_inode()) and so we are safe to flush metadata
* blocks and the inode.
*/
ret = sync_mapping_buffers(inode->i_mapping); ret = sync_mapping_buffers(inode->i_mapping);
if (ret) if (ret)
break; break;
...@@ -107,7 +114,7 @@ int ext4_sync_file(struct file *file, loff_t start, loff_t end, int datasync) ...@@ -107,7 +114,7 @@ int ext4_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
if (!journal) { if (!journal) {
ret = __generic_file_fsync(file, start, end, datasync); ret = __generic_file_fsync(file, start, end, datasync);
if (!ret && !hlist_empty(&inode->i_dentry)) if (!ret)
ret = ext4_sync_parent(inode); ret = ext4_sync_parent(inode);
if (test_opt(inode->i_sb, BARRIER)) if (test_opt(inode->i_sb, BARRIER))
goto issue_flush; goto issue_flush;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment