Skip to content

Commit

Permalink
ceph: fix SEEK_CUR, SEEK_SET regression
Browse files Browse the repository at this point in the history
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 <roel.kluin@gmail.com>
Signed-off-by: Sage Weil <sage@newdream.net>
  • Loading branch information
Sage Weil committed Dec 13, 2011
1 parent f1932fc commit 6a82c47
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fs/ceph/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,8 @@ static loff_t ceph_llseek(struct file *file, loff_t offset, int origin)

mutex_lock(&inode->i_mutex);
__ceph_do_pending_vmtruncate(inode);
if (origin != SEEK_CUR || origin != SEEK_SET) {

if (origin == SEEK_END || origin == SEEK_DATA || origin == SEEK_HOLE) {
ret = ceph_do_getattr(inode, CEPH_STAT_CAP_SIZE);
if (ret < 0) {
offset = ret;
Expand Down

0 comments on commit 6a82c47

Please sign in to comment.