summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk.kim@samsung.com>2014-04-28 10:02:48 +0200
committerJaegeuk Kim <jaegeuk.kim@samsung.com>2014-05-07 03:21:57 +0200
commitfe369bc8ba205537864cb86ba08b390ad20201c4 (patch)
treefb90729c2017573b084121f9f16c52358679aa81
parentf2fs: introduce f2fs_seek_block to support SEEK_{DATA, HOLE} in llseek (diff)
downloadlinux-fe369bc8ba205537864cb86ba08b390ad20201c4.tar.xz
linux-fe369bc8ba205537864cb86ba08b390ad20201c4.zip
f2fs: return i_size if the hole is outside of i_size
When SEEK_HOLE is requeted, it should return i_size if the hole position is found outside of i_size. Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
-rw-r--r--fs/f2fs/file.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index d99d17325046..31128571e284 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -255,9 +255,9 @@ static loff_t f2fs_seek_block(struct file *file, loff_t offset, int whence)
if (whence == SEEK_DATA)
goto fail;
- else
- data_ofs = isize;
found:
+ if (whence == SEEK_HOLE && data_ofs > isize)
+ data_ofs = isize;
mutex_unlock(&inode->i_mutex);
return vfs_setpos(file, data_ofs, maxbytes);
fail: