1
0
Fork 0
alistair23-linux/fs/f2fs
Gabriel Krisman Bertazi 78d48322dd f2fs: Return EOF on unaligned end of file DIO read
[ Upstream commit 20d0a107fb ]

Reading past end of file returns EOF for aligned reads but -EINVAL for
unaligned reads on f2fs.  While documentation is not strict about this
corner case, most filesystem returns EOF on this case, like iomap
filesystems.  This patch consolidates the behavior for f2fs, by making
it return EOF(0).

it can be verified by a read loop on a file that does a partial read
before EOF (A file that doesn't end at an aligned address).  The
following code fails on an unaligned file on f2fs, but not on
btrfs, ext4, and xfs.

  while (done < total) {
    ssize_t delta = pread(fd, buf + done, total - done, off + done);
    if (!delta)
      break;
    ...
  }

It is arguable whether filesystems should actually return EOF or
-EINVAL, but since iomap filesystems support it, and so does the
original DIO code, it seems reasonable to consolidate on that.

Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-09-23 12:40:38 +02:00
..
Kconfig f2fs: Add a small clarification to CONFIG_FS_F2FS_FS_SECURITY 2019-09-16 08:38:48 -07:00
Makefile f2fs: add fs-verity support 2019-08-12 19:33:51 -07:00
acl.c f2fs: Replace spaces with tab 2019-05-08 21:23:11 -07:00
acl.h f2fs: add SPDX license identifiers 2018-09-12 13:07:10 -07:00
checkpoint.c f2fs: don't return vmalloc() memory from f2fs_kmalloc() 2020-06-24 17:50:41 +02:00
data.c f2fs: Return EOF on unaligned end of file DIO read 2020-09-23 12:40:38 +02:00
debug.c fs: f2fs: Remove unnecessary checks of SM_I(sbi) in update_general_status() 2019-08-23 07:57:12 -07:00
dir.c f2fs: avoid utf8_strncasecmp() with unstable name 2020-06-24 17:50:50 +02:00
extent_cache.c f2fs: introduce f2fs_<level> macros to wrap f2fs_printk() 2019-07-02 15:40:40 -07:00
f2fs.h f2fs: fix error path in do_recover_data() 2020-09-03 11:26:45 +02:00
file.c f2fs: handle readonly filesystem in f2fs_ioc_shutdown() 2020-06-24 17:50:19 +02:00
gc.c f2fs: Fix mount failure due to SPO after a successful online resize FS 2020-04-23 10:36:33 +02:00
gc.h f2fs: add SPDX license identifiers 2018-09-12 13:07:10 -07:00
hash.c f2fs: Support case-insensitive file name lookups 2019-08-23 07:57:13 -07:00
inline.c f2fs: fix error path in do_recover_data() 2020-09-03 11:26:45 +02:00
inode.c f2fs: fix to update time in lazytime mode 2020-01-04 19:16:31 +01:00
namei.c f2fs: set I_LINKABLE early to avoid wrong access by vfs 2020-02-24 08:36:50 +01:00
node.c f2fs: fix indefinite loop scanning for free nid 2020-09-23 12:40:37 +02:00
node.h f2fs: check PageWriteback flag for ordered case 2018-12-26 15:16:56 -08:00
recovery.c f2fs: fix error path in do_recover_data() 2020-09-03 11:26:45 +02:00
segment.c f2fs: Fix deadlock in f2fs_gc() context during atomic files handling 2020-01-04 19:18:18 +01:00
segment.h f2fs: enhance f2fs_is_checkpoint_ready()'s readability 2019-09-06 16:18:26 -07:00
shrinker.c f2fs: fix sbi->extent_list corruption issue 2018-12-26 15:16:54 -08:00
super.c f2fs: fix use-after-free issue 2020-09-03 11:26:46 +02:00
sysfs.c f2fs: fix memleak of kobject 2020-02-24 08:36:53 +01:00
trace.c f2fs: do not use mutex lock in atomic context 2019-03-05 19:58:06 -08:00
trace.h f2fs: add SPDX license identifiers 2018-09-12 13:07:10 -07:00
verity.c f2fs: add fs-verity support 2019-08-12 19:33:51 -07:00
xattr.c f2fs: fix to avoid memory leakage in f2fs_listxattr 2020-04-29 16:32:55 +02:00
xattr.h f2fs: add fs-verity support 2019-08-12 19:33:51 -07:00