diff options
author | Phil Turnbull <phil.turnbull@oracle.com> | 2016-07-21 13:43:09 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-09-30 10:12:47 +0200 |
commit | 0c157dba85e8b5713bbf23192b7640d8f30066b4 (patch) | |
tree | 6ab90197cc0cd2871e586348236f0fa45fcf03c8 /fs | |
parent | 6a8195b9028df045bef62f12837a600f500314fb (diff) | |
download | lwn-0c157dba85e8b5713bbf23192b7640d8f30066b4.tar.gz lwn-0c157dba85e8b5713bbf23192b7640d8f30066b4.zip |
ceph: Correctly return NXIO errors from ceph_llseek
commit 955818cd5b6c4b58ea574ace4573e7afa4c19c1e upstream.
ceph_llseek does not correctly return NXIO errors because the 'out' path
always returns 'offset'.
Fixes: 06222e491e66 ("fs: handle SEEK_HOLE/SEEK_DATA properly in all fs's that define their own llseek")
Signed-off-by: Phil Turnbull <phil.turnbull@oracle.com>
Signed-off-by: Yan, Zheng <zyan@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ceph/file.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/fs/ceph/file.c b/fs/ceph/file.c index 0daaf7ceedc5..b1b9b48a479d 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c @@ -1448,16 +1448,14 @@ static loff_t ceph_llseek(struct file *file, loff_t offset, int whence) { struct inode *inode = file->f_mapping->host; loff_t i_size; - int ret; + loff_t ret; inode_lock(inode); if (whence == SEEK_END || whence == SEEK_DATA || whence == SEEK_HOLE) { ret = ceph_do_getattr(inode, CEPH_STAT_CAP_SIZE, false); - if (ret < 0) { - offset = ret; + if (ret < 0) goto out; - } } i_size = i_size_read(inode); @@ -1473,7 +1471,7 @@ static loff_t ceph_llseek(struct file *file, loff_t offset, int whence) * write() or lseek() might have altered it */ if (offset == 0) { - offset = file->f_pos; + ret = file->f_pos; goto out; } offset += file->f_pos; @@ -1493,11 +1491,11 @@ static loff_t ceph_llseek(struct file *file, loff_t offset, int whence) break; } - offset = vfs_setpos(file, offset, inode->i_sb->s_maxbytes); + ret = vfs_setpos(file, offset, inode->i_sb->s_maxbytes); out: inode_unlock(inode); - return offset; + return ret; } static inline void ceph_zero_partial_page( |