Skip to contentSkip to conversation

tst_fill_fs: drop safe_macro from fill_flat_vec

PATCH In review Li Wang 2 participants 3 messages Jun 15, 2023 – Jun 21, 2023 Library code

lore
Share & tools
lore

Li Wang

author
#0 lore raw

PATCH 1/1 tst_fill_fs: drop safe_macro from fill_flat_vec

LTP fs_fill is trying to spawn nCPUS thread to create corresponding subdirectories and completely fill them. But in the invoke function tst_fill_fs(, TST_FILL_BLOCKS) -> fill_flat_vec() which has SAFE_MACROs to break the open behavior once fs is filled with ENOSPC return.

The failure like there aren't enough free inodes in the filesystem for the tst_fs_fill test program to create it's set of "AOF" data files.

4108 tst_test.c:1634: TINFO: === Testing on xfs ===
4109 tst_test.c:1094: TINFO: Formatting /dev/loop0 with xfs opts='' extra opts=''
4110 fs_fill.c:108: TINFO: Running 98 writer threads
4111 tst_fill_fs.c:77: TBROK: openat(89</mnt/testarea/ltp-wGg0XNSHcr/LTP_fs_XLxrLh/mntpoint/thread84>, 'AOF', 101, 600): ENOSPC (28)
4112 tst_fill_fs.c:77: TBROK: openat(87</mnt/testarea/ltp-wGg0XNSHcr/LTP_fs_XLxrLh/mntpoint/thread83>, 'AOF', 101, 600): ENOSPC (28)
4113 tst_fill_fs.c:77: TWARN: openat(85</mnt/testarea/ltp-wGg0XNSHcr/LTP_fs_XLxrLh/mntpoint/thread82>, 'AOF', 101, 600): ENOSPC (28)
4114 tst_fill_fs.c:77: TWARN: openat(3</mnt/testarea/ltp-wGg0XNSHcr/LTP_fs_XLxrLh/mntpoint/thread81>, 'AOF', 101, 600): ENOSPC (28)

This patch is just to convert the fill_flat_vec() to ignore ENOSPC like fill_randome() in opening subdirectories.

Cc Dave Chinner <[email protected]>
Cc Richard Palethorpe <[email protected]>
---
 lib/tst_fill_fs.c | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)
lib/tst_fill_fs.c +19 -2
index b9d29755a..243eb279f 100644
@@ -73,12 +73,29 @@ void fill_random(const char *path, int verbose)
 
 void fill_flat_vec(const char *path, int verbose)
 {
-	int dir = SAFE_OPEN(path, O_PATH | O_DIRECTORY);
-	int fd = SAFE_OPENAT(dir, "AOF", O_WRONLY | O_CREAT, 0600);
+	int dir, fd;
 	struct iovec iov[512];
 	int iovcnt = ARRAY_SIZE(iov);
 	int retries = 3;
 
+	dir = open(path, O_PATH | O_DIRECTORY);
+	if (dir == -1) {
+		if (errno == ENOSPC) {
+			tst_res(TINFO | TERRNO, "open()");
+			return;
+		}
+		tst_brk(TBROK | TERRNO, "open(%s, %d) failed", path, O_PATH | O_DIRECTORY);
+	}
+
+	fd = openat(dir, "AOF", O_WRONLY | O_CREAT, 0600);
+	if (fd == -1) {
+		if (errno == ENOSPC) {
+			tst_res(TINFO | TERRNO, "openat()");
+			return;
+		}
+		tst_brk(TBROK | TERRNO, "openat(%s, %d, 0600) failed", dir, O_PATH | O_DIRECTORY);
+	}
+
 	SAFE_CLOSE(dir);
 
 	for (int i = 0; i < iovcnt; i++) {
Signature · 5 lines
2.40.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#1 lore raw
Quoted 17 lines · Li Wang

LTP fs_fill is trying to spawn nCPUS thread to create corresponding subdirectories and completely fill them. But in the invoke function tst_fill_fs(, TST_FILL_BLOCKS) -> fill_flat_vec() which has SAFE_MACROs to break the open behavior once fs is filled with ENOSPC return.

The failure like there aren't enough free inodes in the filesystem for the tst_fs_fill test program to create it's set of "AOF" data files.

  4108  tst_test.c:1634: TINFO: === Testing on xfs ===
  4109  tst_test.c:1094: TINFO: Formatting /dev/loop0 with xfs opts='' extra opts=''
  4110  fs_fill.c:108: TINFO: Running 98 writer threads
  4111  tst_fill_fs.c:77: TBROK: openat(89</mnt/testarea/ltp-wGg0XNSHcr/LTP_fs_XLxrLh/mntpoint/thread84>, 'AOF', 101, 600): ENOSPC (28)
  4112  tst_fill_fs.c:77: TBROK: openat(87</mnt/testarea/ltp-wGg0XNSHcr/LTP_fs_XLxrLh/mntpoint/thread83>, 'AOF', 101, 600): ENOSPC (28)
  4113  tst_fill_fs.c:77: TWARN: openat(85</mnt/testarea/ltp-wGg0XNSHcr/LTP_fs_XLxrLh/mntpoint/thread82>, 'AOF', 101, 600): ENOSPC (28)
  4114  tst_fill_fs.c:77: TWARN: openat(3</mnt/testarea/ltp-wGg0XNSHcr/LTP_fs_XLxrLh/mntpoint/thread81>, 'AOF', 101, 600): ENOSPC (28)
Quoted 2 lines

This patch is just to convert the fill_flat_vec() to ignore ENOSPC like fill_randome() in opening subdirectories.

Looks good to me. Thanks for fixing it!

Murphy

Quoted 51 lines
Cc Dave Chinner <[email protected]>
Cc Richard Palethorpe <[email protected]>
---
 lib/tst_fill_fs.c | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)
lib/tst_fill_fs.c +19 -3
index b9d29755a..243eb279f 100644
@@ -73,12 +73,29 @@ void fill_random(const char *path, int verbose)
 
 void fill_flat_vec(const char *path, int verbose)
 {
-       int dir = SAFE_OPEN(path, O_PATH | O_DIRECTORY);
-       int fd = SAFE_OPENAT(dir, "AOF", O_WRONLY | O_CREAT, 0600);
+       int dir, fd;
        struct iovec iov[512];
        int iovcnt = ARRAY_SIZE(iov);
        int retries = 3;
 
+       dir = open(path, O_PATH | O_DIRECTORY);
+       if (dir == -1) {
+               if (errno == ENOSPC) {
+                       tst_res(TINFO | TERRNO, "open()");
+                       return;
+               }
+               tst_brk(TBROK | TERRNO, "open(%s, %d) failed", path, O_PATH | O_DIRECTORY);
+       }
+
+       fd = openat(dir, "AOF", O_WRONLY | O_CREAT, 0600);
+       if (fd == -1) {
+               if (errno == ENOSPC) {
+                       tst_res(TINFO | TERRNO, "openat()");
+                       return;
+               }
+               tst_brk(TBROK | TERRNO, "openat(%s, %d, 0600) failed", dir, O_PATH | O_DIRECTORY);
+       }
+
        SAFE_CLOSE(dir);
 
        for (int i = 0; i < iovcnt; i++) {
--

2.40.1

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

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
author
#2 lore raw
Quoted 23 lines · Murphy Zhou
Quoted 11 lines · Li Wang

LTP fs_fill is trying to spawn nCPUS thread to create corresponding subdirectories and completely fill them. But in the invoke function tst_fill_fs(, TST_FILL_BLOCKS) -> fill_flat_vec() which has SAFE_MACROs to break the open behavior once fs is filled with ENOSPC return.

The failure like there aren't enough free inodes in the filesystem for the tst_fs_fill test program to create it's set of "AOF" data files.

4108 tst_test.c:1634: TINFO: === Testing on xfs ===
4109 tst_test.c:1094: TINFO: Formatting /dev/loop0 with xfs opts=''

extra opts=''

Quoted 2 lines

4110 fs_fill.c:108: TINFO: Running 98 writer threads 4111 tst_fill_fs.c:77: TBROK:

openat(89</mnt/testarea/ltp-wGg0XNSHcr/LTP_fs_XLxrLh/mntpoint/thread84>, 'AOF', 101, 600): ENOSPC (28)

Quoted 1 line

4112 tst_fill_fs.c:77: TBROK:

openat(87</mnt/testarea/ltp-wGg0XNSHcr/LTP_fs_XLxrLh/mntpoint/thread83>, 'AOF', 101, 600): ENOSPC (28)

Quoted 1 line

4113 tst_fill_fs.c:77: TWARN:

openat(85</mnt/testarea/ltp-wGg0XNSHcr/LTP_fs_XLxrLh/mntpoint/thread82>, 'AOF', 101, 600): ENOSPC (28)

Quoted 9 lines
Quoted 1 line

4114 tst_fill_fs.c:77: TWARN:

openat(3</mnt/testarea/ltp-wGg0XNSHcr/LTP_fs_XLxrLh/mntpoint/thread81>, 'AOF', 101, 600): ENOSPC (28)

Quoted 3 lines

This patch is just to convert the fill_flat_vec() to ignore ENOSPC like fill_randome() in opening subdirectories.

Looks good to me. Thanks for fixing it!

Patch applied, thanks for your review.

Signature · 5 lines
Regards,
Li Wang

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