public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH v2] aiocp: remove the check read unnecessary flag
@ 2023-02-09 14:20 Ping Fang
  2023-02-09 14:24 ` Cyril Hrubis
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Ping Fang @ 2023-02-09 14:20 UTC (permalink / raw)
  To: ltp

When aiocp executed with -f DIRECT will fail.

<<<test_start>>>
tag=AD049 stime=1675520824
cmdline="aiocp -b 8k -n 8 -f DIRECT"
contacts=""
analysis=exit
<<<test_output>>>
tst_test.c:1560: TINFO: Timeout per run is 0h 30m 30s
aiocp.c:211: TINFO: Maximum AIO blocks: 65536
tst_device.c:585: TINFO: Use uevent strategy
aiocp.c:250: TINFO: Fill srcfile.bin with random data
aiocp.c:279: TINFO: Copy srcfile.bin -> dstfile.bin
aiocp.c:291: TINFO: Comparing srcfile.bin with dstfile.bin
aiocp.c:306: TBROK: read(3,0x7ffcd743abe0,4096) failed, returned -1: EINVAL (22)
...

The code which checks that the data has been written correctly
may wrong use the O_DIRECT flag, which may cause a failure like the
one above.

Signed-off-by: Ping Fang <pifang@redhat.com>
---
 testcases/kernel/io/ltp-aiodio/aiocp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/testcases/kernel/io/ltp-aiodio/aiocp.c b/testcases/kernel/io/ltp-aiodio/aiocp.c
index bc0e209b2..6212d8ee8 100644
--- a/testcases/kernel/io/ltp-aiodio/aiocp.c
+++ b/testcases/kernel/io/ltp-aiodio/aiocp.c
@@ -297,8 +297,8 @@ static void run(void)
 		return;
 	}
 
-	srcfd = SAFE_OPEN(srcname, srcflags | O_RDONLY, 0666);
-	dstfd = SAFE_OPEN(dstname, srcflags | O_RDONLY, 0666);
+	srcfd = SAFE_OPEN(srcname, O_RDONLY, 0666);
+	dstfd = SAFE_OPEN(dstname, O_RDONLY, 0666);
 
 	reads = howmany(filesize, buffsize);
 
-- 
2.31.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [LTP] [PATCH v2] aiocp: remove the check read unnecessary flag
  2023-02-09 14:20 [LTP] [PATCH v2] aiocp: remove the check read unnecessary flag Ping Fang
@ 2023-02-09 14:24 ` Cyril Hrubis
  2023-02-09 14:35 ` Andrea Cervesato via ltp
  2023-02-09 14:37 ` Jan Stancek
  2 siblings, 0 replies; 6+ messages in thread
From: Cyril Hrubis @ 2023-02-09 14:24 UTC (permalink / raw)
  To: Ping Fang; +Cc: ltp

Hi!
Reviewed-by: Cyril Hrubis <chrubis@suse.cz>

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [LTP] [PATCH v2] aiocp: remove the check read unnecessary flag
  2023-02-09 14:20 [LTP] [PATCH v2] aiocp: remove the check read unnecessary flag Ping Fang
  2023-02-09 14:24 ` Cyril Hrubis
@ 2023-02-09 14:35 ` Andrea Cervesato via ltp
  2023-02-10  5:27   ` Li Wang
  2023-02-09 14:37 ` Jan Stancek
  2 siblings, 1 reply; 6+ messages in thread
From: Andrea Cervesato via ltp @ 2023-02-09 14:35 UTC (permalink / raw)
  To: ltp

Hi!

Acked-by: Andrea Cervesato <andrea.cervesato@suse.com>

Andrea

On 2/9/23 15:20, Ping Fang wrote:
> When aiocp executed with -f DIRECT will fail.
>
> <<<test_start>>>
> tag=AD049 stime=1675520824
> cmdline="aiocp -b 8k -n 8 -f DIRECT"
> contacts=""
> analysis=exit
> <<<test_output>>>
> tst_test.c:1560: TINFO: Timeout per run is 0h 30m 30s
> aiocp.c:211: TINFO: Maximum AIO blocks: 65536
> tst_device.c:585: TINFO: Use uevent strategy
> aiocp.c:250: TINFO: Fill srcfile.bin with random data
> aiocp.c:279: TINFO: Copy srcfile.bin -> dstfile.bin
> aiocp.c:291: TINFO: Comparing srcfile.bin with dstfile.bin
> aiocp.c:306: TBROK: read(3,0x7ffcd743abe0,4096) failed, returned -1: EINVAL (22)
> ...
>
> The code which checks that the data has been written correctly
> may wrong use the O_DIRECT flag, which may cause a failure like the
> one above.
>
> Signed-off-by: Ping Fang <pifang@redhat.com>
> ---
>   testcases/kernel/io/ltp-aiodio/aiocp.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/testcases/kernel/io/ltp-aiodio/aiocp.c b/testcases/kernel/io/ltp-aiodio/aiocp.c
> index bc0e209b2..6212d8ee8 100644
> --- a/testcases/kernel/io/ltp-aiodio/aiocp.c
> +++ b/testcases/kernel/io/ltp-aiodio/aiocp.c
> @@ -297,8 +297,8 @@ static void run(void)
>   		return;
>   	}
>   
> -	srcfd = SAFE_OPEN(srcname, srcflags | O_RDONLY, 0666);
> -	dstfd = SAFE_OPEN(dstname, srcflags | O_RDONLY, 0666);
> +	srcfd = SAFE_OPEN(srcname, O_RDONLY, 0666);
> +	dstfd = SAFE_OPEN(dstname, O_RDONLY, 0666);
>   
>   	reads = howmany(filesize, buffsize);
>   



-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [LTP] [PATCH v2] aiocp: remove the check read unnecessary flag
  2023-02-09 14:20 [LTP] [PATCH v2] aiocp: remove the check read unnecessary flag Ping Fang
  2023-02-09 14:24 ` Cyril Hrubis
  2023-02-09 14:35 ` Andrea Cervesato via ltp
@ 2023-02-09 14:37 ` Jan Stancek
  2 siblings, 0 replies; 6+ messages in thread
From: Jan Stancek @ 2023-02-09 14:37 UTC (permalink / raw)
  To: Ping Fang; +Cc: ltp

On Thu, Feb 9, 2023 at 3:20 PM Ping Fang <pifang@redhat.com> wrote:
>
> When aiocp executed with -f DIRECT will fail.
>
> <<<test_start>>>
> tag=AD049 stime=1675520824
> cmdline="aiocp -b 8k -n 8 -f DIRECT"
> contacts=""
> analysis=exit
> <<<test_output>>>
> tst_test.c:1560: TINFO: Timeout per run is 0h 30m 30s
> aiocp.c:211: TINFO: Maximum AIO blocks: 65536
> tst_device.c:585: TINFO: Use uevent strategy
> aiocp.c:250: TINFO: Fill srcfile.bin with random data
> aiocp.c:279: TINFO: Copy srcfile.bin -> dstfile.bin
> aiocp.c:291: TINFO: Comparing srcfile.bin with dstfile.bin
> aiocp.c:306: TBROK: read(3,0x7ffcd743abe0,4096) failed, returned -1: EINVAL (22)
> ...
>
> The code which checks that the data has been written correctly
> may wrong use the O_DIRECT flag, which may cause a failure like the
> one above.
>
> Signed-off-by: Ping Fang <pifang@redhat.com>

Acked-by: Jan Stancek <jstancek@redhat.com>


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [LTP] [PATCH v2] aiocp: remove the check read unnecessary flag
  2023-02-09 14:35 ` Andrea Cervesato via ltp
@ 2023-02-10  5:27   ` Li Wang
  2023-02-10  8:00     ` Li Wang
  0 siblings, 1 reply; 6+ messages in thread
From: Li Wang @ 2023-02-10  5:27 UTC (permalink / raw)
  To: Andrea Cervesato; +Cc: ltp

Hi All,

Thanks for the patch and review, merged!!

-- 
Regards,
Li Wang

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [LTP] [PATCH v2] aiocp: remove the check read unnecessary flag
  2023-02-10  5:27   ` Li Wang
@ 2023-02-10  8:00     ` Li Wang
  0 siblings, 0 replies; 6+ messages in thread
From: Li Wang @ 2023-02-10  8:00 UTC (permalink / raw)
  To: LTP List

Hi All,

Just for curious, I copy this complete patch into chatGPT,
and the analysis answer from it is below FYI:

From chatGPT:

"
This patch modifies the code of the "aiocp" utility. The purpose of this
patch is to remove the check for the "read unnecessary flag" in the code.
The check was causing the "aiocp" utility to fail when executed with the
"-f DIRECT" option.

The code that was checking that the data had been written correctly was
using the O_DIRECT flag incorrectly, which caused the failure. The patch
removes the usage of the O_DIRECT flag from the code by changing the open
flags for the source and destination files from srcflags | O_RDONLY to
O_RDONLY.

This patch has been reviewed by multiple people and has received approval
from them. The author of the patch is Ping Fang, and it has been signed off
by them.
"



On Fri, Feb 10, 2023 at 1:27 PM Li Wang <liwang@redhat.com> wrote:

> Hi All,
>
> Thanks for the patch and review, merged!!
>
> --
> Regards,
> Li Wang
>


-- 
Regards,
Li Wang

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-02-10  8:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-09 14:20 [LTP] [PATCH v2] aiocp: remove the check read unnecessary flag Ping Fang
2023-02-09 14:24 ` Cyril Hrubis
2023-02-09 14:35 ` Andrea Cervesato via ltp
2023-02-10  5:27   ` Li Wang
2023-02-10  8:00     ` Li Wang
2023-02-09 14:37 ` Jan Stancek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox