generic: check inode metadata on f{data}sync after power-cut
authorJaegeuk Kim <jaegeuk@kernel.org>
Mon, 21 Nov 2016 20:02:49 +0000 (12:02 -0800)
committerEryu Guan <eguan@redhat.com>
Tue, 22 Nov 2016 05:45:33 +0000 (13:45 +0800)
commitc74b1f84f93a84dbc2e86d12ed39d619ddd7077a
tree5b2cc358dd421a387b01449a865f40b0284948bb
parent083ff5827b603f2d646d20a20086fa55aa89b1c1
generic: check inode metadata on f{data}sync after power-cut

This patch adds case to test fsync and fdatasync with power-cuts.

The rule to check is:
1) fsync should guarantee all the inode metadata after power-cut,
2) fdatasync should guarantee i_size and i_blocks at least after
   power-cut.

Note that, in XFS, it allocates more blocks when doing writes, so it
should close the file before fsync in order to get actual i_blocks
after power-cut.  Or, it needs to do truncate the file with a
specific size to turn it off at the beginning.

Suggested-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
tests/generic/392 [new file with mode: 0755]
tests/generic/392.out [new file with mode: 0644]
tests/generic/group