]> git.baikalelectronics.ru Git - kernel.git/commit
Btrfs: add missing check for writeback errors on fsync
authorFilipe Manana <fdmanana@suse.com>
Tue, 14 Jun 2016 13:18:27 +0000 (14:18 +0100)
committerFilipe Manana <fdmanana@suse.com>
Mon, 1 Aug 2016 06:21:13 +0000 (07:21 +0100)
commit11029cfbf5b931ac4158ae25e90bc971291009d5
treeed34df6a3fe3d67d749594f4e9de0fe9c720ab17
parente8988fd2c69da8e727e3e1de7ed7b90e2e499028
Btrfs: add missing check for writeback errors on fsync

When we start an fsync we start ordered extents for all delalloc ranges.
However before attempting to log the inode, we only wait for those ordered
extents if we are not doing a full sync (bit BTRFS_INODE_NEEDS_FULL_SYNC
is set in the inode's flags). This means that if an ordered extent
completes with an IO error before we check if we can skip logging the
inode, we will not catch and report the IO error to user space. This is
because on an IO error, when the ordered extent completes we do not
update the inode, so if the inode was not previously updated by the
current transaction we end up not logging it through calls to fsync and
therefore not check its mapping flags for the presence of IO errors.

Fix this by checking for errors in the flags of the inode's mapping when
we notice we can skip logging the inode.

This caused sporadic failures in the test generic/331 (which explicitly
tests for IO errors during an fsync call).

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Liu Bo <bo.li.liu@oracle.com>
fs/btrfs/file.c