fsstress: improve error message on check_cwd() error
PATCH v3 1/1 fsstress: improve error message on check_cwd() error
I ran into an error with generic/083 with xfs due to check_cwd() but why it failed is not clear because there are two types of failures:
o stat64() failed (likely -ENOMEM is my guess)
o the inode actually changed
Throw a bone out to developers so that in case en error does happen they know which rabbit hole to go into.
---
Changes on this v3:
o Minor nitpick on spaces
o Changed rabbit hole language
o enhanced stat64() error message to include errno as well
o cast things as suggested
ltp/fsstress.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
ltp/fsstress.c +15 -1
@@ -9,6 +9,7 @@#include <sys/uio.h> #include <stddef.h> #include <stdbool.h> +#include <string.h> #include "global.h" #ifdef HAVE_BTRFSUTIL_H
@@ -943,9 +944,22 @@ check_cwd(void) {#ifdef DEBUG struct stat64 statbuf; +int ret; + + ret =stat64 ("." , &statbuf); +if (ret !=0 ) { +fprintf (stderr,"fsstress: check_cwd stat64() returned %d with errno: %d (%s)\n" , + ret, errno,strerror (errno)); + goto out; + } -if (stat64 ("." , &statbuf) ==0 && statbuf.st_ino == top_ino) +if (statbuf.st_ino == top_ino)return ; + +fprintf (stderr,"fsstress: check_cwd statbuf.st_ino (%llu) != top_ino (%llu)\n" , + (unsigned long long ) statbuf.st_ino, + (unsigned long long ) top_ino); +out:assert (chdir (homedir) ==0 );fprintf (stderr,"fsstress: check_cwd failure\n" );abort ();
Signature · 1 line
2.33.0
Quoted 4 lines · Luis Chamberlain
I ran into an error with generic/083 with xfs due to
check_cwd()but why it failed is not clear because there are two types of failures:
Quoted 8 lines
o
stat64()failed (likely-ENOMEMis my guess)
o the inode actually changedThrow a bone out to developers so that in case en error does happen they know which rabbit hole to go into.
Cc Anthony Iliopoulos <[email protected]>Signed-off-by Luis Chamberlain <[email protected]>
LGTM,
--D
Quoted 51 lines
---
Changes on this v3:
o Minor nitpick on spaces
o Changed rabbit hole language
o enhancedstat64()error message to include errno as well
o cast things as suggestedltp/fsstress.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)ltp/fsstress.c +15
-1@@ -9,6 +9,7 @@#include <sys/uio.h> #include <stddef.h> #include <stdbool.h> +#include <string.h> #include "global.h" #ifdef HAVE_BTRFSUTIL_H @@ -943,9 +944,22 @@ check_cwd(void) {#ifdef DEBUG struct stat64 statbuf; +int ret; + + ret =stat64 ("." , &statbuf); +if (ret !=0 ) { +fprintf (stderr,"fsstress: check_cwd stat64() returned %d with errno: %d (%s)\n" , + ret, errno,strerror (errno)); + goto out; + } -if (stat64 ("." , &statbuf) ==0 && statbuf.st_ino == top_ino) +if (statbuf.st_ino == top_ino)return ; + +fprintf (stderr,"fsstress: check_cwd statbuf.st_ino (%llu) != top_ino (%llu)\n" , + (unsigned long long ) statbuf.st_ino, + (unsigned long long ) top_ino); +out:assert (chdir (homedir) ==0 );fprintf (stderr,"fsstress: check_cwd failure\n" );abort ();Signature · 1 line
2.33.0