From: Jan S. <jst...@re...> - 2013-08-19 13:38:47
|
Starting with 3.10 dio_sparse sporadically fails, because read() in read_sparse returns garbage and dio_sparse testcase fails with: dio_sparse 0 TINFO : Dirtying free blocks dio_sparse 0 TINFO : Starting I/O tests non zero buffer at buf[0] => 0xffffffaa,ffffffaa,ffffffaa,ffffffaa non-zero read at offset 0 dio_sparse 0 TINFO : Killing childrens(s) dio_sparse 1 TFAIL : 1 children(s) exited abnormally Issue is that we have parent opening file as O_DIRECT and children trying to read from it without O_DIRECT, which is discouraged in man pages. open(2) says: "Applications should avoid mixing O_DIRECT and normal I/O to the same file, and especially to overlapping byte regions in the same file." Signed-off-by: Jan Stancek <jst...@re...> --- testcases/kernel/io/ltp-aiodio/aiodio_sparse.c | 2 +- testcases/kernel/io/ltp-aiodio/common_sparse.h | 4 ++-- testcases/kernel/io/ltp-aiodio/dio_sparse.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/testcases/kernel/io/ltp-aiodio/aiodio_sparse.c b/testcases/kernel/io/ltp-aiodio/aiodio_sparse.c index 944e12b..705bbc5 100644 --- a/testcases/kernel/io/ltp-aiodio/aiodio_sparse.c +++ b/testcases/kernel/io/ltp-aiodio/aiodio_sparse.c @@ -279,7 +279,7 @@ int main(int argc, char **argv) for (i = 0; i < num_children; i++) { switch (pid[i] = fork()) { case 0: - read_sparse(filename, filesize); + read_sparse(filename, filesize, O_DIRECT); break; case -1: while (i-- > 0) diff --git a/testcases/kernel/io/ltp-aiodio/common_sparse.h b/testcases/kernel/io/ltp-aiodio/common_sparse.h index f7f4ef4..6a294cb 100644 --- a/testcases/kernel/io/ltp-aiodio/common_sparse.h +++ b/testcases/kernel/io/ltp-aiodio/common_sparse.h @@ -104,7 +104,7 @@ char *check_zero(char *buf, int size) * either there is a hole in the file, * or zeroes were actually written by parent. */ -static void read_sparse(char *filename, int filesize) +static void read_sparse(char *filename, int filesize, int mode) { int fd; int i, j, r; @@ -114,7 +114,7 @@ static void read_sparse(char *filename, int filesize) * Wait for the file to appear. */ for (i = 0; i < 10000; i++) { - fd = open(filename, O_RDONLY); + fd = open(filename, O_RDONLY | mode); if (fd != -1) break; diff --git a/testcases/kernel/io/ltp-aiodio/dio_sparse.c b/testcases/kernel/io/ltp-aiodio/dio_sparse.c index 7ad5f80..eaaea14 100644 --- a/testcases/kernel/io/ltp-aiodio/dio_sparse.c +++ b/testcases/kernel/io/ltp-aiodio/dio_sparse.c @@ -153,7 +153,7 @@ int main(int argc, char **argv) for (i = 0; i < num_children; i++) { switch (pid[i] = fork()) { case 0: - read_sparse(filename, filesize); + read_sparse(filename, filesize, O_DIRECT); break; case -1: while (i-- > 0) -- 1.7.1 |
From: Wanlong G. <gao...@cn...> - 2013-08-20 03:13:50
|
On 08/19/2013 09:38 PM, Jan Stancek wrote: > Starting with 3.10 dio_sparse sporadically fails, because > read() in read_sparse returns garbage and dio_sparse testcase > fails with: > dio_sparse 0 TINFO : Dirtying free blocks > dio_sparse 0 TINFO : Starting I/O tests > non zero buffer at buf[0] => 0xffffffaa,ffffffaa,ffffffaa,ffffffaa > non-zero read at offset 0 > dio_sparse 0 TINFO : Killing childrens(s) > dio_sparse 1 TFAIL : 1 children(s) exited abnormally Why did I always meet the EINVAL error? Like: dio_sparse 1 TBROK : open(): errno=EINVAL(22): Invalid argument Caused by the file system's O_DIRECT support? Thanks, Wanlong Gao > > Issue is that we have parent opening file as O_DIRECT and > children trying to read from it without O_DIRECT, which is > discouraged in man pages. > > open(2) says: > "Applications should avoid mixing O_DIRECT and normal I/O to the same > file, and especially to overlapping byte regions in the same file." > > Signed-off-by: Jan Stancek <jst...@re...> > --- > testcases/kernel/io/ltp-aiodio/aiodio_sparse.c | 2 +- > testcases/kernel/io/ltp-aiodio/common_sparse.h | 4 ++-- > testcases/kernel/io/ltp-aiodio/dio_sparse.c | 2 +- > 3 files changed, 4 insertions(+), 4 deletions(-) > > diff --git a/testcases/kernel/io/ltp-aiodio/aiodio_sparse.c b/testcases/kernel/io/ltp-aiodio/aiodio_sparse.c > index 944e12b..705bbc5 100644 > --- a/testcases/kernel/io/ltp-aiodio/aiodio_sparse.c > +++ b/testcases/kernel/io/ltp-aiodio/aiodio_sparse.c > @@ -279,7 +279,7 @@ int main(int argc, char **argv) > for (i = 0; i < num_children; i++) { > switch (pid[i] = fork()) { > case 0: > - read_sparse(filename, filesize); > + read_sparse(filename, filesize, O_DIRECT); > break; > case -1: > while (i-- > 0) > diff --git a/testcases/kernel/io/ltp-aiodio/common_sparse.h b/testcases/kernel/io/ltp-aiodio/common_sparse.h > index f7f4ef4..6a294cb 100644 > --- a/testcases/kernel/io/ltp-aiodio/common_sparse.h > +++ b/testcases/kernel/io/ltp-aiodio/common_sparse.h > @@ -104,7 +104,7 @@ char *check_zero(char *buf, int size) > * either there is a hole in the file, > * or zeroes were actually written by parent. > */ > -static void read_sparse(char *filename, int filesize) > +static void read_sparse(char *filename, int filesize, int mode) > { > int fd; > int i, j, r; > @@ -114,7 +114,7 @@ static void read_sparse(char *filename, int filesize) > * Wait for the file to appear. > */ > for (i = 0; i < 10000; i++) { > - fd = open(filename, O_RDONLY); > + fd = open(filename, O_RDONLY | mode); > > if (fd != -1) > break; > diff --git a/testcases/kernel/io/ltp-aiodio/dio_sparse.c b/testcases/kernel/io/ltp-aiodio/dio_sparse.c > index 7ad5f80..eaaea14 100644 > --- a/testcases/kernel/io/ltp-aiodio/dio_sparse.c > +++ b/testcases/kernel/io/ltp-aiodio/dio_sparse.c > @@ -153,7 +153,7 @@ int main(int argc, char **argv) > for (i = 0; i < num_children; i++) { > switch (pid[i] = fork()) { > case 0: > - read_sparse(filename, filesize); > + read_sparse(filename, filesize, O_DIRECT); > break; > case -1: > while (i-- > 0) > |
From: Jan S. <jst...@re...> - 2013-08-20 06:34:51
|
----- Original Message ----- > From: "Wanlong Gao" <gao...@cn...> > To: "Jan Stancek" <jst...@re...> > Cc: ltp...@li... > Sent: Tuesday, 20 August, 2013 5:13:09 AM > Subject: Re: [LTP] [PATCH/RFC] aiodio: make read_sparse use same mode as writers > > On 08/19/2013 09:38 PM, Jan Stancek wrote: > > Starting with 3.10 dio_sparse sporadically fails, because > > read() in read_sparse returns garbage and dio_sparse testcase > > fails with: > > dio_sparse 0 TINFO : Dirtying free blocks > > dio_sparse 0 TINFO : Starting I/O tests > > non zero buffer at buf[0] => 0xffffffaa,ffffffaa,ffffffaa,ffffffaa > > non-zero read at offset 0 > > dio_sparse 0 TINFO : Killing childrens(s) > > dio_sparse 1 TFAIL : 1 children(s) exited abnormally > > Why did I always meet the EINVAL error? > Like: > dio_sparse 1 TBROK : open(): errno=EINVAL(22): Invalid argument > > Caused by the file system's O_DIRECT support? It's possible, I know you'll get EINVAL if your tmp directory is tmpfs. Can you try to run it with "env TMPDIR=/root" and see if that makes difference? Regards, Jan > > Thanks, > Wanlong Gao > > > > > Issue is that we have parent opening file as O_DIRECT and > > children trying to read from it without O_DIRECT, which is > > discouraged in man pages. > > > > open(2) says: > > "Applications should avoid mixing O_DIRECT and normal I/O to the same > > file, and especially to overlapping byte regions in the same file." > > > > Signed-off-by: Jan Stancek <jst...@re...> > > --- > > testcases/kernel/io/ltp-aiodio/aiodio_sparse.c | 2 +- > > testcases/kernel/io/ltp-aiodio/common_sparse.h | 4 ++-- > > testcases/kernel/io/ltp-aiodio/dio_sparse.c | 2 +- > > 3 files changed, 4 insertions(+), 4 deletions(-) > > > > diff --git a/testcases/kernel/io/ltp-aiodio/aiodio_sparse.c > > b/testcases/kernel/io/ltp-aiodio/aiodio_sparse.c > > index 944e12b..705bbc5 100644 > > --- a/testcases/kernel/io/ltp-aiodio/aiodio_sparse.c > > +++ b/testcases/kernel/io/ltp-aiodio/aiodio_sparse.c > > @@ -279,7 +279,7 @@ int main(int argc, char **argv) > > for (i = 0; i < num_children; i++) { > > switch (pid[i] = fork()) { > > case 0: > > - read_sparse(filename, filesize); > > + read_sparse(filename, filesize, O_DIRECT); > > break; > > case -1: > > while (i-- > 0) > > diff --git a/testcases/kernel/io/ltp-aiodio/common_sparse.h > > b/testcases/kernel/io/ltp-aiodio/common_sparse.h > > index f7f4ef4..6a294cb 100644 > > --- a/testcases/kernel/io/ltp-aiodio/common_sparse.h > > +++ b/testcases/kernel/io/ltp-aiodio/common_sparse.h > > @@ -104,7 +104,7 @@ char *check_zero(char *buf, int size) > > * either there is a hole in the file, > > * or zeroes were actually written by parent. > > */ > > -static void read_sparse(char *filename, int filesize) > > +static void read_sparse(char *filename, int filesize, int mode) > > { > > int fd; > > int i, j, r; > > @@ -114,7 +114,7 @@ static void read_sparse(char *filename, int filesize) > > * Wait for the file to appear. > > */ > > for (i = 0; i < 10000; i++) { > > - fd = open(filename, O_RDONLY); > > + fd = open(filename, O_RDONLY | mode); > > > > if (fd != -1) > > break; > > diff --git a/testcases/kernel/io/ltp-aiodio/dio_sparse.c > > b/testcases/kernel/io/ltp-aiodio/dio_sparse.c > > index 7ad5f80..eaaea14 100644 > > --- a/testcases/kernel/io/ltp-aiodio/dio_sparse.c > > +++ b/testcases/kernel/io/ltp-aiodio/dio_sparse.c > > @@ -153,7 +153,7 @@ int main(int argc, char **argv) > > for (i = 0; i < num_children; i++) { > > switch (pid[i] = fork()) { > > case 0: > > - read_sparse(filename, filesize); > > + read_sparse(filename, filesize, O_DIRECT); > > break; > > case -1: > > while (i-- > 0) > > > > |
From: Wanlong G. <gao...@cn...> - 2013-08-20 06:45:26
|
On 08/20/2013 02:34 PM, Jan Stancek wrote: > > > ----- Original Message ----- >> From: "Wanlong Gao" <gao...@cn...> >> To: "Jan Stancek" <jst...@re...> >> Cc: ltp...@li... >> Sent: Tuesday, 20 August, 2013 5:13:09 AM >> Subject: Re: [LTP] [PATCH/RFC] aiodio: make read_sparse use same mode as writers >> >> On 08/19/2013 09:38 PM, Jan Stancek wrote: >>> Starting with 3.10 dio_sparse sporadically fails, because >>> read() in read_sparse returns garbage and dio_sparse testcase >>> fails with: >>> dio_sparse 0 TINFO : Dirtying free blocks >>> dio_sparse 0 TINFO : Starting I/O tests >>> non zero buffer at buf[0] => 0xffffffaa,ffffffaa,ffffffaa,ffffffaa >>> non-zero read at offset 0 >>> dio_sparse 0 TINFO : Killing childrens(s) >>> dio_sparse 1 TFAIL : 1 children(s) exited abnormally >> >> Why did I always meet the EINVAL error? >> Like: >> dio_sparse 1 TBROK : open(): errno=EINVAL(22): Invalid argument >> >> Caused by the file system's O_DIRECT support? > > It's possible, I know you'll get EINVAL if your tmp directory is tmpfs. > Can you try to run it with "env TMPDIR=/root" and see if > that makes difference? I tried with "-d /root/test" and the case PASSED, but without your patch. tag=ADSP044 stime=1376980874 cmdline="dio_sparse -a 2k -w 2k -s 2k -n 2" contacts="" analysis=exit <<<test_output>>> incrementing stop dio_sparse 0 TINFO : Dirtying free blocks dio_sparse 0 TINFO : Starting I/O tests dio_sparse 0 TINFO : Killing childrens(s) dio_sparse 1 TPASS : Test passed /root/test is ext4 file system, and the kernel is 3.10.4-300.fc19.x86_64. Still can't see the FAIL like you said? Thanks, Wanlong Gao > > Regards, > Jan > >> >> Thanks, >> Wanlong Gao >> >>> >>> Issue is that we have parent opening file as O_DIRECT and >>> children trying to read from it without O_DIRECT, which is >>> discouraged in man pages. >>> >>> open(2) says: >>> "Applications should avoid mixing O_DIRECT and normal I/O to the same >>> file, and especially to overlapping byte regions in the same file." >>> >>> Signed-off-by: Jan Stancek <jst...@re...> >>> --- >>> testcases/kernel/io/ltp-aiodio/aiodio_sparse.c | 2 +- >>> testcases/kernel/io/ltp-aiodio/common_sparse.h | 4 ++-- >>> testcases/kernel/io/ltp-aiodio/dio_sparse.c | 2 +- >>> 3 files changed, 4 insertions(+), 4 deletions(-) >>> >>> diff --git a/testcases/kernel/io/ltp-aiodio/aiodio_sparse.c >>> b/testcases/kernel/io/ltp-aiodio/aiodio_sparse.c >>> index 944e12b..705bbc5 100644 >>> --- a/testcases/kernel/io/ltp-aiodio/aiodio_sparse.c >>> +++ b/testcases/kernel/io/ltp-aiodio/aiodio_sparse.c >>> @@ -279,7 +279,7 @@ int main(int argc, char **argv) >>> for (i = 0; i < num_children; i++) { >>> switch (pid[i] = fork()) { >>> case 0: >>> - read_sparse(filename, filesize); >>> + read_sparse(filename, filesize, O_DIRECT); >>> break; >>> case -1: >>> while (i-- > 0) >>> diff --git a/testcases/kernel/io/ltp-aiodio/common_sparse.h >>> b/testcases/kernel/io/ltp-aiodio/common_sparse.h >>> index f7f4ef4..6a294cb 100644 >>> --- a/testcases/kernel/io/ltp-aiodio/common_sparse.h >>> +++ b/testcases/kernel/io/ltp-aiodio/common_sparse.h >>> @@ -104,7 +104,7 @@ char *check_zero(char *buf, int size) >>> * either there is a hole in the file, >>> * or zeroes were actually written by parent. >>> */ >>> -static void read_sparse(char *filename, int filesize) >>> +static void read_sparse(char *filename, int filesize, int mode) >>> { >>> int fd; >>> int i, j, r; >>> @@ -114,7 +114,7 @@ static void read_sparse(char *filename, int filesize) >>> * Wait for the file to appear. >>> */ >>> for (i = 0; i < 10000; i++) { >>> - fd = open(filename, O_RDONLY); >>> + fd = open(filename, O_RDONLY | mode); >>> >>> if (fd != -1) >>> break; >>> diff --git a/testcases/kernel/io/ltp-aiodio/dio_sparse.c >>> b/testcases/kernel/io/ltp-aiodio/dio_sparse.c >>> index 7ad5f80..eaaea14 100644 >>> --- a/testcases/kernel/io/ltp-aiodio/dio_sparse.c >>> +++ b/testcases/kernel/io/ltp-aiodio/dio_sparse.c >>> @@ -153,7 +153,7 @@ int main(int argc, char **argv) >>> for (i = 0; i < num_children; i++) { >>> switch (pid[i] = fork()) { >>> case 0: >>> - read_sparse(filename, filesize); >>> + read_sparse(filename, filesize, O_DIRECT); >>> break; >>> case -1: >>> while (i-- > 0) >>> >> >> > |
From: Jan S. <jst...@re...> - 2013-08-20 07:06:22
|
----- Original Message ----- > From: "Wanlong Gao" <gao...@cn...> > To: "Jan Stancek" <jst...@re...> > Cc: ltp...@li... > Sent: Tuesday, 20 August, 2013 8:44:44 AM > Subject: Re: [LTP] [PATCH/RFC] aiodio: make read_sparse use same mode as writers > > On 08/20/2013 02:34 PM, Jan Stancek wrote: > > > > > > ----- Original Message ----- > >> From: "Wanlong Gao" <gao...@cn...> > >> To: "Jan Stancek" <jst...@re...> > >> Cc: ltp...@li... > >> Sent: Tuesday, 20 August, 2013 5:13:09 AM > >> Subject: Re: [LTP] [PATCH/RFC] aiodio: make read_sparse use same mode as > >> writers > >> > >> On 08/19/2013 09:38 PM, Jan Stancek wrote: > >>> Starting with 3.10 dio_sparse sporadically fails, because > >>> read() in read_sparse returns garbage and dio_sparse testcase > >>> fails with: > >>> dio_sparse 0 TINFO : Dirtying free blocks > >>> dio_sparse 0 TINFO : Starting I/O tests > >>> non zero buffer at buf[0] => 0xffffffaa,ffffffaa,ffffffaa,ffffffaa > >>> non-zero read at offset 0 > >>> dio_sparse 0 TINFO : Killing childrens(s) > >>> dio_sparse 1 TFAIL : 1 children(s) exited abnormally > >> > >> Why did I always meet the EINVAL error? > >> Like: > >> dio_sparse 1 TBROK : open(): errno=EINVAL(22): Invalid argument > >> > >> Caused by the file system's O_DIRECT support? > > > > It's possible, I know you'll get EINVAL if your tmp directory is tmpfs. > > Can you try to run it with "env TMPDIR=/root" and see if > > that makes difference? > > I tried with "-d /root/test" and the case PASSED, but without your patch. > > tag=ADSP044 stime=1376980874 > cmdline="dio_sparse -a 2k -w 2k -s 2k -n 2" > contacts="" > analysis=exit > <<<test_output>>> > incrementing stop > dio_sparse 0 TINFO : Dirtying free blocks > dio_sparse 0 TINFO : Starting I/O tests > dio_sparse 0 TINFO : Killing childrens(s) > dio_sparse 1 TPASS : Test passed > > > /root/test is ext4 file system, and the kernel is 3.10.4-300.fc19.x86_64. > > Still can't see the FAIL like you said? The FAIL is sporadic, I also get PASS most of the time. The most reliable way to trigger it so far seems to be running it in loop on KVM guest with 2 CPUs (/tmp is ext4), where it usually triggers in couple minutes. virt-install --name x86_64_kvm --mac 52:56:00:00:00:01 --ram=2048 --vcpus=2 --file-size=20 --hvm --nonsparse --debug --extra-args "console=tty0 console=ttyS0,115200" --accelerate --os-variant=virtio26 --ver6 --network bridge:br0 --serial file,path=/root/x86_64_kvm_console.log --file /var/lib/libvirt/images/x86_64_kvm.img Regards, Jan > > Thanks, > Wanlong Gao > > > > > Regards, > > Jan > > > >> > >> Thanks, > >> Wanlong Gao > >> > >>> > >>> Issue is that we have parent opening file as O_DIRECT and > >>> children trying to read from it without O_DIRECT, which is > >>> discouraged in man pages. > >>> > >>> open(2) says: > >>> "Applications should avoid mixing O_DIRECT and normal I/O to the same > >>> file, and especially to overlapping byte regions in the same file." > >>> > >>> Signed-off-by: Jan Stancek <jst...@re...> > >>> --- > >>> testcases/kernel/io/ltp-aiodio/aiodio_sparse.c | 2 +- > >>> testcases/kernel/io/ltp-aiodio/common_sparse.h | 4 ++-- > >>> testcases/kernel/io/ltp-aiodio/dio_sparse.c | 2 +- > >>> 3 files changed, 4 insertions(+), 4 deletions(-) > >>> > >>> diff --git a/testcases/kernel/io/ltp-aiodio/aiodio_sparse.c > >>> b/testcases/kernel/io/ltp-aiodio/aiodio_sparse.c > >>> index 944e12b..705bbc5 100644 > >>> --- a/testcases/kernel/io/ltp-aiodio/aiodio_sparse.c > >>> +++ b/testcases/kernel/io/ltp-aiodio/aiodio_sparse.c > >>> @@ -279,7 +279,7 @@ int main(int argc, char **argv) > >>> for (i = 0; i < num_children; i++) { > >>> switch (pid[i] = fork()) { > >>> case 0: > >>> - read_sparse(filename, filesize); > >>> + read_sparse(filename, filesize, O_DIRECT); > >>> break; > >>> case -1: > >>> while (i-- > 0) > >>> diff --git a/testcases/kernel/io/ltp-aiodio/common_sparse.h > >>> b/testcases/kernel/io/ltp-aiodio/common_sparse.h > >>> index f7f4ef4..6a294cb 100644 > >>> --- a/testcases/kernel/io/ltp-aiodio/common_sparse.h > >>> +++ b/testcases/kernel/io/ltp-aiodio/common_sparse.h > >>> @@ -104,7 +104,7 @@ char *check_zero(char *buf, int size) > >>> * either there is a hole in the file, > >>> * or zeroes were actually written by parent. > >>> */ > >>> -static void read_sparse(char *filename, int filesize) > >>> +static void read_sparse(char *filename, int filesize, int mode) > >>> { > >>> int fd; > >>> int i, j, r; > >>> @@ -114,7 +114,7 @@ static void read_sparse(char *filename, int filesize) > >>> * Wait for the file to appear. > >>> */ > >>> for (i = 0; i < 10000; i++) { > >>> - fd = open(filename, O_RDONLY); > >>> + fd = open(filename, O_RDONLY | mode); > >>> > >>> if (fd != -1) > >>> break; > >>> diff --git a/testcases/kernel/io/ltp-aiodio/dio_sparse.c > >>> b/testcases/kernel/io/ltp-aiodio/dio_sparse.c > >>> index 7ad5f80..eaaea14 100644 > >>> --- a/testcases/kernel/io/ltp-aiodio/dio_sparse.c > >>> +++ b/testcases/kernel/io/ltp-aiodio/dio_sparse.c > >>> @@ -153,7 +153,7 @@ int main(int argc, char **argv) > >>> for (i = 0; i < num_children; i++) { > >>> switch (pid[i] = fork()) { > >>> case 0: > >>> - read_sparse(filename, filesize); > >>> + read_sparse(filename, filesize, O_DIRECT); > >>> break; > >>> case -1: > >>> while (i-- > 0) > >>> > >> > >> > > > > |
From: <ch...@su...> - 2013-08-21 10:24:33
|
Hi! > Starting with 3.10 dio_sparse sporadically fails, because > read() in read_sparse returns garbage and dio_sparse testcase > fails with: > dio_sparse 0 TINFO : Dirtying free blocks > dio_sparse 0 TINFO : Starting I/O tests > non zero buffer at buf[0] => 0xffffffaa,ffffffaa,ffffffaa,ffffffaa > non-zero read at offset 0 > dio_sparse 0 TINFO : Killing childrens(s) > dio_sparse 1 TFAIL : 1 children(s) exited abnormally > > Issue is that we have parent opening file as O_DIRECT and > children trying to read from it without O_DIRECT, which is > discouraged in man pages. > > open(2) says: > "Applications should avoid mixing O_DIRECT and normal I/O to the same > file, and especially to overlapping byte regions in the same file." > > Signed-off-by: Jan Stancek <jst...@re...> > --- The README in the testcases directory says that the tests explicitly tests for consistency between buffered I/O and O_DIRECT. I will consult some kernel guys if this was ever supported and we will either remove the tests or try to find a bug in the kernel. -- Cyril Hrubis ch...@su... |
From: <ch...@su...> - 2013-08-21 13:41:21
|
Hi! > The README in the testcases directory says that the tests explicitly > tests for consistency between buffered I/O and O_DIRECT. > > I will consult some kernel guys if this was ever supported and we will > either remove the tests or try to find a bug in the kernel. I've looked at the test and what it does is: 1. create file and make sure it's empty 2. truncate it to defined size 3. parent starts writing zeroes to it with O_DIRECT 4. childs reads it and expect to get zeroes at any time This should really work and I've been told by our filesystem guy that this really looks like bug in the kernel (assuming that I haven't overlooked something in the test source). -- Cyril Hrubis ch...@su... |
From: Jan S. <jst...@re...> - 2013-08-21 14:38:59
|
----- Original Message ----- > From: ch...@su... > To: "Jan Stancek" <jst...@re...> > Cc: ltp...@li... > Sent: Wednesday, 21 August, 2013 3:41:21 PM > Subject: Re: [LTP] [PATCH/RFC] aiodio: make read_sparse use same mode as writers > > Hi! > > The README in the testcases directory says that the tests explicitly > > tests for consistency between buffered I/O and O_DIRECT. > > > > I will consult some kernel guys if this was ever supported and we will > > either remove the tests or try to find a bug in the kernel. > > I've looked at the test and what it does is: > > 1. create file and make sure it's empty > 2. truncate it to defined size > 3. parent starts writing zeroes to it with O_DIRECT > 4. childs reads it and expect to get zeroes at any time Hi, That looks correct, here's an strace excerpt: 04:05:38.464923 open("/tmp/dio_sparse", O_RDWR|O_CREAT|O_EXCL|O_DIRECT, 0600) = 5 04:05:38.464985 clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7f7583c0da10) = 22242 Process 22242 attached [pid 22242] 04:05:38.465142 open("/tmp/dio_sparse", O_RDONLY) = 6 [pid 22234] 04:05:38.465369 ftruncate(5, 2048 <unfinished ...> [pid 22242] 04:05:38.465400 lseek(6, 0, SEEK_SET <unfinished ...> [pid 22234] 04:05:38.465458 <... ftruncate resumed> ) = 0 [pid 22242] 04:05:38.465474 <... lseek resumed> ) = 0 [pid 22234] 04:05:38.465509 write(5, "\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"..., 4096 <unfinished ...> [pid 22242] 04:05:38.465540 read(6, "04:05:14.921896 execve(\"./dio_sp"..., 4096) = 2048 [pid 22242] 04:05:38.482378 fstat(1, {st_mode=S_IFREG|0644, st_size=14502, ...}) = 0 [pid 22242] 04:05:38.482419 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f7583c18000 [pid 22242] 04:05:38.482473 write(1, "dummy not zero at 0, 0x30\n", 26dummy not zero at 0, 0x30 ) = 26 > This should really work and I've been told by our filesystem guy that > this really looks like bug in the kernel (assuming that I haven't > overlooked something in the test source). Do you know about any doc/source that says why it should work? In my search I only came across that man page, which seems to go in opposite way. Regards, Jan > > -- > Cyril Hrubis > ch...@su... > |
From: <ch...@su...> - 2013-08-21 15:06:22
|
Hi! > > I've looked at the test and what it does is: > > > > 1. create file and make sure it's empty > > 2. truncate it to defined size > > 3. parent starts writing zeroes to it with O_DIRECT > > 4. childs reads it and expect to get zeroes at any time > > Hi, > > That looks correct, here's an strace excerpt: > > 04:05:38.464923 open("/tmp/dio_sparse", O_RDWR|O_CREAT|O_EXCL|O_DIRECT, 0600) = 5 > 04:05:38.464985 clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7f7583c0da10) = 22242 > Process 22242 attached > [pid 22242] 04:05:38.465142 open("/tmp/dio_sparse", O_RDONLY) = 6 > [pid 22234] 04:05:38.465369 ftruncate(5, 2048 <unfinished ...> > [pid 22242] 04:05:38.465400 lseek(6, 0, SEEK_SET <unfinished ...> > [pid 22234] 04:05:38.465458 <... ftruncate resumed> ) = 0 > [pid 22242] 04:05:38.465474 <... lseek resumed> ) = 0 > [pid 22234] 04:05:38.465509 write(5, "\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"..., 4096 <unfinished ...> > [pid 22242] 04:05:38.465540 read(6, "04:05:14.921896 execve(\"./dio_sp"..., 4096) = 2048 > [pid 22242] 04:05:38.482378 fstat(1, {st_mode=S_IFREG|0644, st_size=14502, ...}) = 0 > [pid 22242] 04:05:38.482419 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f7583c18000 > [pid 22242] 04:05:38.482473 write(1, "dummy not zero at 0, 0x30\n", 26dummy not zero at 0, 0x30 > ) = 26 So the read gets something that looks like part of the strace? How is that even possible? > > This should really work and I've been told by our filesystem guy that > > this really looks like bug in the kernel (assuming that I haven't > > overlooked something in the test source). > > Do you know about any doc/source that says why it should work? > In my search I only came across that man page, which seems to go in > opposite way. I simply asked Jan Kara. -- Cyril Hrubis ch...@su... |
From: Jan S. <jst...@re...> - 2013-08-27 12:34:48
|
----- Original Message ----- > From: ch...@su... > To: "Jan Stancek" <jst...@re...> > Cc: ltp...@li... > Sent: Wednesday, 21 August, 2013 5:06:24 PM > Subject: Re: [LTP] [PATCH/RFC] aiodio: make read_sparse use same mode as writers > > Hi! > > > I've looked at the test and what it does is: > > > > > > 1. create file and make sure it's empty > > > 2. truncate it to defined size > > > 3. parent starts writing zeroes to it with O_DIRECT > > > 4. childs reads it and expect to get zeroes at any time > > > > Hi, > > > > That looks correct, here's an strace excerpt: > > > > 04:05:38.464923 open("/tmp/dio_sparse", O_RDWR|O_CREAT|O_EXCL|O_DIRECT, > > 0600) = 5 > > 04:05:38.464985 clone(child_stack=0, > > flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, > > child_tidptr=0x7f7583c0da10) = 22242 > > Process 22242 attached > > [pid 22242] 04:05:38.465142 open("/tmp/dio_sparse", O_RDONLY) = 6 > > [pid 22234] 04:05:38.465369 ftruncate(5, 2048 <unfinished ...> > > [pid 22242] 04:05:38.465400 lseek(6, 0, SEEK_SET <unfinished ...> > > [pid 22234] 04:05:38.465458 <... ftruncate resumed> ) = 0 > > [pid 22242] 04:05:38.465474 <... lseek resumed> ) = 0 > > [pid 22234] 04:05:38.465509 write(5, > > "\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"..., > > 4096 <unfinished ...> > > [pid 22242] 04:05:38.465540 read(6, "04:05:14.921896 execve(\"./dio_sp"..., > > 4096) = 2048 > > [pid 22242] 04:05:38.482378 fstat(1, {st_mode=S_IFREG|0644, st_size=14502, > > ...}) = 0 > > [pid 22242] 04:05:38.482419 mmap(NULL, 4096, PROT_READ|PROT_WRITE, > > MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f7583c18000 > > [pid 22242] 04:05:38.482473 write(1, "dummy not zero at 0, 0x30\n", 26dummy > > not zero at 0, 0x30 > > ) = 26 > > So the read gets something that looks like part of the strace? How is > that even possible? > > > > This should really work and I've been told by our filesystem guy that > > > this really looks like bug in the kernel (assuming that I haven't > > > overlooked something in the test source). > > > > Do you know about any doc/source that says why it should work? > > In my search I only came across that man page, which seems to go in > > opposite way. > > I simply asked Jan Kara. I brought this to attention of some local FS guys as well. I found I can trigger it on physical system too (24CPU Amd Opteron) as long as dio_sparse runs on ext4. I couldn't do the same with xfs. I could trigger it quite easily with kernels going back to 3.3 and also with latest upstream 3.11-rc7 just by running: env TMPDIR=/mnt/ext4 ./dio_sparse -a 4k -w 4k -s 2k -n 2 in loop for couple minutes. Regards, Jan > > -- > Cyril Hrubis > ch...@su... > |
From: <ch...@su...> - 2013-08-27 12:58:12
|
Hi! > > > > This should really work and I've been told by our filesystem guy that > > > > this really looks like bug in the kernel (assuming that I haven't > > > > overlooked something in the test source). > > > > > > Do you know about any doc/source that says why it should work? > > > In my search I only came across that man page, which seems to go in > > > opposite way. > > > > I simply asked Jan Kara. > > I brought this to attention of some local FS guys as well. > I found I can trigger it on physical system too (24CPU Amd Opteron) as long as > dio_sparse runs on ext4. I couldn't do the same with xfs. > > I could trigger it quite easily with kernels going back to 3.3 and also > with latest upstream 3.11-rc7 just by running: > env TMPDIR=/mnt/ext4 ./dio_sparse -a 4k -w 4k -s 2k -n 2 > in loop for couple minutes. I thinked about the strace a bit and it looks to me like some dirty memory buffer was reused without being cleared (the reader seen something that appeared to be part of the strace output that presumbly was being saved to the disk). Which may be real bug because you may happen to see content of a file (that is being written to the disk) you have no permission to read. But you probably know that allready. -- Cyril Hrubis ch...@su... |