Skip to content

Commit 0e98728

Browse files
committed
ceph: fix ENOENT logic in striped_read
Getting ENOENT is equivalent to reading 0 bytes. Make that correction before setting up the hit_stripe and was_short flags. Fixes the following case: dd if=/dev/zero of=/mnt/fs_depot/dd3 bs=1 seek=1048576 count=0 dd if=/mnt/fs_depot/dd3 of=/root/ddout1 skip=8 bs=500 count=2 iflag=direct Reported-by: Henry C Chang <henry.cy.chang@gmail.com> Signed-off-by: Sage Weil <sage@newdream.net>
1 parent c3cd628 commit 0e98728

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎fs/ceph/file.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,10 +318,10 @@ static int striped_read(struct inode *inode,
318318
ci->i_truncate_seq,
319319
ci->i_truncate_size,
320320
page_pos, pages_left, page_align);
321-
hit_stripe = this_len < left;
322-
was_short = ret >= 0 && ret < this_len;
323321
if (ret == -ENOENT)
324322
ret = 0;
323+
hit_stripe = this_len < left;
324+
was_short = ret >= 0 && ret < this_len;
325325
dout("striped_read %llu~%u (read %u) got %d%s%s\n", pos, left, read,
326326
ret, hit_stripe ? " HITSTRIPE" : "", was_short ? " SHORT" : "");
327327

0 commit comments

Comments
 (0)