lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <8379b5df9f70a1d75692e029a565199e98a535e8.1700478575.git.ritesh.list@gmail.com>
Date: Mon, 20 Nov 2023 16:49:33 +0530
From: "Ritesh Harjani (IBM)" <ritesh.list@...il.com>
To: fstests@...r.kernel.org
Cc: linux-ext4@...r.kernel.org,
	Jan Kara <jack@...e.cz>,
	Gao Xiang <hsiangkao@...ux.alibaba.com>,
	Ojaswin Mujoo <ojaswin@...ux.ibm.com>,
	"Ritesh Harjani (IBM)" <ritesh.list@...il.com>
Subject: [PATCHv3 1/2] aio-dio-write-verify: Add sync and noverify option

This patch adds -S for O_SYNC and -N for noverify option to
aio-dio-write-verify test. We will use this for integrity
verification test for aio-dio.

Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@...il.com>
---
 src/aio-dio-regress/aio-dio-write-verify.c | 29 ++++++++++++++++------
 1 file changed, 21 insertions(+), 8 deletions(-)

diff --git a/src/aio-dio-regress/aio-dio-write-verify.c b/src/aio-dio-regress/aio-dio-write-verify.c
index dabbfacd..a7ca8307 100644
--- a/src/aio-dio-regress/aio-dio-write-verify.c
+++ b/src/aio-dio-regress/aio-dio-write-verify.c
@@ -34,13 +34,16 @@
 
 void usage(char *progname)
 {
-	fprintf(stderr, "usage: %s [-t truncsize ] <-a size=N,off=M [-a ...]>  filename\n"
+	fprintf(stderr, "usage: %s [-t truncsize ] <-a size=N,off=M [-a ...]>  [-S] [-N] filename\n"
 	        "\t-t truncsize: truncate the file to a special size before AIO wirte\n"
 	        "\t-a: specify once AIO write size and startoff, this option can be specified many times, but less than 128\n"
 	        "\t\tsize=N: AIO write size\n"
 	        "\t\toff=M:  AIO write startoff\n"
-	        "e.g: %s -t 4608 -a size=4096,off=512 -a size=4096,off=4608 filename\n",
-	        progname, progname);
+			"\t-S: uses O_SYNC flag for open. By default O_SYNC is not used\n"
+			"\t-N: no_verify: means no write verification. By default noverify is false\n"
+	        "e.g: %s -t 4608 -a size=4096,off=512 -a size=4096,off=4608 filename\n"
+	        "e.g: %s -t 1048576 -a size=1048576 -S -N filename\n",
+	        progname, progname, progname);
 	exit(1);
 }
 
@@ -292,8 +295,10 @@ int main(int argc, char *argv[])
 	char *filename = NULL;
 	int num_events = 0;
 	off_t tsize = 0;
+	int o_sync = 0;
+	int no_verify = 0;
 
-	while ((c = getopt(argc, argv, "a:t:")) != -1) {
+	while ((c = getopt(argc, argv, "a:t:SN")) != -1) {
 		char *endp;
 
 		switch (c) {
@@ -308,6 +313,12 @@ int main(int argc, char *argv[])
 		case 't':
 			tsize = strtoul(optarg, &endp, 0);
 			break;
+		case 'S':
+			o_sync = O_SYNC;
+			break;
+		case 'N':
+			no_verify = 1;
+			break;
 		default:
 			usage(argv[0]);
 		}
@@ -324,7 +335,7 @@ int main(int argc, char *argv[])
 	else
 		usage(argv[0]);
 
-	fd = open(filename, O_DIRECT | O_CREAT | O_TRUNC | O_RDWR, 0600);
+	fd = open(filename, O_DIRECT | O_CREAT | O_TRUNC | O_RDWR | o_sync, 0600);
 	if (fd == -1) {
 		perror("open");
 		return 1;
@@ -342,9 +353,11 @@ int main(int argc, char *argv[])
 		return 1;
 	}
 
-	if (io_verify(fd) != 0) {
-		fprintf(stderr, "Data verification fails\n");
-		return 1;
+	if (no_verify == 0) {
+		if (io_verify(fd) != 0) {
+			fprintf(stderr, "Data verification fails\n");
+			return 1;
+		}
 	}
 
 	close(fd);
-- 
2.41.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ