ceph: Correctly return NXIO errors from ceph_llseek
ceph_llseek does not correctly return NXIO errors because the 'out' path
always returns 'offset'.
Fixes: 06222e491e
("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>
This commit is contained in:
parent
6b1a9a6c54
commit
955818cd5b
|
@ -1499,16 +1499,14 @@ static loff_t ceph_llseek(struct file *file, loff_t offset, int whence)
|
||||||
{
|
{
|
||||||
struct inode *inode = file->f_mapping->host;
|
struct inode *inode = file->f_mapping->host;
|
||||||
loff_t i_size;
|
loff_t i_size;
|
||||||
int ret;
|
loff_t ret;
|
||||||
|
|
||||||
inode_lock(inode);
|
inode_lock(inode);
|
||||||
|
|
||||||
if (whence == SEEK_END || whence == SEEK_DATA || whence == SEEK_HOLE) {
|
if (whence == SEEK_END || whence == SEEK_DATA || whence == SEEK_HOLE) {
|
||||||
ret = ceph_do_getattr(inode, CEPH_STAT_CAP_SIZE, false);
|
ret = ceph_do_getattr(inode, CEPH_STAT_CAP_SIZE, false);
|
||||||
if (ret < 0) {
|
if (ret < 0)
|
||||||
offset = ret;
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
i_size = i_size_read(inode);
|
i_size = i_size_read(inode);
|
||||||
|
@ -1524,7 +1522,7 @@ static loff_t ceph_llseek(struct file *file, loff_t offset, int whence)
|
||||||
* write() or lseek() might have altered it
|
* write() or lseek() might have altered it
|
||||||
*/
|
*/
|
||||||
if (offset == 0) {
|
if (offset == 0) {
|
||||||
offset = file->f_pos;
|
ret = file->f_pos;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
offset += file->f_pos;
|
offset += file->f_pos;
|
||||||
|
@ -1544,11 +1542,11 @@ static loff_t ceph_llseek(struct file *file, loff_t offset, int whence)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
offset = vfs_setpos(file, offset, inode->i_sb->s_maxbytes);
|
ret = vfs_setpos(file, offset, inode->i_sb->s_maxbytes);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
inode_unlock(inode);
|
inode_unlock(inode);
|
||||||
return offset;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void ceph_zero_partial_page(
|
static inline void ceph_zero_partial_page(
|
||||||
|
|
Loading…
Reference in New Issue