linux/fs/ext4
Lukas Czerner b19efa7293 ext4: make fsync to sync parent dir in no-journal for real this time
commit e12fb97222 upstream.

Previously commit 14ece1028b added a
support for for syncing parent directory of newly created inodes to
make sure that the inode is not lost after a power failure in
no-journal mode.

However this does not work in majority of cases, namely:
 - if the directory has inline data
 - if the directory is already indexed
 - if the directory already has at least one block and:
	- the new entry fits into it
	- or we've successfully converted it to indexed

So in those cases we might lose the inode entirely even after fsync in
the no-journal mode. This also includes ext2 default mode obviously.

I've noticed this while running xfstest generic/321 and even though the
test should fail (we need to run fsck after a crash in no-journal mode)
I could not find a newly created entries even when if it was fsynced
before.

Fix this by adjusting the ext4_add_entry() successful exit paths to set
the inode EXT4_STATE_NEWENTRY so that fsync has the chance to fsync the
parent directory as well.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Jan Kara <jack@suse.cz>
Cc: Frank Mayhar <fmayhar@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
History 2015-05-06 21:59:15 +02:00
..
acl.c ext2/3/4: use generic posix ACL infrastructure 2014-01-25 23:58:19 -05:00
acl.h ext2/3/4: use generic posix ACL infrastructure 2014-01-25 23:58:19 -05:00
balloc.c ext4: don't count free clusters from a corrupt block group 2013-10-31 11:46:31 -04:00
bitmap.c ext4: Replace open coded mdata csum feature to helper function 2014-11-14 08:59:58 -08:00
block_validity.c fs/ext4: use rbtree postorder iteration helper instead of opencoding 2014-01-23 16:37:03 -08:00
dir.c fs/ext4: use rbtree postorder iteration helper instead of opencoding 2014-01-23 16:37:03 -08:00
ext4.h ext4: check s_chksum_driver when looking for bg csum presence 2014-11-14 08:59:58 -08:00
ext4_extents.h ext4: isolate ext4_extents.h file 2013-08-28 14:47:06 -04:00
ext4_jbd2.c ext4: call ext4_error_inode() if jbd2_journal_dirty_metadata() fails 2013-12-02 09:31:36 -05:00
ext4_jbd2.h ext4: Fix misspellings using 'codespell' tool 2013-08-28 14:40:12 -04:00
extents.c ext4: Replace open coded mdata csum feature to helper function 2014-11-14 08:59:58 -08:00
extents_status.c ext4: fix a potential deadlock in __ext4_es_shrink() 2014-07-17 16:21:05 -07:00
extents_status.h ext4: isolate ext4_extents.h file 2013-08-28 14:47:06 -04:00
file.c ext4: prevent bugon on race between write/fcntl 2015-02-11 14:54:48 +08:00
fsync.c ext4: Fix fsync error handling after filesystem abort 2013-06-12 22:38:04 -04:00
hash.c ext4: reduce one "if" comparison in ext4_dirhash() 2013-02-01 22:33:21 -05:00
ialloc.c ext4: fix oops when loading block bitmap failed 2014-11-14 08:59:59 -08:00
indirect.c ext4: Fix hole punching for files with indirect blocks 2014-07-09 11:18:27 -07:00
inline.c ext4: Replace open coded mdata csum feature to helper function 2014-11-14 08:59:58 -08:00
inode.c ext4: Replace open coded mdata csum feature to helper function 2014-11-14 08:59:58 -08:00
ioctl.c ext4: Replace open coded mdata csum feature to helper function 2014-11-14 08:59:58 -08:00
Kconfig ext4: fix Kconfig documentation for CONFIG_EXT4_DEBUG 2013-04-21 20:32:03 -04:00
Makefile ext4: Remove CONFIG_EXT4_FS_XATTR 2012-12-10 16:30:43 -05:00
mballoc.c mm: non-atomically mark page accessed during page cache allocation where possible 2015-01-29 17:40:52 -08:00
mballoc.h ext4: use module parameters instead of debugfs for mballoc_debug 2013-02-09 16:28:20 -05:00
migrate.c ext4: Fix misspellings using 'codespell' tool 2013-08-28 14:40:12 -04:00
mmp.c ext4: Replace open coded mdata csum feature to helper function 2014-11-14 08:59:58 -08:00
move_extent.c vfs: pull ext4's double-i_mutex-locking into common code 2013-11-09 00:16:39 -05:00
namei.c ext4: make fsync to sync parent dir in no-journal for real this time 2015-05-06 21:59:15 +02:00
page-io.c ext4: fix zeroing of page during writeback 2014-06-30 20:11:55 -07:00
resize.c ext4: fix overflow when updating superblock backups after resize 2014-11-14 08:59:58 -08:00
super.c ext4: enable journal checksum when metadata checksum feature enabled 2014-11-14 08:59:59 -08:00
symlink.c ext4: Remove CONFIG_EXT4_FS_XATTR 2012-12-10 16:30:43 -05:00
truncate.h ext4: move common truncate functions to header file 2011-06-27 19:16:04 -04:00
xattr.c ext4: Replace open coded mdata csum feature to helper function 2014-11-14 08:59:58 -08:00
xattr.h ext2/3/4: use generic posix ACL infrastructure 2014-01-25 23:58:19 -05:00
xattr_security.c Merge branch 'for_linus' into for_linus_merged 2012-01-10 11:54:07 -05:00
xattr_trusted.c ext2/3/4: delete unneeded includes of module.h 2012-01-09 13:52:10 +01:00
xattr_user.c ext2/3/4: delete unneeded includes of module.h 2012-01-09 13:52:10 +01:00