Skip to content

Commit 6a82c47

Browse files
committed
ceph: fix SEEK_CUR, SEEK_SET regression
Commit 06222e4 got the if wrong so that it always evaluates as true. This is semantically harmless, but makes SEEK_CUR and SEEK_SET needlessly query the server. Rewrite the if to explicitly enumerate the cases we DO need a valid i_size to make this code less fragile. Reported-by: Roel Kluin <[email protected]> Signed-off-by: Sage Weil <[email protected]>
1 parent f1932fc commit 6a82c47

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fs/ceph/file.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -797,7 +797,8 @@ static loff_t ceph_llseek(struct file *file, loff_t offset, int origin)
797797

798798
mutex_lock(&inode->i_mutex);
799799
__ceph_do_pending_vmtruncate(inode);
800-
if (origin != SEEK_CUR || origin != SEEK_SET) {
800+
801+
if (origin == SEEK_END || origin == SEEK_DATA || origin == SEEK_HOLE) {
801802
ret = ceph_do_getattr(inode, CEPH_STAT_CAP_SIZE);
802803
if (ret < 0) {
803804
offset = ret;

0 commit comments

Comments
 (0)