aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2016-09-05 23:21:43 -0400
committerTheodore Ts'o <tytso@mit.edu>2016-09-05 23:21:43 -0400
commit6ae4c5a69877e5afb6ce63f7d82432133934073a (patch)
tree35ec57fcbcd85d5e0e6d87e1fec929fc2f97f89f /fs/ext4
parent0b7b77791cc1d99cbca08d5bc8210e57e6165612 (diff)
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: Al Viro <viro@ZenIV.linux.org.uk> Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/ext4')
-rw-r--r--fs/ext4/fsync.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/fs/ext4/fsync.c b/fs/ext4/fsync.c
index 5c4372512ef7..88effb1053c7 100644
--- a/fs/ext4/fsync.c
+++ b/fs/ext4/fsync.c
@@ -61,6 +61,13 @@ static int ext4_sync_parent(struct inode *inode)
61 break; 61 break;
62 iput(inode); 62 iput(inode);
63 inode = next; 63 inode = next;
64 /*
65 * The directory inode may have gone through rmdir by now. But
66 * the inode itself and its blocks are still allocated (we hold
67 * a reference to the inode so it didn't go through
68 * ext4_evict_inode()) and so we are safe to flush metadata
69 * blocks and the inode.
70 */
64 ret = sync_mapping_buffers(inode->i_mapping); 71 ret = sync_mapping_buffers(inode->i_mapping);
65 if (ret) 72 if (ret)
66 break; 73 break;
@@ -107,7 +114,7 @@ int ext4_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
107 114
108 if (!journal) { 115 if (!journal) {
109 ret = __generic_file_fsync(file, start, end, datasync); 116 ret = __generic_file_fsync(file, start, end, datasync);
110 if (!ret && !hlist_empty(&inode->i_dentry)) 117 if (!ret)
111 ret = ext4_sync_parent(inode); 118 ret = ext4_sync_parent(inode);
112 if (test_opt(inode->i_sb, BARRIER)) 119 if (test_opt(inode->i_sb, BARRIER))
113 goto issue_flush; 120 goto issue_flush;