]> git.baikalelectronics.ru Git - kernel.git/commit
fs: fix fsync() error reporting
authorDmitry Monakhov <dmonakhov@openvz.org>
Mon, 29 Apr 2013 22:08:42 +0000 (15:08 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 29 Apr 2013 22:54:38 +0000 (15:54 -0700)
commite1cfa6c463b6b404f5a33fee7e2d9d3d0dab45a1
tree831324f5fe5b1f0ed91318f5de7669045f4f941e
parentee1d1a207a1a1e8d33f8b70499c2e1013baebe91
fs: fix fsync() error reporting

There are two convenient ways to report errors to userspace

1) retun error to original syscall for example write(2)
2) mark mapping with error flag and return it on later fsync(2)

Second one is broken if (mapping->nrpages == 0) This is real-life
situation because after error pages are likey to be truncated or
invalidated.

We have to return an error regardless to number of pages in the mapping.

#Original testcase: git@github.com:dmonakhov/xfstests.git
MOUNT_OPTIONS="-b1024"
./check shared/305

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Reviewed-by: Jan Kara <jack@suse.cz>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/filemap.c