Project

General

Profile

Bug #546

direct i/o does not work when offset is not page-aligned

Added by Henry Chang almost 9 years ago. Updated almost 9 years ago.

Status:
Resolved
Priority:
Urgent
Assignee:
Category:
-
Target version:
Start date:
11/04/2010
Due date:
% Done:

0%

Estimated time:
2.00 h
Spent time:
Source:
Tags:
Backport:
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:

Description

When opening file with O_DIRECT, seeking to offset 6656 and reading 512 bytes gets wrong data.
Below is a strace log reading file on local fs:

open("/tmp/benian.img", O_RDONLY|O_DIRECT) = 3
stat("/tmp/benian.img", {st_mode=S_IFREG|0644, st_size=7168, ...}) = 0
lseek(3, 0, SEEK_END)                   = 7168
lseek(3, 0, SEEK_CUR)                   = 7168
lseek(3, 6656, SEEK_SET)                = 6656
read(3, "conectix\0\0\0\2\0\1\0\0\0\0\0\0\0\0\2\0\24c\355\337tap\0"..., 512) = 512

Below is the strace log reading file on ceph:

open("/mnt/depot0/benian.img", O_RDONLY|O_DIRECT) = 3
stat("/mnt/depot0/benian.img", {st_mode=S_IFREG|0644, st_size=7168, ...}) = 0
lseek(3, 0, SEEK_END)                   = 7168
lseek(3, 0, SEEK_CUR)                   = 7168
lseek(3, 6656, SEEK_SET)                = 6656
read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 512) = 512

benian.img (7 KB) Henry Chang, 11/04/2010 11:04 PM

History

#1 Updated by Henry Chang almost 9 years ago

Attached is the testing file.

#2 Updated by Sage Weil almost 9 years ago

  • Project changed from Ceph to Linux kernel client

#3 Updated by Sage Weil almost 9 years ago

  • Target version set to v2.6.37

#4 Updated by Sage Weil almost 9 years ago

  • Priority changed from Normal to High

#5 Updated by Sage Weil almost 9 years ago

  • Priority changed from High to Urgent

#6 Updated by Sage Weil almost 9 years ago

  • Status changed from New to Resolved
  • Assignee set to Sage Weil
  • Estimated time set to 2.00 h
  • Source changed from 0 to 2

See commit:c5c6b19d4b8f5431fca05f28ae9e141045022149. Passes my tests.

Also available in: Atom PDF