From: lepillai@linux.ibm.com
To: ltp@lists.linux.it
Cc: lekshmi-cpillai <lekshmi@ktes.isst.tadn.ibm.com>
Subject: [LTP] [PATCH] The error indicates that the test is failing because it cannot create the directory /test/growfiles/reiser.
Date: Wed, 8 Apr 2026 05:15:24 +0000 [thread overview]
Message-ID: <20260408051524.3803026-1-lepillai@linux.ibm.com> (raw)
From: lekshmi-cpillai <lekshmi@ktes.isst.tadn.ibm.com>
Signed-off-by: lekshmi-cpillai <lekshmi@ktes.isst.tadn.ibm.com>
---
testcases/kernel/fs/doio/growfiles.c | 35 +++++++++++++++++++++++++++-
1 file changed, 34 insertions(+), 1 deletion(-)
diff --git a/testcases/kernel/fs/doio/growfiles.c b/testcases/kernel/fs/doio/growfiles.c
index 21960f82a..5a76ef4c5 100644
--- a/testcases/kernel/fs/doio/growfiles.c
+++ b/testcases/kernel/fs/doio/growfiles.c
@@ -119,6 +119,38 @@ int lkfile(int fd, int operation, int lklevel);
int pre_alloc(int fd, long size);
#endif /* !linux */
+/* Helper function to create directories recursively */
+static int mkdir_recursive(const char *path, mode_t mode)
+{
+ char tmp[PATH_MAX];
+ char *p = NULL;
+ size_t len;
+ struct stat st;
+
+ snprintf(tmp, sizeof(tmp), "%s", path);
+ len = strlen(tmp);
+ if (tmp[len - 1] == '/')
+ tmp[len - 1] = 0;
+
+ for (p = tmp + 1; *p; p++) {
+ if (*p == '/') {
+ *p = 0;
+ if (stat(tmp, &st) == -1) {
+ if (mkdir(tmp, mode) == -1 && errno != EEXIST) {
+ return -1;
+ }
+ }
+ *p = '/';
+ }
+ }
+ if (stat(tmp, &st) == -1) {
+ if (mkdir(tmp, mode) == -1 && errno != EEXIST) {
+ return -1;
+ }
+ }
+ return 0;
+}
+
extern int datapidgen(int, char *, int, int);
extern int datapidchk(int, char *, int, int, char **);
@@ -482,7 +514,7 @@ int main(int argc, char **argv)
unsetenv("TMPDIR"); /* force the use of auto_dir */
#endif
if (stat(auto_dir, &statbuf) == -1) {
- if (mkdir(auto_dir, 0777) == -1) {
+ if (mkdir_recursive(auto_dir, 0777) == -1) {
if (errno != EEXIST) {
fprintf(stderr,
"%s%s: Unable to make dir %s\n",
@@ -3058,3 +3090,4 @@ int pre_alloc(int fd, long size)
return 0;
}
#endif
+
--
2.39.1
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next reply other threads:[~2026-04-08 4:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-08 5:15 lepillai [this message]
2026-04-08 9:50 ` [LTP] [PATCH] The error indicates that the test is failing because it cannot create the directory /test/growfiles/reiser Cyril Hrubis
-- strict thread matches above, loose matches on Subject: below --
2026-04-08 5:29 lepillai
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=20260408051524.3803026-1-lepillai@linux.ibm.com \
--to=lepillai@linux.ibm.com \
--cc=lekshmi@ktes.isst.tadn.ibm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.