Project

General

Profile

Actions

Bug #546

closed

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

Added by Henry Chang over 13 years ago. Updated over 13 years ago.

Status:
Resolved
Priority:
Urgent
Assignee:
Category:
-
Target version:
% Done:

0%

Spent time:
Source:
Tags:
Backport:
Regression:
Severity:
Reviewed:
Affected Versions:
ceph-qa-suite:
Crash signature (v1):
Crash signature (v2):

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


Files

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

Also available in: Atom PDF