From: Milan Broz <mbroz@redhat.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Read O_DIRECT regression in 3.7-rc8 (bisected)
Date: Sat, 08 Dec 2012 00:55:55 +0100 [thread overview]
Message-ID: <50C2820B.5060005@redhat.com> (raw)
Hi Linus,
seems this commit in 3.7-rc8 caused regression for O_DIRECT
read near the end of the device.
bbec0270bdd887f96377065ee38b8848b5afa395 is the first bad commit
commit bbec0270bdd887f96377065ee38b8848b5afa395
Author: Linus Torvalds <torvalds@linux-foundation.org>
Date: Thu Nov 29 12:31:52 2012 -0800
blkdev_max_block: make private to fs/buffer.c
With reproducer below (tested on i386), read should return
half of the buffer (8192 bytes), with patch above it fails
completely.
Milan
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#define BLOCK 8192
int main (int argc, char *argv[])
{
char *buf;
int fd, r;
if (posix_memalign((void*)&buf, 4096, 2 * BLOCK)) {
printf("alloc fail\n");
return 1;
}
fd = open("/dev/sdb", O_RDONLY|O_DIRECT);
if (fd == -1) {
printf("open fail\n");
return 1;
}
if (lseek(fd, -BLOCK, SEEK_END) < 0) {
printf("seek fail\n");
close(fd);
return 2;
}
r = read(fd, buf, 2 * BLOCK);
printf("Read returned %d.\n", r);
close(fd);
return 0;
}
next reply other threads:[~2012-12-07 23:55 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-07 23:55 Milan Broz [this message]
2012-12-08 0:48 ` Read O_DIRECT regression in 3.7-rc8 (bisected) Linus Torvalds
2012-12-08 0:57 ` Linus Torvalds
2012-12-08 8:53 ` Milan Broz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=50C2820B.5060005@redhat.com \
--to=mbroz@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox