public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Li Wang <liwang@redhat.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] fs_fill: switch the SAFE MACROs back to ordinary syscall
Date: Fri, 10 Nov 2017 19:15:19 +0800	[thread overview]
Message-ID: <20171110111519.27872-1-liwang@redhat.com> (raw)

To fix those brokens:
  safe_macros.c:225: BROK: tst_fill_fs.c:43: open(mntpoint/thread48/file0,65,0700) failed: ENOSPC
  safe_macros.c:169: BROK: fs_fill.c:49: mkdir(mntpoint/thread21,0700) failed: ENOSPC

Signed-off-by: Li Wang <liwang@redhat.com>
---
 lib/tst_fill_fs.c                     |  9 ++++++++-
 testcases/kernel/fs/fs_fill/fs_fill.c | 10 +++++++++-
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/lib/tst_fill_fs.c b/lib/tst_fill_fs.c
index 6b2bbbc..2775a2c 100644
--- a/lib/tst_fill_fs.c
+++ b/lib/tst_fill_fs.c
@@ -40,7 +40,14 @@ void tst_fill_fs(const char *path, int verbose)
 		if (verbose)
 			tst_res(TINFO, "Creating file %s size %zu", file, len);
 
-		fd = SAFE_OPEN(file, O_WRONLY | O_CREAT, 0700);
+		fd = open(file, O_WRONLY | O_CREAT, 0700);
+		if (fd == -1) {
+			if (errno != ENOSPC)
+				tst_brk(TBROK | TERRNO, "open()");
+
+			tst_res(TINFO | TERRNO, "open()");
+			return;
+		}
 
 		while (len) {
 			ret = write(fd, buf, MIN(len, sizeof(buf)));
diff --git a/testcases/kernel/fs/fs_fill/fs_fill.c b/testcases/kernel/fs/fs_fill/fs_fill.c
index a50a22f..f592cd5 100644
--- a/testcases/kernel/fs/fs_fill/fs_fill.c
+++ b/testcases/kernel/fs/fs_fill/fs_fill.c
@@ -41,12 +41,20 @@ struct worker {
 
 static void *worker(void *p)
 {
+	int ret;
 	struct worker *w = p;
 	DIR *d;
 	struct dirent *ent;
 	char file[PATH_MAX];
 
-	SAFE_MKDIR(w->dir, 0700);
+	ret = mkdir(w->dir, 0700);
+	if (ret == -1) {
+		if (errno != ENOSPC)
+			tst_brk(TBROK | TERRNO, "mkdir()");
+
+		tst_res(TINFO | TERRNO, "mkdir()");
+		return NULL;
+	}
 
 	while (run) {
 		tst_fill_fs(w->dir, 0);
-- 
2.9.3


             reply	other threads:[~2017-11-10 11:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-10 11:15 Li Wang [this message]
2017-11-20 11:18 ` [LTP] [PATCH] fs_fill: switch the SAFE MACROs back to ordinary syscall Jan Stancek
2017-11-20 13:19   ` Cyril Hrubis
2017-11-21  4:14     ` Li Wang
2017-11-21  9:44       ` Cyril Hrubis
2017-11-22 12:48         ` Jan Stancek
2017-11-22 12:51           ` Jan Stancek
2017-11-22 13:29             ` Cyril Hrubis
2017-11-22 13:27           ` Cyril Hrubis

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=20171110111519.27872-1-liwang@redhat.com \
    --to=liwang@redhat.com \
    --cc=ltp@lists.linux.it \
    /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