summaryrefslogtreecommitdiffstats
path: root/fs/ceph
diff options
context:
space:
mode:
authorSage Weil2011-12-13 18:19:26 +0100
committerSage Weil2011-12-13 18:19:26 +0100
commit6a82c47aa84ab22cb5969a44105cca5358879d21 (patch)
tree60dea7b341119350274ba9c50cacddc2b357fd52 /fs/ceph
parentcrush: fix mapping calculation when force argument doesn't exist (diff)
downloadkernel-qcow2-linux-6a82c47aa84ab22cb5969a44105cca5358879d21.tar.gz
kernel-qcow2-linux-6a82c47aa84ab22cb5969a44105cca5358879d21.tar.xz
kernel-qcow2-linux-6a82c47aa84ab22cb5969a44105cca5358879d21.zip
ceph: fix SEEK_CUR, SEEK_SET regression
Commit 06222e491e663dac939f04b125c9dc52126a75c4 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>
Diffstat (limited to 'fs/ceph')
-rw-r--r--fs/ceph/file.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/ceph/file.c b/fs/ceph/file.c
index af187330cc89..ed72428d9c75 100644
--- a/fs/ceph/file.c
+++ b/fs/ceph/file.c
@@ -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;