aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/namei.c
diff options
context:
space:
mode:
authorFrank Mayhar <fmayhar@google.com>2010-05-17 08:00:00 -0400
committerTheodore Ts'o <tytso@mit.edu>2010-05-17 08:00:00 -0400
commit14ece1028b3ed53ffec1b1213ffc6acaf79ad77c (patch)
tree8f5a13487139c68ef775c9d39b7be83386fdae06 /fs/ext4/namei.c
parent60e6679e28518ccd67169c4a539d8cc7490eb8a6 (diff)
ext4: Make fsync sync new parent directories in no-journal mode
Add a new ext4 state to tell us when a file has been newly created; use that state in ext4_sync_file in no-journal mode to tell us when we need to sync the parent directory as well as the inode and data itself. This fixes a problem in which a panic or power failure may lose the entire file even when using fsync, since the parent directory entry is lost. Addresses-Google-Bug: #2480057 Signed-off-by: Frank Mayhar <fmayhar@google.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/namei.c')
-rw-r--r--fs/ext4/namei.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index 83be743c8d1f..a43e6617b351 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -1517,6 +1517,8 @@ static int ext4_add_entry(handle_t *handle, struct dentry *dentry,
1517 de->rec_len = ext4_rec_len_to_disk(blocksize, blocksize); 1517 de->rec_len = ext4_rec_len_to_disk(blocksize, blocksize);
1518 retval = add_dirent_to_buf(handle, dentry, inode, de, bh); 1518 retval = add_dirent_to_buf(handle, dentry, inode, de, bh);
1519 brelse(bh); 1519 brelse(bh);
1520 if (retval == 0)
1521 ext4_set_inode_state(inode, EXT4_STATE_NEWENTRY);
1520 return retval; 1522 return retval;
1521} 1523}
1522 1524