All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/8] xfstests: Bunch of new tests
@ 2011-10-19 10:29 ` Dmitry Monakhov
  0 siblings, 0 replies; 32+ messages in thread
From: Dmitry Monakhov @ 2011-10-19 10:29 UTC (permalink / raw)
  To: linux-fsdevel, xfs, linux-ext4, jack, hch, aelder; +Cc: Dmitry Monakhov

xfstests: fsstress should kill children tasks before exit
xfstests: add different logging option to fsstress
xfstests: add fallocate support to fsstress
xfstests: fsstress add FS_IOC_{SET,GET}FLAGS operations
xfstests: Dump inode info when possible
xfstests: add fiemap operation

# Following testcase will fail on recent kernel in case of ext4
# Some fixes are already available here:
# http://www.spinics.net/lists/linux-ext4/msg27857.html
xfstests: add new stress test

# Following testcase will fail on recent kernel in case of ext3/4 
# Fixes available here:
#  http://patchwork.ozlabs.org/patch/120581/
#  http://patchwork.ozlabs.org/patch/120582/
xfstests: add new quota stress test

P.S: ext4 still contains bugs caused by ordered_mode=>journal_mode
switch for didicated inode (chattr +j ./afile), so you temproraly
disable this test by adding "-f setattr=0" to $FSSTRESS_AVOID var.
     

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [PATCH 0/8] xfstests: Bunch of new tests
@ 2011-10-19 10:29 ` Dmitry Monakhov
  0 siblings, 0 replies; 32+ messages in thread
From: Dmitry Monakhov @ 2011-10-19 10:29 UTC (permalink / raw)
  To: linux-fsdevel, xfs, linux-ext4, jack, hch, aelder; +Cc: Dmitry Monakhov

xfstests: fsstress should kill children tasks before exit
xfstests: add different logging option to fsstress
xfstests: add fallocate support to fsstress
xfstests: fsstress add FS_IOC_{SET,GET}FLAGS operations
xfstests: Dump inode info when possible
xfstests: add fiemap operation

# Following testcase will fail on recent kernel in case of ext4
# Some fixes are already available here:
# http://www.spinics.net/lists/linux-ext4/msg27857.html
xfstests: add new stress test

# Following testcase will fail on recent kernel in case of ext3/4 
# Fixes available here:
#  http://patchwork.ozlabs.org/patch/120581/
#  http://patchwork.ozlabs.org/patch/120582/
xfstests: add new quota stress test

P.S: ext4 still contains bugs caused by ordered_mode=>journal_mode
switch for didicated inode (chattr +j ./afile), so you temproraly
disable this test by adding "-f setattr=0" to $FSSTRESS_AVOID var.
     

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [PATCH 1/8] xfstests: fsstress should kill children tasks before exit
  2011-10-19 10:29 ` Dmitry Monakhov
@ 2011-10-19 10:29   ` Dmitry Monakhov
  -1 siblings, 0 replies; 32+ messages in thread
From: Dmitry Monakhov @ 2011-10-19 10:29 UTC (permalink / raw)
  To: linux-fsdevel, xfs, linux-ext4, jack, hch, aelder; +Cc: Dmitry Monakhov

It is very hard to predict runtime for fsstress. In many cases it
is useful to give test to run a reasonable time, and then kill it.
But currently there is no reliable way to kill test without leaving
running children.
This patch add sanity cleanup logic which looks follow:
 - On sigterm received by parent, it resend signal to it's children
 - Wait for each child to terminates
 - EXTRA_SANITY: Even if parent was killed by other signal, children
   will be terminated with SIGKILL to preven staled children.

So now one can simply run fsstress like this:
./fsstress -p 1000 -n999999999 -d $TEST_DIR &
PID=$!
sleep 300
kill $PID
wait $PID

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
 aclocal.m4     |    5 +++++
 configure.in   |    1 +
 ltp/fsstress.c |   36 +++++++++++++++++++++++++++++++++++-
 3 files changed, 41 insertions(+), 1 deletions(-)

diff --git a/aclocal.m4 b/aclocal.m4
index 168eb59..5532606 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -16,6 +16,11 @@ AC_DEFUN([AC_PACKAGE_WANT_LINUX_FIEMAP_H],
     AC_SUBST(have_fiemap)
   ])
 
+AC_DEFUN([AC_PACKAGE_WANT_LINUX_PRCTL_H],
+  [ AC_CHECK_HEADERS([sys/prctl.h], [ have_prctl=true ], [ have_prctl=false ])
+    AC_SUBST(have_prctl)
+  ])
+
 AC_DEFUN([AC_PACKAGE_WANT_FALLOCATE],
   [ AC_MSG_CHECKING([for fallocate])
     AC_TRY_LINK([
diff --git a/configure.in b/configure.in
index c697b4f..76d23e4 100644
--- a/configure.in
+++ b/configure.in
@@ -67,6 +67,7 @@ in
 		AC_PACKAGE_WANT_DMAPI
 		AC_PACKAGE_WANT_LINUX_FIEMAP_H
 		AC_PACKAGE_WANT_FALLOCATE
+		AC_PACKAGE_WANT_LINUX_PRCTL_H
 		;;
 esac
 
diff --git a/ltp/fsstress.c b/ltp/fsstress.c
index c37cddf..34adacc 100644
--- a/ltp/fsstress.c
+++ b/ltp/fsstress.c
@@ -28,7 +28,9 @@
 #ifndef HAVE_ATTR_LIST
 #define attr_list(path, buf, size, flags, cursor) (errno = -ENOSYS, -1)
 #endif
-
+#ifdef HAVE_SYS_PRCTL_H
+#include <sys/prctl.h>
+#endif
 #include <math.h>
 #define XFS_ERRTAG_MAX		17
 #define XFS_IDMODULO_MAX	31	/* user/group IDs (1 << x)  */
@@ -209,6 +211,7 @@ int		rtpct;
 unsigned long	seed = 0;
 ino_t		top_ino;
 int		verbose = 0;
+int 		should_stop = 0;
 
 void	add_to_flist(int, int, int);
 void	append_pathname(pathname_t *, char *);
@@ -253,6 +256,10 @@ void	usage(void);
 void	write_freq(void);
 void	zero_freq(void);
 
+void sg_handler(int signum) {
+	should_stop = 1;
+}
+
 int main(int argc, char **argv)
 {
 	char		buf[10];
@@ -267,6 +274,7 @@ int main(int argc, char **argv)
 	ptrdiff_t	srval;
 	int             nousage = 0;
 	xfs_error_injection_t	        err_inj;
+	struct sigaction action;
 
 	errrange = errtag = 0;
 	umask(0);
@@ -407,15 +415,41 @@ int main(int argc, char **argv)
 		}
 	} else
 		close(fd);
+
+	setpgid(0, 0);
+	action.sa_handler = sg_handler;
+	sigemptyset(&action.sa_mask);
+	action.sa_flags = 0;
+	if (sigaction(SIGTERM, &action, 0)) {
+		perror("sigaction failed");
+		exit(1);
+	}
+
 	for (i = 0; i < nproc; i++) {
 		if (fork() == 0) {
+			action.sa_handler = SIG_DFL;
+			sigemptyset(&action.sa_mask);
+			if (sigaction(SIGTERM, &action, 0))
+				return 1;
+#ifdef HAVE_SYS_PRCTL_H
+			prctl(PR_SET_PDEATHSIG, SIGKILL);
+			if (getppid() == 1) /* parent died already? */
+				return 0;
+#endif
 			procid = i;
 			doproc();
 			return 0;
 		}
 	}
+	while (wait(&stat) > 0 && !should_stop) {
+		continue;
+	}
+	action.sa_flags = SA_RESTART;
+	sigaction(SIGTERM, &action, 0);
+	kill(-getpid(), SIGTERM);
 	while (wait(&stat) > 0)
 		continue;
+
 	if (errtag != 0) {
 		err_inj.errtag = 0;
 		err_inj.fd = fd;
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 1/8] xfstests: fsstress should kill children tasks before exit
@ 2011-10-19 10:29   ` Dmitry Monakhov
  0 siblings, 0 replies; 32+ messages in thread
From: Dmitry Monakhov @ 2011-10-19 10:29 UTC (permalink / raw)
  To: linux-fsdevel, xfs, linux-ext4, jack, hch, aelder; +Cc: Dmitry Monakhov

It is very hard to predict runtime for fsstress. In many cases it
is useful to give test to run a reasonable time, and then kill it.
But currently there is no reliable way to kill test without leaving
running children.
This patch add sanity cleanup logic which looks follow:
 - On sigterm received by parent, it resend signal to it's children
 - Wait for each child to terminates
 - EXTRA_SANITY: Even if parent was killed by other signal, children
   will be terminated with SIGKILL to preven staled children.

So now one can simply run fsstress like this:
./fsstress -p 1000 -n999999999 -d $TEST_DIR &
PID=$!
sleep 300
kill $PID
wait $PID

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
 aclocal.m4     |    5 +++++
 configure.in   |    1 +
 ltp/fsstress.c |   36 +++++++++++++++++++++++++++++++++++-
 3 files changed, 41 insertions(+), 1 deletions(-)

diff --git a/aclocal.m4 b/aclocal.m4
index 168eb59..5532606 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -16,6 +16,11 @@ AC_DEFUN([AC_PACKAGE_WANT_LINUX_FIEMAP_H],
     AC_SUBST(have_fiemap)
   ])
 
+AC_DEFUN([AC_PACKAGE_WANT_LINUX_PRCTL_H],
+  [ AC_CHECK_HEADERS([sys/prctl.h], [ have_prctl=true ], [ have_prctl=false ])
+    AC_SUBST(have_prctl)
+  ])
+
 AC_DEFUN([AC_PACKAGE_WANT_FALLOCATE],
   [ AC_MSG_CHECKING([for fallocate])
     AC_TRY_LINK([
diff --git a/configure.in b/configure.in
index c697b4f..76d23e4 100644
--- a/configure.in
+++ b/configure.in
@@ -67,6 +67,7 @@ in
 		AC_PACKAGE_WANT_DMAPI
 		AC_PACKAGE_WANT_LINUX_FIEMAP_H
 		AC_PACKAGE_WANT_FALLOCATE
+		AC_PACKAGE_WANT_LINUX_PRCTL_H
 		;;
 esac
 
diff --git a/ltp/fsstress.c b/ltp/fsstress.c
index c37cddf..34adacc 100644
--- a/ltp/fsstress.c
+++ b/ltp/fsstress.c
@@ -28,7 +28,9 @@
 #ifndef HAVE_ATTR_LIST
 #define attr_list(path, buf, size, flags, cursor) (errno = -ENOSYS, -1)
 #endif
-
+#ifdef HAVE_SYS_PRCTL_H
+#include <sys/prctl.h>
+#endif
 #include <math.h>
 #define XFS_ERRTAG_MAX		17
 #define XFS_IDMODULO_MAX	31	/* user/group IDs (1 << x)  */
@@ -209,6 +211,7 @@ int		rtpct;
 unsigned long	seed = 0;
 ino_t		top_ino;
 int		verbose = 0;
+int 		should_stop = 0;
 
 void	add_to_flist(int, int, int);
 void	append_pathname(pathname_t *, char *);
@@ -253,6 +256,10 @@ void	usage(void);
 void	write_freq(void);
 void	zero_freq(void);
 
+void sg_handler(int signum) {
+	should_stop = 1;
+}
+
 int main(int argc, char **argv)
 {
 	char		buf[10];
@@ -267,6 +274,7 @@ int main(int argc, char **argv)
 	ptrdiff_t	srval;
 	int             nousage = 0;
 	xfs_error_injection_t	        err_inj;
+	struct sigaction action;
 
 	errrange = errtag = 0;
 	umask(0);
@@ -407,15 +415,41 @@ int main(int argc, char **argv)
 		}
 	} else
 		close(fd);
+
+	setpgid(0, 0);
+	action.sa_handler = sg_handler;
+	sigemptyset(&action.sa_mask);
+	action.sa_flags = 0;
+	if (sigaction(SIGTERM, &action, 0)) {
+		perror("sigaction failed");
+		exit(1);
+	}
+
 	for (i = 0; i < nproc; i++) {
 		if (fork() == 0) {
+			action.sa_handler = SIG_DFL;
+			sigemptyset(&action.sa_mask);
+			if (sigaction(SIGTERM, &action, 0))
+				return 1;
+#ifdef HAVE_SYS_PRCTL_H
+			prctl(PR_SET_PDEATHSIG, SIGKILL);
+			if (getppid() == 1) /* parent died already? */
+				return 0;
+#endif
 			procid = i;
 			doproc();
 			return 0;
 		}
 	}
+	while (wait(&stat) > 0 && !should_stop) {
+		continue;
+	}
+	action.sa_flags = SA_RESTART;
+	sigaction(SIGTERM, &action, 0);
+	kill(-getpid(), SIGTERM);
 	while (wait(&stat) > 0)
 		continue;
+
 	if (errtag != 0) {
 		err_inj.errtag = 0;
 		err_inj.fd = fd;
-- 
1.7.1

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 2/8] xfstests: add different logging option to fsstress
  2011-10-19 10:29 ` Dmitry Monakhov
@ 2011-10-19 10:29   ` Dmitry Monakhov
  -1 siblings, 0 replies; 32+ messages in thread
From: Dmitry Monakhov @ 2011-10-19 10:29 UTC (permalink / raw)
  To: linux-fsdevel, xfs, linux-ext4, jack, hch, aelder; +Cc: Dmitry Monakhov

Currently the only way to log fsstress's output is to redirect it's shared
stdout to pipe which is very painfull because:

1) Pipe writers are serialized via i_mutex so we waste cpu-cores power on stupid
   sinchronization for loging purpose, instead of hunting real race conditions,
   and bugs inside file system.
2) Usually output is corrupted due to luck of sychronization on shared stdout.

Since fsstress's children operate on independend paths, let's just open didicated
log file for each child and simply avoid useless sycnhronization.

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
 ltp/fsstress.c |   32 +++++++++++++++++++++++++++++++-
 1 files changed, 31 insertions(+), 1 deletions(-)

diff --git a/ltp/fsstress.c b/ltp/fsstress.c
index 34adacc..385d5a0 100644
--- a/ltp/fsstress.c
+++ b/ltp/fsstress.c
@@ -265,6 +265,8 @@ int main(int argc, char **argv)
 	char		buf[10];
 	int		c;
 	char		*dirname = NULL;
+	char		*logname = NULL;
+	char		rpath[PATH_MAX];
 	int		fd;
 	int		i;
 	int		j;
@@ -281,7 +283,7 @@ int main(int argc, char **argv)
 	nops = sizeof(ops) / sizeof(ops[0]);
 	ops_end = &ops[nops];
 	myprog = argv[0];
-	while ((c = getopt(argc, argv, "d:e:f:i:m:n:p:rs:vwzHS")) != -1) {
+	while ((c = getopt(argc, argv, "d:e:f:i:m:n:o:p:rs:vwzHS")) != -1) {
 		switch (c) {
 		case 'd':
 			dirname = optarg;
@@ -319,6 +321,10 @@ int main(int argc, char **argv)
 		case 'n':
 			operations = atoi(optarg);
 			break;
+		case 'o':
+			logname = optarg;
+			break;
+
 		case 'p':
 			nproc = atoi(optarg);
 			break;
@@ -359,10 +365,26 @@ int main(int argc, char **argv)
         }
 
 	(void)mkdir(dirname, 0777);
+	if (logname && logname[0] != '/') {
+		if (getcwd(rpath, sizeof(rpath)) < 0){
+			perror("getcwd failed");
+			exit(1);
+		}
+	} else {
+		rpath[0] = '\0';
+	}
 	if (chdir(dirname) < 0) {
 		perror(dirname);
 		exit(1);
 	}
+	if (logname) {
+		char path[PATH_MAX];
+		snprintf(path, sizeof(path), "%s/%s", rpath, logname);
+		if (freopen(path, "a", stdout) == NULL) {
+			perror("freopen logfile failed");
+			exit(1);
+		}
+	}
 	sprintf(buf, "fss%x", (unsigned int)getpid());
 	fd = creat(buf, 0666);
 	if (lseek64(fd, (off64_t)(MAXFSIZE32 + 1ULL), SEEK_SET) < 0)
@@ -436,6 +458,14 @@ int main(int argc, char **argv)
 			if (getppid() == 1) /* parent died already? */
 				return 0;
 #endif
+			if (logname) {
+				char path[PATH_MAX];
+				snprintf(path, sizeof(path), "%s/%s.%d", rpath, logname, i);
+				if (freopen(path, "a", stdout) == NULL) {
+					perror("freopen logfile failed");
+					exit(1);
+				}
+			}
 			procid = i;
 			doproc();
 			return 0;
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 2/8] xfstests: add different logging option to fsstress
@ 2011-10-19 10:29   ` Dmitry Monakhov
  0 siblings, 0 replies; 32+ messages in thread
From: Dmitry Monakhov @ 2011-10-19 10:29 UTC (permalink / raw)
  To: linux-fsdevel, xfs, linux-ext4, jack, hch, aelder; +Cc: Dmitry Monakhov

Currently the only way to log fsstress's output is to redirect it's shared
stdout to pipe which is very painfull because:

1) Pipe writers are serialized via i_mutex so we waste cpu-cores power on stupid
   sinchronization for loging purpose, instead of hunting real race conditions,
   and bugs inside file system.
2) Usually output is corrupted due to luck of sychronization on shared stdout.

Since fsstress's children operate on independend paths, let's just open didicated
log file for each child and simply avoid useless sycnhronization.

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
 ltp/fsstress.c |   32 +++++++++++++++++++++++++++++++-
 1 files changed, 31 insertions(+), 1 deletions(-)

diff --git a/ltp/fsstress.c b/ltp/fsstress.c
index 34adacc..385d5a0 100644
--- a/ltp/fsstress.c
+++ b/ltp/fsstress.c
@@ -265,6 +265,8 @@ int main(int argc, char **argv)
 	char		buf[10];
 	int		c;
 	char		*dirname = NULL;
+	char		*logname = NULL;
+	char		rpath[PATH_MAX];
 	int		fd;
 	int		i;
 	int		j;
@@ -281,7 +283,7 @@ int main(int argc, char **argv)
 	nops = sizeof(ops) / sizeof(ops[0]);
 	ops_end = &ops[nops];
 	myprog = argv[0];
-	while ((c = getopt(argc, argv, "d:e:f:i:m:n:p:rs:vwzHS")) != -1) {
+	while ((c = getopt(argc, argv, "d:e:f:i:m:n:o:p:rs:vwzHS")) != -1) {
 		switch (c) {
 		case 'd':
 			dirname = optarg;
@@ -319,6 +321,10 @@ int main(int argc, char **argv)
 		case 'n':
 			operations = atoi(optarg);
 			break;
+		case 'o':
+			logname = optarg;
+			break;
+
 		case 'p':
 			nproc = atoi(optarg);
 			break;
@@ -359,10 +365,26 @@ int main(int argc, char **argv)
         }
 
 	(void)mkdir(dirname, 0777);
+	if (logname && logname[0] != '/') {
+		if (getcwd(rpath, sizeof(rpath)) < 0){
+			perror("getcwd failed");
+			exit(1);
+		}
+	} else {
+		rpath[0] = '\0';
+	}
 	if (chdir(dirname) < 0) {
 		perror(dirname);
 		exit(1);
 	}
+	if (logname) {
+		char path[PATH_MAX];
+		snprintf(path, sizeof(path), "%s/%s", rpath, logname);
+		if (freopen(path, "a", stdout) == NULL) {
+			perror("freopen logfile failed");
+			exit(1);
+		}
+	}
 	sprintf(buf, "fss%x", (unsigned int)getpid());
 	fd = creat(buf, 0666);
 	if (lseek64(fd, (off64_t)(MAXFSIZE32 + 1ULL), SEEK_SET) < 0)
@@ -436,6 +458,14 @@ int main(int argc, char **argv)
 			if (getppid() == 1) /* parent died already? */
 				return 0;
 #endif
+			if (logname) {
+				char path[PATH_MAX];
+				snprintf(path, sizeof(path), "%s/%s.%d", rpath, logname, i);
+				if (freopen(path, "a", stdout) == NULL) {
+					perror("freopen logfile failed");
+					exit(1);
+				}
+			}
 			procid = i;
 			doproc();
 			return 0;
-- 
1.7.1

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 3/8] xfstests: add fallocate support to fsstress
  2011-10-19 10:29 ` Dmitry Monakhov
@ 2011-10-19 10:29   ` Dmitry Monakhov
  -1 siblings, 0 replies; 32+ messages in thread
From: Dmitry Monakhov @ 2011-10-19 10:29 UTC (permalink / raw)
  To: linux-fsdevel, xfs, linux-ext4, jack, hch, aelder; +Cc: Dmitry Monakhov

Add tests for fallocate(2) syscall
- fallocate: reserve the disk space
- punch: de-allocates the disk space
Since FALLOC_FL_PUNCH_HOLE is relatively new it's value defined
explicitly if not yet defined. Later we may clear that define.

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
 ltp/fsstress.c |  123 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 122 insertions(+), 1 deletions(-)

diff --git a/ltp/fsstress.c b/ltp/fsstress.c
index 385d5a0..4aba34f 100644
--- a/ltp/fsstress.c
+++ b/ltp/fsstress.c
@@ -24,7 +24,13 @@
 #ifdef HAVE_ATTR_ATTRIBUTES_H
 #include <attr/attributes.h>
 #endif
-
+#ifdef FALLOCATE
+#include <linux/falloc.h>
+#ifndef FALLOC_FL_PUNCH_HOLE
+/* Copy-paste from linux/falloc.h */
+#define FALLOC_FL_PUNCH_HOLE    0x02 /* de-allocates range */
+#endif
+#endif
 #ifndef HAVE_ATTR_LIST
 #define attr_list(path, buf, size, flags, cursor) (errno = -ENOSYS, -1)
 #endif
@@ -48,6 +54,7 @@ typedef enum {
 	OP_CREAT,
 	OP_DREAD,
 	OP_DWRITE,
+	OP_FALLOCATE,
 	OP_FDATASYNC,
 	OP_FREESP,
 	OP_FSYNC,
@@ -55,6 +62,7 @@ typedef enum {
 	OP_LINK,
 	OP_MKDIR,
 	OP_MKNOD,
+	OP_PUNCH,
 	OP_READ,
 	OP_READLINK,
 	OP_RENAME,
@@ -128,6 +136,7 @@ void	chown_f(int, long);
 void	creat_f(int, long);
 void	dread_f(int, long);
 void	dwrite_f(int, long);
+void	fallocate_f(int, long);
 void	fdatasync_f(int, long);
 void	freesp_f(int, long);
 void	fsync_f(int, long);
@@ -135,6 +144,7 @@ void	getdents_f(int, long);
 void	link_f(int, long);
 void	mkdir_f(int, long);
 void	mknod_f(int, long);
+void	punch_f(int, long);
 void	read_f(int, long);
 void	readlink_f(int, long);
 void	rename_f(int, long);
@@ -159,6 +169,7 @@ opdesc_t	ops[] = {
 	{ OP_CREAT, "creat", creat_f, 4, 1 },
 	{ OP_DREAD, "dread", dread_f, 4, 0 },
 	{ OP_DWRITE, "dwrite", dwrite_f, 4, 1 },
+	{ OP_FALLOCATE, "fallocate", fallocate_f, 1, 1 },
 	{ OP_FDATASYNC, "fdatasync", fdatasync_f, 1, 1 },
 	{ OP_FREESP, "freesp", freesp_f, 1, 1 },
 	{ OP_FSYNC, "fsync", fsync_f, 1, 1 },
@@ -166,6 +177,7 @@ opdesc_t	ops[] = {
 	{ OP_LINK, "link", link_f, 1, 1 },
 	{ OP_MKDIR, "mkdir", mkdir_f, 2, 1 },
 	{ OP_MKNOD, "mknod", mknod_f, 2, 1 },
+	{ OP_PUNCH, "punch", punch_f, 1, 1 },
 	{ OP_READ, "read", read_f, 1, 0 },
 	{ OP_READLINK, "readlink", readlink_f, 1, 0 },
 	{ OP_RENAME, "rename", rename_f, 2, 1 },
@@ -1981,6 +1993,61 @@ dwrite_f(int opno, long r)
 }
 
 void
+fallocate_f(int opno, long r)
+{
+#ifdef FALLOCATE
+	int		e;
+	pathname_t	f;
+	int		fd;
+	__int64_t	lr;
+	off64_t		off;
+	off64_t		len;
+	struct stat64	stb;
+	int		v;
+	int mode = 0;
+
+	init_pathname(&f);
+	if (!get_fname(FT_REGFILE, r, &f, NULL, NULL, &v)) {
+		if (v)
+			printf("%d/%d: fallocate - no filename\n", procid, opno);
+		free_pathname(&f);
+		return;
+	}
+	fd = open_path(&f, O_RDWR);
+	e = fd < 0 ? errno : 0;
+	check_cwd();
+	if (fd < 0) {
+		if (v)
+			printf("%d/%d: fallocate - open %s failed %d\n",
+				procid, opno, f.path, e);
+		free_pathname(&f);
+		return;
+	}
+	if (fstat64(fd, &stb) < 0) {
+		if (v)
+			printf("%d/%d: fallocate - fstat64 %s failed %d\n",
+				procid, opno, f.path, errno);
+		free_pathname(&f);
+		close(fd);
+		return;
+	}
+	lr = ((__int64_t)random() << 32) + random();
+	off = (off64_t)(lr % MIN(stb.st_size + (1024 * 1024), MAXFSIZE));
+	off %= maxfsize;
+	len = (off64_t)(random() % (1024 * 1024));
+	mode |= FALLOC_FL_KEEP_SIZE & random();
+	e = fallocate(fd, mode, (loff_t)off, (loff_t)len) < 0 ? errno : 0;
+	if (v)
+		printf("%d/%d: fallocate(%d) %s %lld %lld %d\n",
+		       procid, opno, mode,
+		       f.path, (long long)off, (long long)len, e);
+	free_pathname(&f);
+	close(fd);
+#endif
+}
+
+
+void
 fdatasync_f(int opno, long r)
 {
 	int		e;
@@ -2251,6 +2318,60 @@ mknod_f(int opno, long r)
 }
 
 void
+punch_f(int opno, long r)
+{
+#ifdef FALLOCATE
+	int		e;
+	pathname_t	f;
+	int		fd;
+	__int64_t	lr;
+	off64_t		off;
+	off64_t		len;
+	struct stat64	stb;
+	int		v;
+	int mode = FALLOC_FL_PUNCH_HOLE;
+
+	init_pathname(&f);
+	if (!get_fname(FT_REGFILE, r, &f, NULL, NULL, &v)) {
+		if (v)
+			printf("%d/%d: punch hole - no filename\n", procid, opno);
+		free_pathname(&f);
+		return;
+	}
+	fd = open_path(&f, O_RDWR);
+	e = fd < 0 ? errno : 0;
+	check_cwd();
+	if (fd < 0) {
+		if (v)
+			printf("%d/%d: punch hole - open %s failed %d\n",
+				procid, opno, f.path, e);
+		free_pathname(&f);
+		return;
+	}
+	if (fstat64(fd, &stb) < 0) {
+		if (v)
+			printf("%d/%d: punch hole - fstat64 %s failed %d\n",
+				procid, opno, f.path, errno);
+		free_pathname(&f);
+		close(fd);
+		return;
+	}
+	lr = ((__int64_t)random() << 32) + random();
+	off = (off64_t)(lr % MIN(stb.st_size + (1024 * 1024), MAXFSIZE));
+	off %= maxfsize;
+	len = (off64_t)(random() % (1024 * 1024));
+	mode |= FALLOC_FL_KEEP_SIZE & random();
+	e = fallocate(fd, mode, (loff_t)off, (loff_t)len) < 0 ? errno : 0;
+	if (v)
+		printf("%d/%d: punch hole(%d) %s %lld %lld %d\n",
+		       procid, opno, mode,
+		       f.path, (long long)off, (long long)len, e);
+	free_pathname(&f);
+	close(fd);
+#endif
+}
+
+void
 read_f(int opno, long r)
 {
 	char		*buf;
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 3/8] xfstests: add fallocate support to fsstress
@ 2011-10-19 10:29   ` Dmitry Monakhov
  0 siblings, 0 replies; 32+ messages in thread
From: Dmitry Monakhov @ 2011-10-19 10:29 UTC (permalink / raw)
  To: linux-fsdevel, xfs, linux-ext4, jack, hch, aelder; +Cc: Dmitry Monakhov

Add tests for fallocate(2) syscall
- fallocate: reserve the disk space
- punch: de-allocates the disk space
Since FALLOC_FL_PUNCH_HOLE is relatively new it's value defined
explicitly if not yet defined. Later we may clear that define.

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
 ltp/fsstress.c |  123 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 122 insertions(+), 1 deletions(-)

diff --git a/ltp/fsstress.c b/ltp/fsstress.c
index 385d5a0..4aba34f 100644
--- a/ltp/fsstress.c
+++ b/ltp/fsstress.c
@@ -24,7 +24,13 @@
 #ifdef HAVE_ATTR_ATTRIBUTES_H
 #include <attr/attributes.h>
 #endif
-
+#ifdef FALLOCATE
+#include <linux/falloc.h>
+#ifndef FALLOC_FL_PUNCH_HOLE
+/* Copy-paste from linux/falloc.h */
+#define FALLOC_FL_PUNCH_HOLE    0x02 /* de-allocates range */
+#endif
+#endif
 #ifndef HAVE_ATTR_LIST
 #define attr_list(path, buf, size, flags, cursor) (errno = -ENOSYS, -1)
 #endif
@@ -48,6 +54,7 @@ typedef enum {
 	OP_CREAT,
 	OP_DREAD,
 	OP_DWRITE,
+	OP_FALLOCATE,
 	OP_FDATASYNC,
 	OP_FREESP,
 	OP_FSYNC,
@@ -55,6 +62,7 @@ typedef enum {
 	OP_LINK,
 	OP_MKDIR,
 	OP_MKNOD,
+	OP_PUNCH,
 	OP_READ,
 	OP_READLINK,
 	OP_RENAME,
@@ -128,6 +136,7 @@ void	chown_f(int, long);
 void	creat_f(int, long);
 void	dread_f(int, long);
 void	dwrite_f(int, long);
+void	fallocate_f(int, long);
 void	fdatasync_f(int, long);
 void	freesp_f(int, long);
 void	fsync_f(int, long);
@@ -135,6 +144,7 @@ void	getdents_f(int, long);
 void	link_f(int, long);
 void	mkdir_f(int, long);
 void	mknod_f(int, long);
+void	punch_f(int, long);
 void	read_f(int, long);
 void	readlink_f(int, long);
 void	rename_f(int, long);
@@ -159,6 +169,7 @@ opdesc_t	ops[] = {
 	{ OP_CREAT, "creat", creat_f, 4, 1 },
 	{ OP_DREAD, "dread", dread_f, 4, 0 },
 	{ OP_DWRITE, "dwrite", dwrite_f, 4, 1 },
+	{ OP_FALLOCATE, "fallocate", fallocate_f, 1, 1 },
 	{ OP_FDATASYNC, "fdatasync", fdatasync_f, 1, 1 },
 	{ OP_FREESP, "freesp", freesp_f, 1, 1 },
 	{ OP_FSYNC, "fsync", fsync_f, 1, 1 },
@@ -166,6 +177,7 @@ opdesc_t	ops[] = {
 	{ OP_LINK, "link", link_f, 1, 1 },
 	{ OP_MKDIR, "mkdir", mkdir_f, 2, 1 },
 	{ OP_MKNOD, "mknod", mknod_f, 2, 1 },
+	{ OP_PUNCH, "punch", punch_f, 1, 1 },
 	{ OP_READ, "read", read_f, 1, 0 },
 	{ OP_READLINK, "readlink", readlink_f, 1, 0 },
 	{ OP_RENAME, "rename", rename_f, 2, 1 },
@@ -1981,6 +1993,61 @@ dwrite_f(int opno, long r)
 }
 
 void
+fallocate_f(int opno, long r)
+{
+#ifdef FALLOCATE
+	int		e;
+	pathname_t	f;
+	int		fd;
+	__int64_t	lr;
+	off64_t		off;
+	off64_t		len;
+	struct stat64	stb;
+	int		v;
+	int mode = 0;
+
+	init_pathname(&f);
+	if (!get_fname(FT_REGFILE, r, &f, NULL, NULL, &v)) {
+		if (v)
+			printf("%d/%d: fallocate - no filename\n", procid, opno);
+		free_pathname(&f);
+		return;
+	}
+	fd = open_path(&f, O_RDWR);
+	e = fd < 0 ? errno : 0;
+	check_cwd();
+	if (fd < 0) {
+		if (v)
+			printf("%d/%d: fallocate - open %s failed %d\n",
+				procid, opno, f.path, e);
+		free_pathname(&f);
+		return;
+	}
+	if (fstat64(fd, &stb) < 0) {
+		if (v)
+			printf("%d/%d: fallocate - fstat64 %s failed %d\n",
+				procid, opno, f.path, errno);
+		free_pathname(&f);
+		close(fd);
+		return;
+	}
+	lr = ((__int64_t)random() << 32) + random();
+	off = (off64_t)(lr % MIN(stb.st_size + (1024 * 1024), MAXFSIZE));
+	off %= maxfsize;
+	len = (off64_t)(random() % (1024 * 1024));
+	mode |= FALLOC_FL_KEEP_SIZE & random();
+	e = fallocate(fd, mode, (loff_t)off, (loff_t)len) < 0 ? errno : 0;
+	if (v)
+		printf("%d/%d: fallocate(%d) %s %lld %lld %d\n",
+		       procid, opno, mode,
+		       f.path, (long long)off, (long long)len, e);
+	free_pathname(&f);
+	close(fd);
+#endif
+}
+
+
+void
 fdatasync_f(int opno, long r)
 {
 	int		e;
@@ -2251,6 +2318,60 @@ mknod_f(int opno, long r)
 }
 
 void
+punch_f(int opno, long r)
+{
+#ifdef FALLOCATE
+	int		e;
+	pathname_t	f;
+	int		fd;
+	__int64_t	lr;
+	off64_t		off;
+	off64_t		len;
+	struct stat64	stb;
+	int		v;
+	int mode = FALLOC_FL_PUNCH_HOLE;
+
+	init_pathname(&f);
+	if (!get_fname(FT_REGFILE, r, &f, NULL, NULL, &v)) {
+		if (v)
+			printf("%d/%d: punch hole - no filename\n", procid, opno);
+		free_pathname(&f);
+		return;
+	}
+	fd = open_path(&f, O_RDWR);
+	e = fd < 0 ? errno : 0;
+	check_cwd();
+	if (fd < 0) {
+		if (v)
+			printf("%d/%d: punch hole - open %s failed %d\n",
+				procid, opno, f.path, e);
+		free_pathname(&f);
+		return;
+	}
+	if (fstat64(fd, &stb) < 0) {
+		if (v)
+			printf("%d/%d: punch hole - fstat64 %s failed %d\n",
+				procid, opno, f.path, errno);
+		free_pathname(&f);
+		close(fd);
+		return;
+	}
+	lr = ((__int64_t)random() << 32) + random();
+	off = (off64_t)(lr % MIN(stb.st_size + (1024 * 1024), MAXFSIZE));
+	off %= maxfsize;
+	len = (off64_t)(random() % (1024 * 1024));
+	mode |= FALLOC_FL_KEEP_SIZE & random();
+	e = fallocate(fd, mode, (loff_t)off, (loff_t)len) < 0 ? errno : 0;
+	if (v)
+		printf("%d/%d: punch hole(%d) %s %lld %lld %d\n",
+		       procid, opno, mode,
+		       f.path, (long long)off, (long long)len, e);
+	free_pathname(&f);
+	close(fd);
+#endif
+}
+
+void
 read_f(int opno, long r)
 {
 	char		*buf;
-- 
1.7.1

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 4/8] xfstests: fsstress add FS_IOC_{SET,GET}FLAGS operations
  2011-10-19 10:29 ` Dmitry Monakhov
@ 2011-10-19 10:29   ` Dmitry Monakhov
  -1 siblings, 0 replies; 32+ messages in thread
From: Dmitry Monakhov @ 2011-10-19 10:29 UTC (permalink / raw)
  To: linux-fsdevel, xfs, linux-ext4, jack, hch, aelder; +Cc: Dmitry Monakhov

Add two new operations:
- getattr: ioctl(fd, FS_IOC_GETFLAGS, &fl)
- setattr: ioctl(fd, FS_IOC_SETFLAGS, &random_flags)
By default FS_IOC_SETFLAGS has zero probability because
it may produce inodes with APPEND or IMMUTABLE flags which
are not deletable by default. Let's assumes that one who
enable it knows how to delete such inodes.
For example like follows:
find $TEST_PATH -exec chattr -i -a {} \;
rm -rf $TEST_PATH

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
 aclocal.m4     |    4 +++
 configure.in   |    1 +
 ltp/fsstress.c |   63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 68 insertions(+), 0 deletions(-)

diff --git a/aclocal.m4 b/aclocal.m4
index 5532606..5739004 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -21,6 +21,10 @@ AC_DEFUN([AC_PACKAGE_WANT_LINUX_PRCTL_H],
     AC_SUBST(have_prctl)
   ])
 
+AC_DEFUN([AC_PACKAGE_WANT_LINUX_FS_H],
+  [ AC_CHECK_HEADER([linux/fs.h])
+  ])
+
 AC_DEFUN([AC_PACKAGE_WANT_FALLOCATE],
   [ AC_MSG_CHECKING([for fallocate])
     AC_TRY_LINK([
diff --git a/configure.in b/configure.in
index 76d23e4..3b40e55 100644
--- a/configure.in
+++ b/configure.in
@@ -68,6 +68,7 @@ in
 		AC_PACKAGE_WANT_LINUX_FIEMAP_H
 		AC_PACKAGE_WANT_FALLOCATE
 		AC_PACKAGE_WANT_LINUX_PRCTL_H
+		AC_PACKAGE_WANT_LINUX_FS_H
 		;;
 esac
 
diff --git a/ltp/fsstress.c b/ltp/fsstress.c
index 4aba34f..756bdd6 100644
--- a/ltp/fsstress.c
+++ b/ltp/fsstress.c
@@ -37,6 +37,15 @@
 #ifdef HAVE_SYS_PRCTL_H
 #include <sys/prctl.h>
 #endif
+
+#include <linux/fs.h>
+#ifndef FS_IOC_GETFLAGS
+#define FS_IOC_GETFLAGS                 _IOR('f', 1, long)
+#endif
+#ifndef FS_IOC_SETFLAGS
+#define FS_IOC_SETFLAGS                 _IOW('f', 2, long)
+#endif
+
 #include <math.h>
 #define XFS_ERRTAG_MAX		17
 #define XFS_IDMODULO_MAX	31	/* user/group IDs (1 << x)  */
@@ -58,6 +67,7 @@ typedef enum {
 	OP_FDATASYNC,
 	OP_FREESP,
 	OP_FSYNC,
+	OP_GETATTR,
 	OP_GETDENTS,
 	OP_LINK,
 	OP_MKDIR,
@@ -68,6 +78,7 @@ typedef enum {
 	OP_RENAME,
 	OP_RESVSP,
 	OP_RMDIR,
+	OP_SETATTR,
 	OP_SETXATTR,
 	OP_STAT,
 	OP_SYMLINK,
@@ -152,6 +163,8 @@ void	resvsp_f(int, long);
 void	rmdir_f(int, long);
 void	setxattr_f(int, long);
 void	stat_f(int, long);
+void	getattr_f(int, long);
+void	setattr_f(int, long);
 void	symlink_f(int, long);
 void	sync_f(int, long);
 void	truncate_f(int, long);
@@ -173,6 +186,7 @@ opdesc_t	ops[] = {
 	{ OP_FDATASYNC, "fdatasync", fdatasync_f, 1, 1 },
 	{ OP_FREESP, "freesp", freesp_f, 1, 1 },
 	{ OP_FSYNC, "fsync", fsync_f, 1, 1 },
+	{ OP_GETATTR, "getattr", getattr_f, 1, 0 },
 	{ OP_GETDENTS, "getdents", getdents_f, 1, 0 },
 	{ OP_LINK, "link", link_f, 1, 1 },
 	{ OP_MKDIR, "mkdir", mkdir_f, 2, 1 },
@@ -183,6 +197,7 @@ opdesc_t	ops[] = {
 	{ OP_RENAME, "rename", rename_f, 2, 1 },
 	{ OP_RESVSP, "resvsp", resvsp_f, 1, 1 },
 	{ OP_RMDIR, "rmdir", rmdir_f, 1, 1 },
+	{ OP_SETATTR, "setattr", setattr_f, 0, 1 },
 	{ OP_SETXATTR, "setxattr", setxattr_f, 1, 1 },
 	{ OP_STAT, "stat", stat_f, 1, 0 },
 	{ OP_SYMLINK, "symlink", symlink_f, 2, 1 },
@@ -1769,6 +1784,54 @@ setxattr_f(int opno, long r)
 }
 
 void
+getattr_f(int opno, long r)
+{
+	int		fd;
+	int		e;
+	pathname_t	f;
+	uint		fl;
+	int		v;
+
+	init_pathname(&f);
+	if (!get_fname(FT_ANYm, r, &f, NULL, NULL, &v))
+		append_pathname(&f, ".");
+	fd = open_path(&f, O_RDWR);
+	e = fd < 0 ? errno : 0;
+	check_cwd();
+
+	e = ioctl(fd, FS_IOC_GETFLAGS, &fl);
+	if (v)
+		printf("%d/%d: getattr %s %u %d\n", procid, opno, f.path, fl, e);
+	free_pathname(&f);
+	close(fd);
+}
+
+void
+setattr_f(int opno, long r)
+{
+	int		fd;
+	int		e;
+	pathname_t	f;
+	uint		fl;
+	int		v;
+
+	init_pathname(&f);
+	if (!get_fname(FT_ANYm, r, &f, NULL, NULL, &v))
+		append_pathname(&f, ".");
+	fd = open_path(&f, O_RDWR);
+	e = fd < 0 ? errno : 0;
+	check_cwd();
+
+	fl = (uint)random();
+	e = ioctl(fd, FS_IOC_SETFLAGS, &fl);
+	if (v)
+		printf("%d/%d: setattr %s %u %d\n", procid, opno, f.path, fl, e);
+	free_pathname(&f);
+	close(fd);
+}
+
+
+void
 creat_f(int opno, long r)
 {
 	struct fsxattr	a;
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 4/8] xfstests: fsstress add FS_IOC_{SET,GET}FLAGS operations
@ 2011-10-19 10:29   ` Dmitry Monakhov
  0 siblings, 0 replies; 32+ messages in thread
From: Dmitry Monakhov @ 2011-10-19 10:29 UTC (permalink / raw)
  To: linux-fsdevel, xfs, linux-ext4, jack, hch, aelder; +Cc: Dmitry Monakhov

Add two new operations:
- getattr: ioctl(fd, FS_IOC_GETFLAGS, &fl)
- setattr: ioctl(fd, FS_IOC_SETFLAGS, &random_flags)
By default FS_IOC_SETFLAGS has zero probability because
it may produce inodes with APPEND or IMMUTABLE flags which
are not deletable by default. Let's assumes that one who
enable it knows how to delete such inodes.
For example like follows:
find $TEST_PATH -exec chattr -i -a {} \;
rm -rf $TEST_PATH

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
 aclocal.m4     |    4 +++
 configure.in   |    1 +
 ltp/fsstress.c |   63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 68 insertions(+), 0 deletions(-)

diff --git a/aclocal.m4 b/aclocal.m4
index 5532606..5739004 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -21,6 +21,10 @@ AC_DEFUN([AC_PACKAGE_WANT_LINUX_PRCTL_H],
     AC_SUBST(have_prctl)
   ])
 
+AC_DEFUN([AC_PACKAGE_WANT_LINUX_FS_H],
+  [ AC_CHECK_HEADER([linux/fs.h])
+  ])
+
 AC_DEFUN([AC_PACKAGE_WANT_FALLOCATE],
   [ AC_MSG_CHECKING([for fallocate])
     AC_TRY_LINK([
diff --git a/configure.in b/configure.in
index 76d23e4..3b40e55 100644
--- a/configure.in
+++ b/configure.in
@@ -68,6 +68,7 @@ in
 		AC_PACKAGE_WANT_LINUX_FIEMAP_H
 		AC_PACKAGE_WANT_FALLOCATE
 		AC_PACKAGE_WANT_LINUX_PRCTL_H
+		AC_PACKAGE_WANT_LINUX_FS_H
 		;;
 esac
 
diff --git a/ltp/fsstress.c b/ltp/fsstress.c
index 4aba34f..756bdd6 100644
--- a/ltp/fsstress.c
+++ b/ltp/fsstress.c
@@ -37,6 +37,15 @@
 #ifdef HAVE_SYS_PRCTL_H
 #include <sys/prctl.h>
 #endif
+
+#include <linux/fs.h>
+#ifndef FS_IOC_GETFLAGS
+#define FS_IOC_GETFLAGS                 _IOR('f', 1, long)
+#endif
+#ifndef FS_IOC_SETFLAGS
+#define FS_IOC_SETFLAGS                 _IOW('f', 2, long)
+#endif
+
 #include <math.h>
 #define XFS_ERRTAG_MAX		17
 #define XFS_IDMODULO_MAX	31	/* user/group IDs (1 << x)  */
@@ -58,6 +67,7 @@ typedef enum {
 	OP_FDATASYNC,
 	OP_FREESP,
 	OP_FSYNC,
+	OP_GETATTR,
 	OP_GETDENTS,
 	OP_LINK,
 	OP_MKDIR,
@@ -68,6 +78,7 @@ typedef enum {
 	OP_RENAME,
 	OP_RESVSP,
 	OP_RMDIR,
+	OP_SETATTR,
 	OP_SETXATTR,
 	OP_STAT,
 	OP_SYMLINK,
@@ -152,6 +163,8 @@ void	resvsp_f(int, long);
 void	rmdir_f(int, long);
 void	setxattr_f(int, long);
 void	stat_f(int, long);
+void	getattr_f(int, long);
+void	setattr_f(int, long);
 void	symlink_f(int, long);
 void	sync_f(int, long);
 void	truncate_f(int, long);
@@ -173,6 +186,7 @@ opdesc_t	ops[] = {
 	{ OP_FDATASYNC, "fdatasync", fdatasync_f, 1, 1 },
 	{ OP_FREESP, "freesp", freesp_f, 1, 1 },
 	{ OP_FSYNC, "fsync", fsync_f, 1, 1 },
+	{ OP_GETATTR, "getattr", getattr_f, 1, 0 },
 	{ OP_GETDENTS, "getdents", getdents_f, 1, 0 },
 	{ OP_LINK, "link", link_f, 1, 1 },
 	{ OP_MKDIR, "mkdir", mkdir_f, 2, 1 },
@@ -183,6 +197,7 @@ opdesc_t	ops[] = {
 	{ OP_RENAME, "rename", rename_f, 2, 1 },
 	{ OP_RESVSP, "resvsp", resvsp_f, 1, 1 },
 	{ OP_RMDIR, "rmdir", rmdir_f, 1, 1 },
+	{ OP_SETATTR, "setattr", setattr_f, 0, 1 },
 	{ OP_SETXATTR, "setxattr", setxattr_f, 1, 1 },
 	{ OP_STAT, "stat", stat_f, 1, 0 },
 	{ OP_SYMLINK, "symlink", symlink_f, 2, 1 },
@@ -1769,6 +1784,54 @@ setxattr_f(int opno, long r)
 }
 
 void
+getattr_f(int opno, long r)
+{
+	int		fd;
+	int		e;
+	pathname_t	f;
+	uint		fl;
+	int		v;
+
+	init_pathname(&f);
+	if (!get_fname(FT_ANYm, r, &f, NULL, NULL, &v))
+		append_pathname(&f, ".");
+	fd = open_path(&f, O_RDWR);
+	e = fd < 0 ? errno : 0;
+	check_cwd();
+
+	e = ioctl(fd, FS_IOC_GETFLAGS, &fl);
+	if (v)
+		printf("%d/%d: getattr %s %u %d\n", procid, opno, f.path, fl, e);
+	free_pathname(&f);
+	close(fd);
+}
+
+void
+setattr_f(int opno, long r)
+{
+	int		fd;
+	int		e;
+	pathname_t	f;
+	uint		fl;
+	int		v;
+
+	init_pathname(&f);
+	if (!get_fname(FT_ANYm, r, &f, NULL, NULL, &v))
+		append_pathname(&f, ".");
+	fd = open_path(&f, O_RDWR);
+	e = fd < 0 ? errno : 0;
+	check_cwd();
+
+	fl = (uint)random();
+	e = ioctl(fd, FS_IOC_SETFLAGS, &fl);
+	if (v)
+		printf("%d/%d: setattr %s %u %d\n", procid, opno, f.path, fl, e);
+	free_pathname(&f);
+	close(fd);
+}
+
+
+void
 creat_f(int opno, long r)
 {
 	struct fsxattr	a;
-- 
1.7.1

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 5/8] xfstests: Dump inode info when possible
  2011-10-19 10:29 ` Dmitry Monakhov
@ 2011-10-19 10:29   ` Dmitry Monakhov
  -1 siblings, 0 replies; 32+ messages in thread
From: Dmitry Monakhov @ 2011-10-19 10:29 UTC (permalink / raw)
  To: linux-fsdevel, xfs, linux-ext4, jack, hch, aelder; +Cc: Dmitry Monakhov

Fsstress exec behaviour is not completely determinated in case of
low resources mode due to ENOMEM, ENOSPC, etc. In some places we
call stat(2). This information may be halpfull for future
investigations purposes. Let's dump stat info where possible.

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
 ltp/fsstress.c |   92 +++++++++++++++++++++++++++++++++++++------------------
 1 files changed, 62 insertions(+), 30 deletions(-)

diff --git a/ltp/fsstress.c b/ltp/fsstress.c
index 756bdd6..baccbbd 100644
--- a/ltp/fsstress.c
+++ b/ltp/fsstress.c
@@ -1482,6 +1482,14 @@ zero_freq(void)
 		p->freq = 0;
 }
 
+void inode_info(char *str, size_t sz, struct stat64 *s, int verbose)
+{
+	if (verbose)
+		snprintf(str, sz, "[%ld %ld %d %d %lld %lld]", (long)s->st_ino,
+			 (long)s->st_nlink,  s->st_uid, s->st_gid,
+			 (long long) s->st_blocks, (long long) s->st_size);
+}
+
 void
 allocsp_f(int opno, long r)
 {
@@ -1493,6 +1501,7 @@ allocsp_f(int opno, long r)
 	off64_t		off;
 	struct stat64	stb;
 	int		v;
+	char		st[1024];
 
 	init_pathname(&f);
 	if (!get_fname(FT_REGFILE, r, &f, NULL, NULL, &v)) {
@@ -1519,6 +1528,8 @@ allocsp_f(int opno, long r)
 		close(fd);
 		return;
 	}
+
+	inode_info(st, sizeof(st), &stb, v);
 	lr = ((__int64_t)random() << 32) + random();
 	off = (off64_t)(lr % MIN(stb.st_size + (1024 * 1024), MAXFSIZE));
 	off %= maxfsize;
@@ -1526,9 +1537,10 @@ allocsp_f(int opno, long r)
 	fl.l_start = off;
 	fl.l_len = 0;
 	e = xfsctl(f.path, fd, XFS_IOC_ALLOCSP64, &fl) < 0 ? errno : 0;
-	if (v)
-		printf("%d/%d: xfsctl(XFS_IOC_ALLOCSP64) %s %lld 0 %d\n",
-			procid, opno, f.path, (long long)off, e);
+	if (v) {
+		printf("%d/%d: xfsctl(XFS_IOC_ALLOCSP64) %s%s %lld 0 %d\n",
+		       procid, opno, f.path, st, (long long)off, e);
+	}
 	free_pathname(&f);
 	close(fd);
 }
@@ -1918,6 +1930,7 @@ dread_f(int opno, long r)
 	off64_t		off;
 	struct stat64	stb;
 	int		v;
+	char		st[1024];
 
 	init_pathname(&f);
 	if (!get_fname(FT_REGFILE, r, &f, NULL, NULL, &v)) {
@@ -1939,15 +1952,17 @@ dread_f(int opno, long r)
 	if (fstat64(fd, &stb) < 0) {
 		if (v)
 			printf("%d/%d: dread - fstat64 %s failed %d\n",
-				procid, opno, f.path, errno);
+			       procid, opno, f.path, errno);
 		free_pathname(&f);
 		close(fd);
 		return;
 	}
+
+	inode_info(st, sizeof(st), &stb, v);
 	if (stb.st_size == 0) {
 		if (v)
-			printf("%d/%d: dread - %s zero size\n", procid, opno,
-				f.path);
+			printf("%d/%d: dread - %s%s zero size\n", procid, opno,
+			       f.path, st);
 		free_pathname(&f);
 		close(fd);
 		return;
@@ -1955,8 +1970,8 @@ dread_f(int opno, long r)
 	if (xfsctl(f.path, fd, XFS_IOC_DIOINFO, &diob) < 0) {
 		if (v)
 			printf(
-			"%d/%d: dread - xfsctl(XFS_IOC_DIOINFO) %s failed %d\n",
-				procid, opno, f.path, errno);
+			"%d/%d: dread - xfsctl(XFS_IOC_DIOINFO) %s%s failed %d\n",
+				procid, opno, f.path, st, errno);
 		free_pathname(&f);
 		close(fd);
 		return;
@@ -1976,8 +1991,8 @@ dread_f(int opno, long r)
 	e = read(fd, buf, len) < 0 ? errno : 0;
 	free(buf);
 	if (v)
-		printf("%d/%d: dread %s [%lld,%d] %d\n",
-			procid, opno, f.path, (long long)off, (int)len, e);
+		printf("%d/%d: dread %s%s [%lld,%d] %d\n",
+		       procid, opno, f.path, st, (long long)off, (int)len, e);
 	free_pathname(&f);
 	close(fd);
 }
@@ -1996,6 +2011,7 @@ dwrite_f(int opno, long r)
 	off64_t		off;
 	struct stat64	stb;
 	int		v;
+	char		st[1024];
 
 	init_pathname(&f);
 	if (!get_fname(FT_REGFILE, r, &f, NULL, NULL, &v)) {
@@ -2022,11 +2038,12 @@ dwrite_f(int opno, long r)
 		close(fd);
 		return;
 	}
+	inode_info(st, sizeof(st), &stb, v);
 	if (xfsctl(f.path, fd, XFS_IOC_DIOINFO, &diob) < 0) {
 		if (v)
 			printf("%d/%d: dwrite - xfsctl(XFS_IOC_DIOINFO)"
-				" %s failed %d\n",
-				procid, opno, f.path, errno);
+				" %s%s failed %d\n",
+			       procid, opno, f.path, st, errno);
 		free_pathname(&f);
 		close(fd);
 		return;
@@ -2049,8 +2066,8 @@ dwrite_f(int opno, long r)
 	e = write(fd, buf, len) < 0 ? errno : 0;
 	free(buf);
 	if (v)
-		printf("%d/%d: dwrite %s [%lld,%d] %d\n",
-			procid, opno, f.path, (long long)off, (int)len, e);
+		printf("%d/%d: dwrite %s%s [%lld,%d] %d\n",
+		       procid, opno, f.path, st, (long long)off, (int)len, e);
 	free_pathname(&f);
 	close(fd);
 }
@@ -2067,6 +2084,7 @@ fallocate_f(int opno, long r)
 	off64_t		len;
 	struct stat64	stb;
 	int		v;
+	char		st[1024];
 	int mode = 0;
 
 	init_pathname(&f);
@@ -2094,6 +2112,8 @@ fallocate_f(int opno, long r)
 		close(fd);
 		return;
 	}
+
+	inode_info(st, sizeof(st), &stb, v);
 	lr = ((__int64_t)random() << 32) + random();
 	off = (off64_t)(lr % MIN(stb.st_size + (1024 * 1024), MAXFSIZE));
 	off %= maxfsize;
@@ -2101,9 +2121,9 @@ fallocate_f(int opno, long r)
 	mode |= FALLOC_FL_KEEP_SIZE & random();
 	e = fallocate(fd, mode, (loff_t)off, (loff_t)len) < 0 ? errno : 0;
 	if (v)
-		printf("%d/%d: fallocate(%d) %s %lld %lld %d\n",
+		printf("%d/%d: fallocate(%d) %s %st %lld %lld %d\n",
 		       procid, opno, mode,
-		       f.path, (long long)off, (long long)len, e);
+		       f.path, st, (long long)off, (long long)len, e);
 	free_pathname(&f);
 	close(fd);
 #endif
@@ -2154,6 +2174,7 @@ freesp_f(int opno, long r)
 	off64_t		off;
 	struct stat64	stb;
 	int		v;
+	char		st[1024];
 
 	init_pathname(&f);
 	if (!get_fname(FT_REGFILE, r, &f, NULL, NULL, &v)) {
@@ -2180,6 +2201,7 @@ freesp_f(int opno, long r)
 		close(fd);
 		return;
 	}
+	inode_info(st, sizeof(st), &stb, v);
 	lr = ((__int64_t)random() << 32) + random();
 	off = (off64_t)(lr % MIN(stb.st_size + (1024 * 1024), MAXFSIZE));
 	off %= maxfsize;
@@ -2188,8 +2210,8 @@ freesp_f(int opno, long r)
 	fl.l_len = 0;
 	e = xfsctl(f.path, fd, XFS_IOC_FREESP64, &fl) < 0 ? errno : 0;
 	if (v)
-		printf("%d/%d: xfsctl(XFS_IOC_FREESP64) %s %lld 0 %d\n",
-			procid, opno, f.path, (long long)off, e);
+		printf("%d/%d: xfsctl(XFS_IOC_FREESP64) %s%s %lld 0 %d\n",
+		       procid, opno, f.path, st, (long long)off, e);
 	free_pathname(&f);
 	close(fd);
 }
@@ -2392,6 +2414,7 @@ punch_f(int opno, long r)
 	off64_t		len;
 	struct stat64	stb;
 	int		v;
+	char		st[1024];
 	int mode = FALLOC_FL_PUNCH_HOLE;
 
 	init_pathname(&f);
@@ -2419,6 +2442,7 @@ punch_f(int opno, long r)
 		close(fd);
 		return;
 	}
+	inode_info(st, sizeof(st), &stb, v);
 	lr = ((__int64_t)random() << 32) + random();
 	off = (off64_t)(lr % MIN(stb.st_size + (1024 * 1024), MAXFSIZE));
 	off %= maxfsize;
@@ -2426,9 +2450,9 @@ punch_f(int opno, long r)
 	mode |= FALLOC_FL_KEEP_SIZE & random();
 	e = fallocate(fd, mode, (loff_t)off, (loff_t)len) < 0 ? errno : 0;
 	if (v)
-		printf("%d/%d: punch hole(%d) %s %lld %lld %d\n",
+		printf("%d/%d: punch hole(%d) %s %s %lld %lld %d\n",
 		       procid, opno, mode,
-		       f.path, (long long)off, (long long)len, e);
+		       f.path, st, (long long)off, (long long)len, e);
 	free_pathname(&f);
 	close(fd);
 #endif
@@ -2446,6 +2470,7 @@ read_f(int opno, long r)
 	off64_t		off;
 	struct stat64	stb;
 	int		v;
+	char		st[1024];
 
 	init_pathname(&f);
 	if (!get_fname(FT_REGFILE, r, &f, NULL, NULL, &v)) {
@@ -2472,10 +2497,11 @@ read_f(int opno, long r)
 		close(fd);
 		return;
 	}
+	inode_info(st, sizeof(st), &stb, v);
 	if (stb.st_size == 0) {
 		if (v)
-			printf("%d/%d: read - %s zero size\n", procid, opno,
-				f.path);
+			printf("%d/%d: read - %s%s zero size\n", procid, opno,
+			       f.path, st);
 		free_pathname(&f);
 		close(fd);
 		return;
@@ -2488,8 +2514,8 @@ read_f(int opno, long r)
 	e = read(fd, buf, len) < 0 ? errno : 0;
 	free(buf);
 	if (v)
-		printf("%d/%d: read %s [%lld,%d] %d\n",
-			procid, opno, f.path, (long long)off, (int)len, e);
+		printf("%d/%d: read %s%s [%lld,%d] %d\n",
+		       procid, opno, f.path, st, (long long)off, (int)len, e);
 	free_pathname(&f);
 	close(fd);
 }
@@ -2596,6 +2622,7 @@ resvsp_f(int opno, long r)
 	off64_t		off;
 	struct stat64	stb;
 	int		v;
+	char		st[1024];
 
 	init_pathname(&f);
 	if (!get_fname(FT_REGFILE, r, &f, NULL, NULL, &v)) {
@@ -2622,6 +2649,7 @@ resvsp_f(int opno, long r)
 		close(fd);
 		return;
 	}
+	inode_info(st, sizeof(st), &stb, v);
 	lr = ((__int64_t)random() << 32) + random();
 	off = (off64_t)(lr % MIN(stb.st_size + (1024 * 1024), MAXFSIZE));
 	off %= maxfsize;
@@ -2630,8 +2658,8 @@ resvsp_f(int opno, long r)
 	fl.l_len = (off64_t)(random() % (1024 * 1024));
 	e = xfsctl(f.path, fd, XFS_IOC_RESVSP64, &fl) < 0 ? errno : 0;
 	if (v)
-		printf("%d/%d: xfsctl(XFS_IOC_RESVSP64) %s %lld %lld %d\n",
-			procid, opno, f.path,
+		printf("%d/%d: xfsctl(XFS_IOC_RESVSP64) %s%s %lld %lld %d\n",
+		       procid, opno, f.path, st,
 			(long long)off, (long long)fl.l_len, e);
 	free_pathname(&f);
 	close(fd);
@@ -2822,6 +2850,7 @@ unresvsp_f(int opno, long r)
 	off64_t		off;
 	struct stat64	stb;
 	int		v;
+	char		st[1024];
 
 	init_pathname(&f);
 	if (!get_fname(FT_REGFILE, r, &f, NULL, NULL, &v)) {
@@ -2848,6 +2877,7 @@ unresvsp_f(int opno, long r)
 		close(fd);
 		return;
 	}
+	inode_info(st, sizeof(st), &stb, v);
 	lr = ((__int64_t)random() << 32) + random();
 	off = (off64_t)(lr % MIN(stb.st_size + (1024 * 1024), MAXFSIZE));
 	off %= maxfsize;
@@ -2856,8 +2886,8 @@ unresvsp_f(int opno, long r)
 	fl.l_len = (off64_t)(random() % (1 << 20));
 	e = xfsctl(f.path, fd, XFS_IOC_UNRESVSP64, &fl) < 0 ? errno : 0;
 	if (v)
-		printf("%d/%d: xfsctl(XFS_IOC_UNRESVSP64) %s %lld %lld %d\n",
-			procid, opno, f.path,
+		printf("%d/%d: xfsctl(XFS_IOC_UNRESVSP64) %s%s %lld %lld %d\n",
+		       procid, opno, f.path, st,
 			(long long)off, (long long)fl.l_len, e);
 	free_pathname(&f);
 	close(fd);
@@ -2875,6 +2905,7 @@ write_f(int opno, long r)
 	off64_t		off;
 	struct stat64	stb;
 	int		v;
+	char		st[1024];
 
 	init_pathname(&f);
 	if (!get_fname(FT_REGm, r, &f, NULL, NULL, &v)) {
@@ -2901,6 +2932,7 @@ write_f(int opno, long r)
 		close(fd);
 		return;
 	}
+	inode_info(st, sizeof(st), &stb, v);
 	lr = ((__int64_t)random() << 32) + random();
 	off = (off64_t)(lr % MIN(stb.st_size + (1024 * 1024), MAXFSIZE));
 	off %= maxfsize;
@@ -2911,8 +2943,8 @@ write_f(int opno, long r)
 	e = write(fd, buf, len) < 0 ? errno : 0;
 	free(buf);
 	if (v)
-		printf("%d/%d: write %s [%lld,%d] %d\n",
-			procid, opno, f.path, (long long)off, (int)len, e);
+		printf("%d/%d: write %s%s [%lld,%d] %d\n",
+		       procid, opno, f.path, st, (long long)off, (int)len, e);
 	free_pathname(&f);
 	close(fd);
 }
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 5/8] xfstests: Dump inode info when possible
@ 2011-10-19 10:29   ` Dmitry Monakhov
  0 siblings, 0 replies; 32+ messages in thread
From: Dmitry Monakhov @ 2011-10-19 10:29 UTC (permalink / raw)
  To: linux-fsdevel, xfs, linux-ext4, jack, hch, aelder; +Cc: Dmitry Monakhov

Fsstress exec behaviour is not completely determinated in case of
low resources mode due to ENOMEM, ENOSPC, etc. In some places we
call stat(2). This information may be halpfull for future
investigations purposes. Let's dump stat info where possible.

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
 ltp/fsstress.c |   92 +++++++++++++++++++++++++++++++++++++------------------
 1 files changed, 62 insertions(+), 30 deletions(-)

diff --git a/ltp/fsstress.c b/ltp/fsstress.c
index 756bdd6..baccbbd 100644
--- a/ltp/fsstress.c
+++ b/ltp/fsstress.c
@@ -1482,6 +1482,14 @@ zero_freq(void)
 		p->freq = 0;
 }
 
+void inode_info(char *str, size_t sz, struct stat64 *s, int verbose)
+{
+	if (verbose)
+		snprintf(str, sz, "[%ld %ld %d %d %lld %lld]", (long)s->st_ino,
+			 (long)s->st_nlink,  s->st_uid, s->st_gid,
+			 (long long) s->st_blocks, (long long) s->st_size);
+}
+
 void
 allocsp_f(int opno, long r)
 {
@@ -1493,6 +1501,7 @@ allocsp_f(int opno, long r)
 	off64_t		off;
 	struct stat64	stb;
 	int		v;
+	char		st[1024];
 
 	init_pathname(&f);
 	if (!get_fname(FT_REGFILE, r, &f, NULL, NULL, &v)) {
@@ -1519,6 +1528,8 @@ allocsp_f(int opno, long r)
 		close(fd);
 		return;
 	}
+
+	inode_info(st, sizeof(st), &stb, v);
 	lr = ((__int64_t)random() << 32) + random();
 	off = (off64_t)(lr % MIN(stb.st_size + (1024 * 1024), MAXFSIZE));
 	off %= maxfsize;
@@ -1526,9 +1537,10 @@ allocsp_f(int opno, long r)
 	fl.l_start = off;
 	fl.l_len = 0;
 	e = xfsctl(f.path, fd, XFS_IOC_ALLOCSP64, &fl) < 0 ? errno : 0;
-	if (v)
-		printf("%d/%d: xfsctl(XFS_IOC_ALLOCSP64) %s %lld 0 %d\n",
-			procid, opno, f.path, (long long)off, e);
+	if (v) {
+		printf("%d/%d: xfsctl(XFS_IOC_ALLOCSP64) %s%s %lld 0 %d\n",
+		       procid, opno, f.path, st, (long long)off, e);
+	}
 	free_pathname(&f);
 	close(fd);
 }
@@ -1918,6 +1930,7 @@ dread_f(int opno, long r)
 	off64_t		off;
 	struct stat64	stb;
 	int		v;
+	char		st[1024];
 
 	init_pathname(&f);
 	if (!get_fname(FT_REGFILE, r, &f, NULL, NULL, &v)) {
@@ -1939,15 +1952,17 @@ dread_f(int opno, long r)
 	if (fstat64(fd, &stb) < 0) {
 		if (v)
 			printf("%d/%d: dread - fstat64 %s failed %d\n",
-				procid, opno, f.path, errno);
+			       procid, opno, f.path, errno);
 		free_pathname(&f);
 		close(fd);
 		return;
 	}
+
+	inode_info(st, sizeof(st), &stb, v);
 	if (stb.st_size == 0) {
 		if (v)
-			printf("%d/%d: dread - %s zero size\n", procid, opno,
-				f.path);
+			printf("%d/%d: dread - %s%s zero size\n", procid, opno,
+			       f.path, st);
 		free_pathname(&f);
 		close(fd);
 		return;
@@ -1955,8 +1970,8 @@ dread_f(int opno, long r)
 	if (xfsctl(f.path, fd, XFS_IOC_DIOINFO, &diob) < 0) {
 		if (v)
 			printf(
-			"%d/%d: dread - xfsctl(XFS_IOC_DIOINFO) %s failed %d\n",
-				procid, opno, f.path, errno);
+			"%d/%d: dread - xfsctl(XFS_IOC_DIOINFO) %s%s failed %d\n",
+				procid, opno, f.path, st, errno);
 		free_pathname(&f);
 		close(fd);
 		return;
@@ -1976,8 +1991,8 @@ dread_f(int opno, long r)
 	e = read(fd, buf, len) < 0 ? errno : 0;
 	free(buf);
 	if (v)
-		printf("%d/%d: dread %s [%lld,%d] %d\n",
-			procid, opno, f.path, (long long)off, (int)len, e);
+		printf("%d/%d: dread %s%s [%lld,%d] %d\n",
+		       procid, opno, f.path, st, (long long)off, (int)len, e);
 	free_pathname(&f);
 	close(fd);
 }
@@ -1996,6 +2011,7 @@ dwrite_f(int opno, long r)
 	off64_t		off;
 	struct stat64	stb;
 	int		v;
+	char		st[1024];
 
 	init_pathname(&f);
 	if (!get_fname(FT_REGFILE, r, &f, NULL, NULL, &v)) {
@@ -2022,11 +2038,12 @@ dwrite_f(int opno, long r)
 		close(fd);
 		return;
 	}
+	inode_info(st, sizeof(st), &stb, v);
 	if (xfsctl(f.path, fd, XFS_IOC_DIOINFO, &diob) < 0) {
 		if (v)
 			printf("%d/%d: dwrite - xfsctl(XFS_IOC_DIOINFO)"
-				" %s failed %d\n",
-				procid, opno, f.path, errno);
+				" %s%s failed %d\n",
+			       procid, opno, f.path, st, errno);
 		free_pathname(&f);
 		close(fd);
 		return;
@@ -2049,8 +2066,8 @@ dwrite_f(int opno, long r)
 	e = write(fd, buf, len) < 0 ? errno : 0;
 	free(buf);
 	if (v)
-		printf("%d/%d: dwrite %s [%lld,%d] %d\n",
-			procid, opno, f.path, (long long)off, (int)len, e);
+		printf("%d/%d: dwrite %s%s [%lld,%d] %d\n",
+		       procid, opno, f.path, st, (long long)off, (int)len, e);
 	free_pathname(&f);
 	close(fd);
 }
@@ -2067,6 +2084,7 @@ fallocate_f(int opno, long r)
 	off64_t		len;
 	struct stat64	stb;
 	int		v;
+	char		st[1024];
 	int mode = 0;
 
 	init_pathname(&f);
@@ -2094,6 +2112,8 @@ fallocate_f(int opno, long r)
 		close(fd);
 		return;
 	}
+
+	inode_info(st, sizeof(st), &stb, v);
 	lr = ((__int64_t)random() << 32) + random();
 	off = (off64_t)(lr % MIN(stb.st_size + (1024 * 1024), MAXFSIZE));
 	off %= maxfsize;
@@ -2101,9 +2121,9 @@ fallocate_f(int opno, long r)
 	mode |= FALLOC_FL_KEEP_SIZE & random();
 	e = fallocate(fd, mode, (loff_t)off, (loff_t)len) < 0 ? errno : 0;
 	if (v)
-		printf("%d/%d: fallocate(%d) %s %lld %lld %d\n",
+		printf("%d/%d: fallocate(%d) %s %st %lld %lld %d\n",
 		       procid, opno, mode,
-		       f.path, (long long)off, (long long)len, e);
+		       f.path, st, (long long)off, (long long)len, e);
 	free_pathname(&f);
 	close(fd);
 #endif
@@ -2154,6 +2174,7 @@ freesp_f(int opno, long r)
 	off64_t		off;
 	struct stat64	stb;
 	int		v;
+	char		st[1024];
 
 	init_pathname(&f);
 	if (!get_fname(FT_REGFILE, r, &f, NULL, NULL, &v)) {
@@ -2180,6 +2201,7 @@ freesp_f(int opno, long r)
 		close(fd);
 		return;
 	}
+	inode_info(st, sizeof(st), &stb, v);
 	lr = ((__int64_t)random() << 32) + random();
 	off = (off64_t)(lr % MIN(stb.st_size + (1024 * 1024), MAXFSIZE));
 	off %= maxfsize;
@@ -2188,8 +2210,8 @@ freesp_f(int opno, long r)
 	fl.l_len = 0;
 	e = xfsctl(f.path, fd, XFS_IOC_FREESP64, &fl) < 0 ? errno : 0;
 	if (v)
-		printf("%d/%d: xfsctl(XFS_IOC_FREESP64) %s %lld 0 %d\n",
-			procid, opno, f.path, (long long)off, e);
+		printf("%d/%d: xfsctl(XFS_IOC_FREESP64) %s%s %lld 0 %d\n",
+		       procid, opno, f.path, st, (long long)off, e);
 	free_pathname(&f);
 	close(fd);
 }
@@ -2392,6 +2414,7 @@ punch_f(int opno, long r)
 	off64_t		len;
 	struct stat64	stb;
 	int		v;
+	char		st[1024];
 	int mode = FALLOC_FL_PUNCH_HOLE;
 
 	init_pathname(&f);
@@ -2419,6 +2442,7 @@ punch_f(int opno, long r)
 		close(fd);
 		return;
 	}
+	inode_info(st, sizeof(st), &stb, v);
 	lr = ((__int64_t)random() << 32) + random();
 	off = (off64_t)(lr % MIN(stb.st_size + (1024 * 1024), MAXFSIZE));
 	off %= maxfsize;
@@ -2426,9 +2450,9 @@ punch_f(int opno, long r)
 	mode |= FALLOC_FL_KEEP_SIZE & random();
 	e = fallocate(fd, mode, (loff_t)off, (loff_t)len) < 0 ? errno : 0;
 	if (v)
-		printf("%d/%d: punch hole(%d) %s %lld %lld %d\n",
+		printf("%d/%d: punch hole(%d) %s %s %lld %lld %d\n",
 		       procid, opno, mode,
-		       f.path, (long long)off, (long long)len, e);
+		       f.path, st, (long long)off, (long long)len, e);
 	free_pathname(&f);
 	close(fd);
 #endif
@@ -2446,6 +2470,7 @@ read_f(int opno, long r)
 	off64_t		off;
 	struct stat64	stb;
 	int		v;
+	char		st[1024];
 
 	init_pathname(&f);
 	if (!get_fname(FT_REGFILE, r, &f, NULL, NULL, &v)) {
@@ -2472,10 +2497,11 @@ read_f(int opno, long r)
 		close(fd);
 		return;
 	}
+	inode_info(st, sizeof(st), &stb, v);
 	if (stb.st_size == 0) {
 		if (v)
-			printf("%d/%d: read - %s zero size\n", procid, opno,
-				f.path);
+			printf("%d/%d: read - %s%s zero size\n", procid, opno,
+			       f.path, st);
 		free_pathname(&f);
 		close(fd);
 		return;
@@ -2488,8 +2514,8 @@ read_f(int opno, long r)
 	e = read(fd, buf, len) < 0 ? errno : 0;
 	free(buf);
 	if (v)
-		printf("%d/%d: read %s [%lld,%d] %d\n",
-			procid, opno, f.path, (long long)off, (int)len, e);
+		printf("%d/%d: read %s%s [%lld,%d] %d\n",
+		       procid, opno, f.path, st, (long long)off, (int)len, e);
 	free_pathname(&f);
 	close(fd);
 }
@@ -2596,6 +2622,7 @@ resvsp_f(int opno, long r)
 	off64_t		off;
 	struct stat64	stb;
 	int		v;
+	char		st[1024];
 
 	init_pathname(&f);
 	if (!get_fname(FT_REGFILE, r, &f, NULL, NULL, &v)) {
@@ -2622,6 +2649,7 @@ resvsp_f(int opno, long r)
 		close(fd);
 		return;
 	}
+	inode_info(st, sizeof(st), &stb, v);
 	lr = ((__int64_t)random() << 32) + random();
 	off = (off64_t)(lr % MIN(stb.st_size + (1024 * 1024), MAXFSIZE));
 	off %= maxfsize;
@@ -2630,8 +2658,8 @@ resvsp_f(int opno, long r)
 	fl.l_len = (off64_t)(random() % (1024 * 1024));
 	e = xfsctl(f.path, fd, XFS_IOC_RESVSP64, &fl) < 0 ? errno : 0;
 	if (v)
-		printf("%d/%d: xfsctl(XFS_IOC_RESVSP64) %s %lld %lld %d\n",
-			procid, opno, f.path,
+		printf("%d/%d: xfsctl(XFS_IOC_RESVSP64) %s%s %lld %lld %d\n",
+		       procid, opno, f.path, st,
 			(long long)off, (long long)fl.l_len, e);
 	free_pathname(&f);
 	close(fd);
@@ -2822,6 +2850,7 @@ unresvsp_f(int opno, long r)
 	off64_t		off;
 	struct stat64	stb;
 	int		v;
+	char		st[1024];
 
 	init_pathname(&f);
 	if (!get_fname(FT_REGFILE, r, &f, NULL, NULL, &v)) {
@@ -2848,6 +2877,7 @@ unresvsp_f(int opno, long r)
 		close(fd);
 		return;
 	}
+	inode_info(st, sizeof(st), &stb, v);
 	lr = ((__int64_t)random() << 32) + random();
 	off = (off64_t)(lr % MIN(stb.st_size + (1024 * 1024), MAXFSIZE));
 	off %= maxfsize;
@@ -2856,8 +2886,8 @@ unresvsp_f(int opno, long r)
 	fl.l_len = (off64_t)(random() % (1 << 20));
 	e = xfsctl(f.path, fd, XFS_IOC_UNRESVSP64, &fl) < 0 ? errno : 0;
 	if (v)
-		printf("%d/%d: xfsctl(XFS_IOC_UNRESVSP64) %s %lld %lld %d\n",
-			procid, opno, f.path,
+		printf("%d/%d: xfsctl(XFS_IOC_UNRESVSP64) %s%s %lld %lld %d\n",
+		       procid, opno, f.path, st,
 			(long long)off, (long long)fl.l_len, e);
 	free_pathname(&f);
 	close(fd);
@@ -2875,6 +2905,7 @@ write_f(int opno, long r)
 	off64_t		off;
 	struct stat64	stb;
 	int		v;
+	char		st[1024];
 
 	init_pathname(&f);
 	if (!get_fname(FT_REGm, r, &f, NULL, NULL, &v)) {
@@ -2901,6 +2932,7 @@ write_f(int opno, long r)
 		close(fd);
 		return;
 	}
+	inode_info(st, sizeof(st), &stb, v);
 	lr = ((__int64_t)random() << 32) + random();
 	off = (off64_t)(lr % MIN(stb.st_size + (1024 * 1024), MAXFSIZE));
 	off %= maxfsize;
@@ -2911,8 +2943,8 @@ write_f(int opno, long r)
 	e = write(fd, buf, len) < 0 ? errno : 0;
 	free(buf);
 	if (v)
-		printf("%d/%d: write %s [%lld,%d] %d\n",
-			procid, opno, f.path, (long long)off, (int)len, e);
+		printf("%d/%d: write %s%s [%lld,%d] %d\n",
+		       procid, opno, f.path, st, (long long)off, (int)len, e);
 	free_pathname(&f);
 	close(fd);
 }
-- 
1.7.1

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 6/8] xfstests: add fiemap operation
  2011-10-19 10:29 ` Dmitry Monakhov
@ 2011-10-19 10:29   ` Dmitry Monakhov
  -1 siblings, 0 replies; 32+ messages in thread
From: Dmitry Monakhov @ 2011-10-19 10:29 UTC (permalink / raw)
  To: linux-fsdevel, xfs, linux-ext4, jack, hch, aelder; +Cc: Dmitry Monakhov

Related bug: http://patchwork.ozlabs.org/patch/118863

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
 ltp/fsstress.c |   76 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 76 insertions(+), 0 deletions(-)

diff --git a/ltp/fsstress.c b/ltp/fsstress.c
index baccbbd..19b5858 100644
--- a/ltp/fsstress.c
+++ b/ltp/fsstress.c
@@ -24,6 +24,9 @@
 #ifdef HAVE_ATTR_ATTRIBUTES_H
 #include <attr/attributes.h>
 #endif
+#ifdef HAVE_LINUX_FIEMAP_H
+#include <linux/fiemap.h>
+#endif
 #ifdef FALLOCATE
 #include <linux/falloc.h>
 #ifndef FALLOC_FL_PUNCH_HOLE
@@ -65,6 +68,7 @@ typedef enum {
 	OP_DWRITE,
 	OP_FALLOCATE,
 	OP_FDATASYNC,
+	OP_FIEMAP,
 	OP_FREESP,
 	OP_FSYNC,
 	OP_GETATTR,
@@ -149,6 +153,7 @@ void	dread_f(int, long);
 void	dwrite_f(int, long);
 void	fallocate_f(int, long);
 void	fdatasync_f(int, long);
+void	fiemap_f(int, long);
 void	freesp_f(int, long);
 void	fsync_f(int, long);
 void	getdents_f(int, long);
@@ -184,6 +189,7 @@ opdesc_t	ops[] = {
 	{ OP_DWRITE, "dwrite", dwrite_f, 4, 1 },
 	{ OP_FALLOCATE, "fallocate", fallocate_f, 1, 1 },
 	{ OP_FDATASYNC, "fdatasync", fdatasync_f, 1, 1 },
+	{ OP_FIEMAP, "fiemap", fiemap_f, 1, 1 },
 	{ OP_FREESP, "freesp", freesp_f, 1, 1 },
 	{ OP_FSYNC, "fsync", fsync_f, 1, 1 },
 	{ OP_GETATTR, "getattr", getattr_f, 1, 0 },
@@ -2162,6 +2168,76 @@ fdatasync_f(int opno, long r)
 	free_pathname(&f);
 	close(fd);
 }
+void
+fiemap_f(int opno, long r)
+{
+#ifdef HAVE_LINUX_FIEMAP_H
+	int		e;
+	pathname_t	f;
+	int		fd;
+	__int64_t	lr;
+	off64_t		off;
+	struct stat64	stb;
+	int		v;
+	char		st[1024];
+	int blocks_to_map;
+	struct fiemap *fiemap;
+
+	init_pathname(&f);
+	if (!get_fname(FT_REGFILE, r, &f, NULL, NULL, &v)) {
+		if (v)
+			printf("%d/%d: fiemap - no filename\n", procid, opno);
+		free_pathname(&f);
+		return;
+	}
+	fd = open_path(&f, O_RDWR);
+	e = fd < 0 ? errno : 0;
+	check_cwd();
+	if (fd < 0) {
+		if (v)
+			printf("%d/%d: fiemap - open %s failed %d\n",
+				procid, opno, f.path, e);
+		free_pathname(&f);
+		return;
+	}
+	if (fstat64(fd, &stb) < 0) {
+		if (v)
+			printf("%d/%d: fiemap - fstat64 %s failed %d\n",
+				procid, opno, f.path, errno);
+		free_pathname(&f);
+		close(fd);
+		return;
+	}
+	inode_info(st, sizeof(st), &stb, v);
+	blocks_to_map = random() & 0xffff;
+	fiemap = (struct fiemap *)malloc(sizeof(struct fiemap) +
+			(blocks_to_map * sizeof(struct fiemap_extent)));
+	if (!fiemap) {
+		if (v)
+			printf("%d/%d: malloc failed \n", procid, opno);
+		free_pathname(&f);
+		close(fd);
+		return;
+	}
+	lr = ((__int64_t)random() << 32) + random();
+	off = (off64_t)(lr % MIN(stb.st_size + (1024 * 1024), MAXFSIZE));
+	off %= maxfsize;
+	fiemap->fm_flags = random() & (FIEMAP_FLAGS_COMPAT | 0x10000);
+	fiemap->fm_extent_count = blocks_to_map;
+	fiemap->fm_mapped_extents = random() & 0xffff;
+	fiemap->fm_start = off;
+	fiemap->fm_length = ((__int64_t)random() << 32) + random();
+
+	e = ioctl(fd, FS_IOC_FIEMAP, (unsigned long)fiemap);
+	if (v)
+		printf("%d/%d: ioctl(FIEMAP) %s%s %lld %lld %x %d\n",
+		       procid, opno, f.path, st, (long long)fiemap->fm_start,
+		       (long long) fiemap->fm_length, fiemap->fm_flags, e);
+	free(fiemap);
+	free_pathname(&f);
+	close(fd);
+#endif
+}
 
 void
 freesp_f(int opno, long r)
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 6/8] xfstests: add fiemap operation
@ 2011-10-19 10:29   ` Dmitry Monakhov
  0 siblings, 0 replies; 32+ messages in thread
From: Dmitry Monakhov @ 2011-10-19 10:29 UTC (permalink / raw)
  To: linux-fsdevel, xfs, linux-ext4, jack, hch, aelder; +Cc: Dmitry Monakhov

Related bug: http://patchwork.ozlabs.org/patch/118863

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
 ltp/fsstress.c |   76 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 76 insertions(+), 0 deletions(-)

diff --git a/ltp/fsstress.c b/ltp/fsstress.c
index baccbbd..19b5858 100644
--- a/ltp/fsstress.c
+++ b/ltp/fsstress.c
@@ -24,6 +24,9 @@
 #ifdef HAVE_ATTR_ATTRIBUTES_H
 #include <attr/attributes.h>
 #endif
+#ifdef HAVE_LINUX_FIEMAP_H
+#include <linux/fiemap.h>
+#endif
 #ifdef FALLOCATE
 #include <linux/falloc.h>
 #ifndef FALLOC_FL_PUNCH_HOLE
@@ -65,6 +68,7 @@ typedef enum {
 	OP_DWRITE,
 	OP_FALLOCATE,
 	OP_FDATASYNC,
+	OP_FIEMAP,
 	OP_FREESP,
 	OP_FSYNC,
 	OP_GETATTR,
@@ -149,6 +153,7 @@ void	dread_f(int, long);
 void	dwrite_f(int, long);
 void	fallocate_f(int, long);
 void	fdatasync_f(int, long);
+void	fiemap_f(int, long);
 void	freesp_f(int, long);
 void	fsync_f(int, long);
 void	getdents_f(int, long);
@@ -184,6 +189,7 @@ opdesc_t	ops[] = {
 	{ OP_DWRITE, "dwrite", dwrite_f, 4, 1 },
 	{ OP_FALLOCATE, "fallocate", fallocate_f, 1, 1 },
 	{ OP_FDATASYNC, "fdatasync", fdatasync_f, 1, 1 },
+	{ OP_FIEMAP, "fiemap", fiemap_f, 1, 1 },
 	{ OP_FREESP, "freesp", freesp_f, 1, 1 },
 	{ OP_FSYNC, "fsync", fsync_f, 1, 1 },
 	{ OP_GETATTR, "getattr", getattr_f, 1, 0 },
@@ -2162,6 +2168,76 @@ fdatasync_f(int opno, long r)
 	free_pathname(&f);
 	close(fd);
 }
+void
+fiemap_f(int opno, long r)
+{
+#ifdef HAVE_LINUX_FIEMAP_H
+	int		e;
+	pathname_t	f;
+	int		fd;
+	__int64_t	lr;
+	off64_t		off;
+	struct stat64	stb;
+	int		v;
+	char		st[1024];
+	int blocks_to_map;
+	struct fiemap *fiemap;
+
+	init_pathname(&f);
+	if (!get_fname(FT_REGFILE, r, &f, NULL, NULL, &v)) {
+		if (v)
+			printf("%d/%d: fiemap - no filename\n", procid, opno);
+		free_pathname(&f);
+		return;
+	}
+	fd = open_path(&f, O_RDWR);
+	e = fd < 0 ? errno : 0;
+	check_cwd();
+	if (fd < 0) {
+		if (v)
+			printf("%d/%d: fiemap - open %s failed %d\n",
+				procid, opno, f.path, e);
+		free_pathname(&f);
+		return;
+	}
+	if (fstat64(fd, &stb) < 0) {
+		if (v)
+			printf("%d/%d: fiemap - fstat64 %s failed %d\n",
+				procid, opno, f.path, errno);
+		free_pathname(&f);
+		close(fd);
+		return;
+	}
+	inode_info(st, sizeof(st), &stb, v);
+	blocks_to_map = random() & 0xffff;
+	fiemap = (struct fiemap *)malloc(sizeof(struct fiemap) +
+			(blocks_to_map * sizeof(struct fiemap_extent)));
+	if (!fiemap) {
+		if (v)
+			printf("%d/%d: malloc failed \n", procid, opno);
+		free_pathname(&f);
+		close(fd);
+		return;
+	}
+	lr = ((__int64_t)random() << 32) + random();
+	off = (off64_t)(lr % MIN(stb.st_size + (1024 * 1024), MAXFSIZE));
+	off %= maxfsize;
+	fiemap->fm_flags = random() & (FIEMAP_FLAGS_COMPAT | 0x10000);
+	fiemap->fm_extent_count = blocks_to_map;
+	fiemap->fm_mapped_extents = random() & 0xffff;
+	fiemap->fm_start = off;
+	fiemap->fm_length = ((__int64_t)random() << 32) + random();
+
+	e = ioctl(fd, FS_IOC_FIEMAP, (unsigned long)fiemap);
+	if (v)
+		printf("%d/%d: ioctl(FIEMAP) %s%s %lld %lld %x %d\n",
+		       procid, opno, f.path, st, (long long)fiemap->fm_start,
+		       (long long) fiemap->fm_length, fiemap->fm_flags, e);
+	free(fiemap);
+	free_pathname(&f);
+	close(fd);
+#endif
+}
 
 void
 freesp_f(int opno, long r)
-- 
1.7.1

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 7/8] xfstests: add new stress test
  2011-10-19 10:29 ` Dmitry Monakhov
@ 2011-10-19 10:29   ` Dmitry Monakhov
  -1 siblings, 0 replies; 32+ messages in thread
From: Dmitry Monakhov @ 2011-10-19 10:29 UTC (permalink / raw)
  To: linux-fsdevel, xfs, linux-ext4, jack, hch, aelder; +Cc: Dmitry Monakhov

During stress testing we want to cover as much code paths as possible
fsstress is very good for this purpose. But it has expandable nature
(disk usage almost continually grow). So once it goes in no ENOSPC
condition it will be where till the end. But by running 'dd' writers
in parallel we can regularly trigger ENOSPC but only for a limited
periods of time because each time it opens file with O_TRUNC.

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
 264     |   86 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 264.out |    5 +++
 group   |    1 +
 3 files changed, 92 insertions(+), 0 deletions(-)
 create mode 100755 264
 create mode 100644 264.out

diff --git a/264 b/264
new file mode 100755
index 0000000..fc6df23
--- /dev/null
+++ b/264
@@ -0,0 +1,86 @@
+#! /bin/bash
+# FSQA Test No. 264
+#
+# Run fsstress and ENSPC hitters in parallel, check fs consistency an the end
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2006 Silicon Graphics, Inc.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+#-----------------------------------------------------------------------
+#
+# creator
+owner=dmonakhov@openvz.org
+
+seq=`basename $0`
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1	# failure is the default!
+trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
+
+# get standard environment, filters and checks
+. ./common.rc
+. ./common.filter
+# Disable all sync operations to get higher load
+FSSTRESS_AVOID="$FSSTRESS_AVOID -ffsync=0 -fsync=0 -ffdatasync=0"
+_workout()
+{
+	echo ""
+	echo "Run fsstress"
+	echo ""
+	num_iterations=10
+	enospc_time=2
+	out=$SCRATCH_MNT/fsstress.$$
+	args="-p128 -n999999999 -f setattr=1 $FSSTRESS_AVOID -d $out"
+	echo "fsstress $args" >> $here/$seq.full
+	$FSSTRESS_PROG $args > /dev/null 2>&1 &
+	pid=$!
+	echo "Run dd writers in parallel"
+	for ((i=0; i < num_iterations; i++))
+	do
+		# File will be opened with O_TRUNC each time
+		dd if=/dev/zero of=$SCRATCH_MNT/SPACE_CONSUMER bs=1M count=1 \
+			> /dev/null 2>&1
+		sleep $enospc_time
+	done
+	kill $pid
+	wait $pid
+}
+
+# real QA test starts here
+_supported_fs generic
+_supported_os Linux
+_require_scratch
+_need_to_be_root
+
+umount $SCRATCH_DEV 2>/dev/null
+_scratch_mkfs_sized $((512 * 1024 * 1024)) >> $seq.full 2>&1
+_scratch_mount
+
+if ! _workout; then
+	umount $SCRATCH_DEV 2>/dev/null
+	exit
+fi
+
+if ! _scratch_unmount; then
+	echo "failed to umount"
+	status=1
+	exit
+fi
+_check_scratch_fs
+status=$?
+exit
diff --git a/264.out b/264.out
new file mode 100644
index 0000000..81b50e5
--- /dev/null
+++ b/264.out
@@ -0,0 +1,5 @@
+QA output created by 264
+
+Run fsstress
+
+Run dd writers in parallel
diff --git a/group b/group
index 2a8970c..e79c29b 100644
--- a/group
+++ b/group
@@ -377,3 +377,4 @@ deprecated
 261 auto quick quota
 262 auto quick quota
 263 rw auto quick
+264 auto rw prealloc ioctl enospc
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 7/8] xfstests: add new stress test
@ 2011-10-19 10:29   ` Dmitry Monakhov
  0 siblings, 0 replies; 32+ messages in thread
From: Dmitry Monakhov @ 2011-10-19 10:29 UTC (permalink / raw)
  To: linux-fsdevel, xfs, linux-ext4, jack, hch, aelder; +Cc: Dmitry Monakhov

During stress testing we want to cover as much code paths as possible
fsstress is very good for this purpose. But it has expandable nature
(disk usage almost continually grow). So once it goes in no ENOSPC
condition it will be where till the end. But by running 'dd' writers
in parallel we can regularly trigger ENOSPC but only for a limited
periods of time because each time it opens file with O_TRUNC.

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
 264     |   86 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 264.out |    5 +++
 group   |    1 +
 3 files changed, 92 insertions(+), 0 deletions(-)
 create mode 100755 264
 create mode 100644 264.out

diff --git a/264 b/264
new file mode 100755
index 0000000..fc6df23
--- /dev/null
+++ b/264
@@ -0,0 +1,86 @@
+#! /bin/bash
+# FSQA Test No. 264
+#
+# Run fsstress and ENSPC hitters in parallel, check fs consistency an the end
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2006 Silicon Graphics, Inc.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+#-----------------------------------------------------------------------
+#
+# creator
+owner=dmonakhov@openvz.org
+
+seq=`basename $0`
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1	# failure is the default!
+trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
+
+# get standard environment, filters and checks
+. ./common.rc
+. ./common.filter
+# Disable all sync operations to get higher load
+FSSTRESS_AVOID="$FSSTRESS_AVOID -ffsync=0 -fsync=0 -ffdatasync=0"
+_workout()
+{
+	echo ""
+	echo "Run fsstress"
+	echo ""
+	num_iterations=10
+	enospc_time=2
+	out=$SCRATCH_MNT/fsstress.$$
+	args="-p128 -n999999999 -f setattr=1 $FSSTRESS_AVOID -d $out"
+	echo "fsstress $args" >> $here/$seq.full
+	$FSSTRESS_PROG $args > /dev/null 2>&1 &
+	pid=$!
+	echo "Run dd writers in parallel"
+	for ((i=0; i < num_iterations; i++))
+	do
+		# File will be opened with O_TRUNC each time
+		dd if=/dev/zero of=$SCRATCH_MNT/SPACE_CONSUMER bs=1M count=1 \
+			> /dev/null 2>&1
+		sleep $enospc_time
+	done
+	kill $pid
+	wait $pid
+}
+
+# real QA test starts here
+_supported_fs generic
+_supported_os Linux
+_require_scratch
+_need_to_be_root
+
+umount $SCRATCH_DEV 2>/dev/null
+_scratch_mkfs_sized $((512 * 1024 * 1024)) >> $seq.full 2>&1
+_scratch_mount
+
+if ! _workout; then
+	umount $SCRATCH_DEV 2>/dev/null
+	exit
+fi
+
+if ! _scratch_unmount; then
+	echo "failed to umount"
+	status=1
+	exit
+fi
+_check_scratch_fs
+status=$?
+exit
diff --git a/264.out b/264.out
new file mode 100644
index 0000000..81b50e5
--- /dev/null
+++ b/264.out
@@ -0,0 +1,5 @@
+QA output created by 264
+
+Run fsstress
+
+Run dd writers in parallel
diff --git a/group b/group
index 2a8970c..e79c29b 100644
--- a/group
+++ b/group
@@ -377,3 +377,4 @@ deprecated
 261 auto quick quota
 262 auto quick quota
 263 rw auto quick
+264 auto rw prealloc ioctl enospc
-- 
1.7.1

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 8/8] xfstests: add new quota stress test
  2011-10-19 10:29 ` Dmitry Monakhov
@ 2011-10-19 10:29   ` Dmitry Monakhov
  -1 siblings, 0 replies; 32+ messages in thread
From: Dmitry Monakhov @ 2011-10-19 10:29 UTC (permalink / raw)
  To: linux-fsdevel, xfs, linux-ext4, jack, hch, aelder; +Cc: Dmitry Monakhov

- Same as 264 but with quota enabled.
- IO performed from fsgqa user
- fsstress granted with CAP_CHOWN capability.

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
 265     |  107 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 265.out |    8 +++++
 group   |    1 +
 3 files changed, 116 insertions(+), 0 deletions(-)
 create mode 100755 265
 create mode 100644 265.out

diff --git a/265 b/265
new file mode 100755
index 0000000..c2a5379
--- /dev/null
+++ b/265
@@ -0,0 +1,107 @@
+#! /bin/bash
+# FSQA Test No. 264
+#
+# Run fsstress and ENSPC hitters in parallel, check fs consistency an the end
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2006 Silicon Graphics, Inc.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+#-----------------------------------------------------------------------
+#
+# creator
+owner=dmonakhov@openvz.org
+
+seq=`basename $0`
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1	# failure is the default!
+trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
+
+# get standard environment, filters and checks
+. ./common.rc
+. ./common.filter
+. ./common.quota
+
+# Disable all sync operations to get higher load
+FSSTRESS_AVOID="$FSSTRESS_AVOID -ffsync=0 -fsync=0 -ffdatasync=0"
+UID_MODULO=10
+_workout()
+{
+	echo ""
+	echo "Run fsstress"
+	echo ""
+	num_iterations=10
+	enospc_time=2
+	out=$SCRATCH_MNT/fsstress.$$
+	args="-p128 -n999999999 -f setattr=1 $FSSTRESS_AVOID -d $out"
+	echo "fsstress $args" >> $here/$seq.full
+	# Grant chown capability 
+	cp $FSSTRESS_PROG  $tmp.fsstress.bin
+	setcap cap_chown=epi  $tmp.fsstress.bin
+	sudo -u fsgqa CMD="$tmp.fsstress.bin $args" \
+		sh -c 'exec $CMD > /dev/null 2>&1' & \
+		eval 'pid=$!'
+
+	echo "Run dd writers in parallel"
+	for ((i=0; i < num_iterations; i++))
+	do
+		# File will be opened with O_TRUNC each time
+		sudo -u fsgqa \
+			CMD="dd if=/dev/zero of=$SCRATCH_MNT/SPACE_CONSUMER bs=1M " \
+			sh -c 'exec $CMD > /dev/null 2>&1'
+		sleep $enospc_time
+	done
+	kill $pid
+	wait $pid
+}
+
+# real QA test starts here
+_supported_fs generic
+_supported_os Linux
+_require_scratch
+_require_quota
+_require_user
+_need_to_be_root
+
+umount $SCRATCH_DEV 2>/dev/null
+_scratch_mkfs_sized $((512 * 1024 * 1024)) >> $seq.full 2>&1
+_scratch_mount "-o usrquota,grpquota"
+chmod 777 $SCRATCH_MNT
+quotacheck -u -g $SCRATCH_MNT 2>/dev/null
+quotaon -u -g $SCRATCH_MNT 2>/dev/null
+
+if ! _workout; then
+	_scratch_unmount 2>/dev/null
+	exit
+fi
+
+if ! _check_quota_usage; then
+	_scratch_unmount 2>/dev/null
+	status=1
+	exit
+fi
+
+echo Comparing filesystem consistency
+if ! _scratch_unmount; then
+	echo "failed to umount"
+	status=1
+	exit
+fi
+_check_scratch_fs
+status=$?
+exit
diff --git a/265.out b/265.out
new file mode 100644
index 0000000..7637291
--- /dev/null
+++ b/265.out
@@ -0,0 +1,8 @@
+QA output created by 265
+
+Run fsstress
+
+Run dd writers in parallel
+Comparing user usage
+Comparing group usage
+Comparing filesystem consistency
diff --git a/group b/group
index e79c29b..487051a 100644
--- a/group
+++ b/group
@@ -378,3 +378,4 @@ deprecated
 262 auto quick quota
 263 rw auto quick
 264 auto rw prealloc ioctl enospc
+265 auto quota rw prealloc ioctl enospc
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 8/8] xfstests: add new quota stress test
@ 2011-10-19 10:29   ` Dmitry Monakhov
  0 siblings, 0 replies; 32+ messages in thread
From: Dmitry Monakhov @ 2011-10-19 10:29 UTC (permalink / raw)
  To: linux-fsdevel, xfs, linux-ext4, jack, hch, aelder; +Cc: Dmitry Monakhov

- Same as 264 but with quota enabled.
- IO performed from fsgqa user
- fsstress granted with CAP_CHOWN capability.

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
 265     |  107 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 265.out |    8 +++++
 group   |    1 +
 3 files changed, 116 insertions(+), 0 deletions(-)
 create mode 100755 265
 create mode 100644 265.out

diff --git a/265 b/265
new file mode 100755
index 0000000..c2a5379
--- /dev/null
+++ b/265
@@ -0,0 +1,107 @@
+#! /bin/bash
+# FSQA Test No. 264
+#
+# Run fsstress and ENSPC hitters in parallel, check fs consistency an the end
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2006 Silicon Graphics, Inc.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+#-----------------------------------------------------------------------
+#
+# creator
+owner=dmonakhov@openvz.org
+
+seq=`basename $0`
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1	# failure is the default!
+trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
+
+# get standard environment, filters and checks
+. ./common.rc
+. ./common.filter
+. ./common.quota
+
+# Disable all sync operations to get higher load
+FSSTRESS_AVOID="$FSSTRESS_AVOID -ffsync=0 -fsync=0 -ffdatasync=0"
+UID_MODULO=10
+_workout()
+{
+	echo ""
+	echo "Run fsstress"
+	echo ""
+	num_iterations=10
+	enospc_time=2
+	out=$SCRATCH_MNT/fsstress.$$
+	args="-p128 -n999999999 -f setattr=1 $FSSTRESS_AVOID -d $out"
+	echo "fsstress $args" >> $here/$seq.full
+	# Grant chown capability 
+	cp $FSSTRESS_PROG  $tmp.fsstress.bin
+	setcap cap_chown=epi  $tmp.fsstress.bin
+	sudo -u fsgqa CMD="$tmp.fsstress.bin $args" \
+		sh -c 'exec $CMD > /dev/null 2>&1' & \
+		eval 'pid=$!'
+
+	echo "Run dd writers in parallel"
+	for ((i=0; i < num_iterations; i++))
+	do
+		# File will be opened with O_TRUNC each time
+		sudo -u fsgqa \
+			CMD="dd if=/dev/zero of=$SCRATCH_MNT/SPACE_CONSUMER bs=1M " \
+			sh -c 'exec $CMD > /dev/null 2>&1'
+		sleep $enospc_time
+	done
+	kill $pid
+	wait $pid
+}
+
+# real QA test starts here
+_supported_fs generic
+_supported_os Linux
+_require_scratch
+_require_quota
+_require_user
+_need_to_be_root
+
+umount $SCRATCH_DEV 2>/dev/null
+_scratch_mkfs_sized $((512 * 1024 * 1024)) >> $seq.full 2>&1
+_scratch_mount "-o usrquota,grpquota"
+chmod 777 $SCRATCH_MNT
+quotacheck -u -g $SCRATCH_MNT 2>/dev/null
+quotaon -u -g $SCRATCH_MNT 2>/dev/null
+
+if ! _workout; then
+	_scratch_unmount 2>/dev/null
+	exit
+fi
+
+if ! _check_quota_usage; then
+	_scratch_unmount 2>/dev/null
+	status=1
+	exit
+fi
+
+echo Comparing filesystem consistency
+if ! _scratch_unmount; then
+	echo "failed to umount"
+	status=1
+	exit
+fi
+_check_scratch_fs
+status=$?
+exit
diff --git a/265.out b/265.out
new file mode 100644
index 0000000..7637291
--- /dev/null
+++ b/265.out
@@ -0,0 +1,8 @@
+QA output created by 265
+
+Run fsstress
+
+Run dd writers in parallel
+Comparing user usage
+Comparing group usage
+Comparing filesystem consistency
diff --git a/group b/group
index e79c29b..487051a 100644
--- a/group
+++ b/group
@@ -378,3 +378,4 @@ deprecated
 262 auto quick quota
 263 rw auto quick
 264 auto rw prealloc ioctl enospc
+265 auto quota rw prealloc ioctl enospc
-- 
1.7.1

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* Re: new corruption pattern on ext4
  2011-10-19 10:29 ` Dmitry Monakhov
@ 2011-10-20  9:40   ` Dmitry Monakhov
  -1 siblings, 0 replies; 32+ messages in thread
From: Dmitry Monakhov @ 2011-10-20  9:40 UTC (permalink / raw)
  To: linux-fsdevel, xfs, linux-ext4, jack, hch, aelder, tytso

On Wed, 19 Oct 2011 14:29:41 +0400, Dmitry Monakhov <dmonakhov@openvz.org> wrote:
> xfstests: fsstress should kill children tasks before exit
> xfstests: add different logging option to fsstress
> xfstests: add fallocate support to fsstress
> xfstests: fsstress add FS_IOC_{SET,GET}FLAGS operations
> xfstests: Dump inode info when possible
> xfstests: add fiemap operation
> 
> # Following testcase will fail on recent kernel in case of ext4
> # Some fixes are already available here:
> # http://www.spinics.net/lists/linux-ext4/msg27857.html
> xfstests: add new stress test
FYI: i've run 264'th test on recent tytso/ext4.git(dcf2d804ed6ffe)
and have got new type of fs-corruption, i haven't seen this before,
at this moment I dont have a fix for that:
Pass 1: Checking inodes, blocks, and sizes
Inode 176 has an invalid extent
      (logical block 236, invalid physical block 0, len 0)
Clear? no

Inode 22293 has an invalid extent
      (logical block 531, invalid physical block 0, len 0)
Clear? no

Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
...

> 
> # Following testcase will fail on recent kernel in case of ext3/4 
> # Fixes available here:
> #  http://patchwork.ozlabs.org/patch/120581/
> #  http://patchwork.ozlabs.org/patch/120582/
> xfstests: add new quota stress test
> 
> P.S: ext4 still contains bugs caused by ordered_mode=>journal_mode
> switch for didicated inode (chattr +j ./afile), so you temproraly
> disable this test by adding "-f setattr=0" to $FSSTRESS_AVOID var.
>      

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: new corruption pattern on ext4
@ 2011-10-20  9:40   ` Dmitry Monakhov
  0 siblings, 0 replies; 32+ messages in thread
From: Dmitry Monakhov @ 2011-10-20  9:40 UTC (permalink / raw)
  To: linux-fsdevel, xfs, linux-ext4, jack, hch, aelder, tytso

On Wed, 19 Oct 2011 14:29:41 +0400, Dmitry Monakhov <dmonakhov@openvz.org> wrote:
> xfstests: fsstress should kill children tasks before exit
> xfstests: add different logging option to fsstress
> xfstests: add fallocate support to fsstress
> xfstests: fsstress add FS_IOC_{SET,GET}FLAGS operations
> xfstests: Dump inode info when possible
> xfstests: add fiemap operation
> 
> # Following testcase will fail on recent kernel in case of ext4
> # Some fixes are already available here:
> # http://www.spinics.net/lists/linux-ext4/msg27857.html
> xfstests: add new stress test
FYI: i've run 264'th test on recent tytso/ext4.git(dcf2d804ed6ffe)
and have got new type of fs-corruption, i haven't seen this before,
at this moment I dont have a fix for that:
Pass 1: Checking inodes, blocks, and sizes
Inode 176 has an invalid extent
      (logical block 236, invalid physical block 0, len 0)
Clear? no

Inode 22293 has an invalid extent
      (logical block 531, invalid physical block 0, len 0)
Clear? no

Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
...

> 
> # Following testcase will fail on recent kernel in case of ext3/4 
> # Fixes available here:
> #  http://patchwork.ozlabs.org/patch/120581/
> #  http://patchwork.ozlabs.org/patch/120582/
> xfstests: add new quota stress test
> 
> P.S: ext4 still contains bugs caused by ordered_mode=>journal_mode
> switch for didicated inode (chattr +j ./afile), so you temproraly
> disable this test by adding "-f setattr=0" to $FSSTRESS_AVOID var.
>      

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [PATCH] xfstests: add regression test for extent corruption on ext4
  2011-10-20  9:40   ` Dmitry Monakhov
@ 2011-10-20 20:38     ` Dmitry Monakhov
  -1 siblings, 0 replies; 32+ messages in thread
From: Dmitry Monakhov @ 2011-10-20 20:38 UTC (permalink / raw)
  To: linux-fsdevel, xfs, linux-ext4, jack, hch, aelder, tytso

[-- Attachment #1: Type: text/plain, Size: 1476 bytes --]

On Thu, 20 Oct 2011 13:40:15 +0400, Dmitry Monakhov <dmonakhov@openvz.org> wrote:
> On Wed, 19 Oct 2011 14:29:41 +0400, Dmitry Monakhov <dmonakhov@openvz.org> wrote:
> > xfstests: fsstress should kill children tasks before exit
> > xfstests: add different logging option to fsstress
> > xfstests: add fallocate support to fsstress
> > xfstests: fsstress add FS_IOC_{SET,GET}FLAGS operations
> > xfstests: Dump inode info when possible
> > xfstests: add fiemap operation
> > 
> > # Following testcase will fail on recent kernel in case of ext4
> > # Some fixes are already available here:
> > # http://www.spinics.net/lists/linux-ext4/msg27857.html
> > xfstests: add new stress test
> FYI: i've run 264'th test on recent tytso/ext4.git(dcf2d804ed6ffe)
> and have got new type of fs-corruption, i haven't seen this before,
> at this moment I dont have a fix for that:
> Pass 1: Checking inodes, blocks, and sizes
> Inode 176 has an invalid extent
>       (logical block 236, invalid physical block 0, len 0)
> Clear? no
> 
> Inode 22293 has an invalid extent
>       (logical block 531, invalid physical block 0, len 0)
> Clear? no
> 
> Pass 2: Checking directory structure
> Pass 3: Checking directory connectivity
> Pass 4: Checking reference counts
> Pass 5: Checking group summary information
> ...
Ok, this one appears to be easy. eh_entries updated after
ext4_ext_dirty() was called inside ext4_ext_rm_leaf().
Testcase attached, will send a fix for the issue in a minute.

[-- Attachment #2: 0001-xfstests-add-regression-test-for-extent-corruption-o.patch --]
[-- Type: text/plain, Size: 3770 bytes --]

>From b24f909727d71647d8721af6f86946ad30fe9b9c Mon Sep 17 00:00:00 2001
From: Dmitry Monakhov <dmonakhov@openvz.org>
Date: Fri, 21 Oct 2011 00:32:32 +0400
Subject: [PATCH] xfstests: add regression test for extent corruption on ext4


Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
 266     |   69 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 266.out |   44 ++++++++++++++++++++++++++++++++++++++++
 group   |    1 +
 3 files changed, 114 insertions(+), 0 deletions(-)
 create mode 100644 266
 create mode 100644 266.out

diff --git a/266 b/266
new file mode 100644
index 0000000..4209532
--- /dev/null
+++ b/266
@@ -0,0 +1,69 @@
+#! /bin/bash
+# FSQA Test No. 266
+#
+# Regression testcase for d583fb87a3ff0 (ext4 extent corruption)
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2006 Silicon Graphics, Inc.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+#-----------------------------------------------------------------------
+#
+# creator
+owner=dmonakhov@openvz.org
+
+seq=`basename $0`
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1	# failure is the default!
+trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
+
+# get standard environment, filters and checks
+. ./common.rc
+. ./common.filter
+
+# real QA test starts here
+_supported_fs ext4
+_supported_os Linux
+_require_scratch
+_need_to_be_root
+
+umount $SCRATCH_DEV 2>/dev/null
+_scratch_mkfs_sized $((128 * 1024 * 1024)) >> $seq.full 2>&1
+
+# -onoload and EXT4_SYNC_FL on file is important becase result in
+# metadata sync writes inside ext4_handle_dirty_metadata()
+_scratch_mount -onoload
+touch $SCRATCH_MNT/file
+chattr +S $SCRATCH_MNT/file
+# Create sparse file 
+for ((i = 0; i < 21; i++))
+do
+    dd if=/dev/zero of=$SCRATCH_MNT/file bs=4k count=1 seek=$((i*10))
+done
+# truncate last extent
+truncate $SCRATCH_MNT/file --size $((4096* 200))
+
+if ! _scratch_unmount; then
+	echo "failed to umount"
+	status=1
+	exit
+fi
+echo "Check filesystem"
+_check_scratch_fs
+status=$?
+exit
diff --git a/266.out b/266.out
new file mode 100644
index 0000000..a248232
--- /dev/null
+++ b/266.out
@@ -0,0 +1,44 @@
+QA output created by 266
+1+0 records in
+1+0 records out
+1+0 records in
+1+0 records out
+1+0 records in
+1+0 records out
+1+0 records in
+1+0 records out
+1+0 records in
+1+0 records out
+1+0 records in
+1+0 records out
+1+0 records in
+1+0 records out
+1+0 records in
+1+0 records out
+1+0 records in
+1+0 records out
+1+0 records in
+1+0 records out
+1+0 records in
+1+0 records out
+1+0 records in
+1+0 records out
+1+0 records in
+1+0 records out
+1+0 records in
+1+0 records out
+1+0 records in
+1+0 records out
+1+0 records in
+1+0 records out
+1+0 records in
+1+0 records out
+1+0 records in
+1+0 records out
+1+0 records in
+1+0 records out
+1+0 records in
+1+0 records out
+1+0 records in
+1+0 records out
+Check filesystem
diff --git a/group b/group
index 487051a..281d92b 100644
--- a/group
+++ b/group
@@ -379,4 +379,4 @@ deprecated
 263 rw auto quick
 264 auto rw prealloc ioctl enospc
 265 auto quota rw prealloc ioctl enospc
+266 rw auto quick 
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH] xfstests: add regression test for extent corruption on ext4
@ 2011-10-20 20:38     ` Dmitry Monakhov
  0 siblings, 0 replies; 32+ messages in thread
From: Dmitry Monakhov @ 2011-10-20 20:38 UTC (permalink / raw)
  To: linux-fsdevel, xfs, linux-ext4, jack, hch, aelder, tytso

[-- Attachment #1: Type: text/plain, Size: 1476 bytes --]

On Thu, 20 Oct 2011 13:40:15 +0400, Dmitry Monakhov <dmonakhov@openvz.org> wrote:
> On Wed, 19 Oct 2011 14:29:41 +0400, Dmitry Monakhov <dmonakhov@openvz.org> wrote:
> > xfstests: fsstress should kill children tasks before exit
> > xfstests: add different logging option to fsstress
> > xfstests: add fallocate support to fsstress
> > xfstests: fsstress add FS_IOC_{SET,GET}FLAGS operations
> > xfstests: Dump inode info when possible
> > xfstests: add fiemap operation
> > 
> > # Following testcase will fail on recent kernel in case of ext4
> > # Some fixes are already available here:
> > # http://www.spinics.net/lists/linux-ext4/msg27857.html
> > xfstests: add new stress test
> FYI: i've run 264'th test on recent tytso/ext4.git(dcf2d804ed6ffe)
> and have got new type of fs-corruption, i haven't seen this before,
> at this moment I dont have a fix for that:
> Pass 1: Checking inodes, blocks, and sizes
> Inode 176 has an invalid extent
>       (logical block 236, invalid physical block 0, len 0)
> Clear? no
> 
> Inode 22293 has an invalid extent
>       (logical block 531, invalid physical block 0, len 0)
> Clear? no
> 
> Pass 2: Checking directory structure
> Pass 3: Checking directory connectivity
> Pass 4: Checking reference counts
> Pass 5: Checking group summary information
> ...
Ok, this one appears to be easy. eh_entries updated after
ext4_ext_dirty() was called inside ext4_ext_rm_leaf().
Testcase attached, will send a fix for the issue in a minute.

[-- Attachment #2: 0001-xfstests-add-regression-test-for-extent-corruption-o.patch --]
[-- Type: text/plain, Size: 3770 bytes --]

>From b24f909727d71647d8721af6f86946ad30fe9b9c Mon Sep 17 00:00:00 2001
From: Dmitry Monakhov <dmonakhov@openvz.org>
Date: Fri, 21 Oct 2011 00:32:32 +0400
Subject: [PATCH] xfstests: add regression test for extent corruption on ext4


Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
 266     |   69 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 266.out |   44 ++++++++++++++++++++++++++++++++++++++++
 group   |    1 +
 3 files changed, 114 insertions(+), 0 deletions(-)
 create mode 100644 266
 create mode 100644 266.out

diff --git a/266 b/266
new file mode 100644
index 0000000..4209532
--- /dev/null
+++ b/266
@@ -0,0 +1,69 @@
+#! /bin/bash
+# FSQA Test No. 266
+#
+# Regression testcase for d583fb87a3ff0 (ext4 extent corruption)
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2006 Silicon Graphics, Inc.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+#-----------------------------------------------------------------------
+#
+# creator
+owner=dmonakhov@openvz.org
+
+seq=`basename $0`
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1	# failure is the default!
+trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
+
+# get standard environment, filters and checks
+. ./common.rc
+. ./common.filter
+
+# real QA test starts here
+_supported_fs ext4
+_supported_os Linux
+_require_scratch
+_need_to_be_root
+
+umount $SCRATCH_DEV 2>/dev/null
+_scratch_mkfs_sized $((128 * 1024 * 1024)) >> $seq.full 2>&1
+
+# -onoload and EXT4_SYNC_FL on file is important becase result in
+# metadata sync writes inside ext4_handle_dirty_metadata()
+_scratch_mount -onoload
+touch $SCRATCH_MNT/file
+chattr +S $SCRATCH_MNT/file
+# Create sparse file 
+for ((i = 0; i < 21; i++))
+do
+    dd if=/dev/zero of=$SCRATCH_MNT/file bs=4k count=1 seek=$((i*10))
+done
+# truncate last extent
+truncate $SCRATCH_MNT/file --size $((4096* 200))
+
+if ! _scratch_unmount; then
+	echo "failed to umount"
+	status=1
+	exit
+fi
+echo "Check filesystem"
+_check_scratch_fs
+status=$?
+exit
diff --git a/266.out b/266.out
new file mode 100644
index 0000000..a248232
--- /dev/null
+++ b/266.out
@@ -0,0 +1,44 @@
+QA output created by 266
+1+0 records in
+1+0 records out
+1+0 records in
+1+0 records out
+1+0 records in
+1+0 records out
+1+0 records in
+1+0 records out
+1+0 records in
+1+0 records out
+1+0 records in
+1+0 records out
+1+0 records in
+1+0 records out
+1+0 records in
+1+0 records out
+1+0 records in
+1+0 records out
+1+0 records in
+1+0 records out
+1+0 records in
+1+0 records out
+1+0 records in
+1+0 records out
+1+0 records in
+1+0 records out
+1+0 records in
+1+0 records out
+1+0 records in
+1+0 records out
+1+0 records in
+1+0 records out
+1+0 records in
+1+0 records out
+1+0 records in
+1+0 records out
+1+0 records in
+1+0 records out
+1+0 records in
+1+0 records out
+1+0 records in
+1+0 records out
+Check filesystem
diff --git a/group b/group
index 487051a..281d92b 100644
--- a/group
+++ b/group
@@ -379,4 +379,4 @@ deprecated
 263 rw auto quick
 264 auto rw prealloc ioctl enospc
 265 auto quota rw prealloc ioctl enospc
+266 rw auto quick 
-- 
1.7.1


[-- Attachment #3: Type: text/plain, Size: 121 bytes --]

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* Re: [PATCH 1/8] xfstests: fsstress should kill children tasks before exit
  2011-10-19 10:29   ` Dmitry Monakhov
@ 2011-10-24  9:06     ` Christoph Hellwig
  -1 siblings, 0 replies; 32+ messages in thread
From: Christoph Hellwig @ 2011-10-24  9:06 UTC (permalink / raw)
  To: Dmitry Monakhov; +Cc: linux-fsdevel, xfs, linux-ext4, jack, hch, aelder

> +int 		should_stop = 0;

this should use sig_atomic_t, or at least volatile.
>  
>  void	add_to_flist(int, int, int);
>  void	append_pathname(pathname_t *, char *);
> @@ -253,6 +256,10 @@ void	usage(void);
>  void	write_freq(void);
>  void	zero_freq(void);
>  
> +void sg_handler(int signum) {
> +	should_stop = 1;
> +}

please use normal K&R / Linux style brace placement.


^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 1/8] xfstests: fsstress should kill children tasks before exit
@ 2011-10-24  9:06     ` Christoph Hellwig
  0 siblings, 0 replies; 32+ messages in thread
From: Christoph Hellwig @ 2011-10-24  9:06 UTC (permalink / raw)
  To: Dmitry Monakhov; +Cc: jack, xfs, hch, aelder, linux-fsdevel, linux-ext4

> +int 		should_stop = 0;

this should use sig_atomic_t, or at least volatile.
>  
>  void	add_to_flist(int, int, int);
>  void	append_pathname(pathname_t *, char *);
> @@ -253,6 +256,10 @@ void	usage(void);
>  void	write_freq(void);
>  void	zero_freq(void);
>  
> +void sg_handler(int signum) {
> +	should_stop = 1;
> +}

please use normal K&R / Linux style brace placement.

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 7/8] xfstests: add new stress test
  2011-10-19 10:29   ` Dmitry Monakhov
@ 2011-10-24  9:08     ` Christoph Hellwig
  -1 siblings, 0 replies; 32+ messages in thread
From: Christoph Hellwig @ 2011-10-24  9:08 UTC (permalink / raw)
  To: Dmitry Monakhov; +Cc: linux-fsdevel, xfs, linux-ext4, jack, hch, aelder

On Wed, Oct 19, 2011 at 02:29:48PM +0400, Dmitry Monakhov wrote:
> During stress testing we want to cover as much code paths as possible
> fsstress is very good for this purpose. But it has expandable nature
> (disk usage almost continually grow). So once it goes in no ENOSPC
> condition it will be where till the end. But by running 'dd' writers
> in parallel we can regularly trigger ENOSPC but only for a limited
> periods of time because each time it opens file with O_TRUNC.

Looks good, but please use a more useful subject line, e.g.

xfstests: add a new test that runs fsstress under ENOSPC conditions.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 7/8] xfstests: add new stress test
@ 2011-10-24  9:08     ` Christoph Hellwig
  0 siblings, 0 replies; 32+ messages in thread
From: Christoph Hellwig @ 2011-10-24  9:08 UTC (permalink / raw)
  To: Dmitry Monakhov; +Cc: jack, xfs, hch, aelder, linux-fsdevel, linux-ext4

On Wed, Oct 19, 2011 at 02:29:48PM +0400, Dmitry Monakhov wrote:
> During stress testing we want to cover as much code paths as possible
> fsstress is very good for this purpose. But it has expandable nature
> (disk usage almost continually grow). So once it goes in no ENOSPC
> condition it will be where till the end. But by running 'dd' writers
> in parallel we can regularly trigger ENOSPC but only for a limited
> periods of time because each time it opens file with O_TRUNC.

Looks good, but please use a more useful subject line, e.g.

xfstests: add a new test that runs fsstress under ENOSPC conditions.

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 8/8] xfstests: add new quota stress test
  2011-10-19 10:29   ` Dmitry Monakhov
@ 2011-10-24  9:14     ` Christoph Hellwig
  -1 siblings, 0 replies; 32+ messages in thread
From: Christoph Hellwig @ 2011-10-24  9:14 UTC (permalink / raw)
  To: Dmitry Monakhov; +Cc: linux-fsdevel, xfs, linux-ext4, jack, hch, aelder

Same comment about the subject as the previous one.

Also please use su as xfstest currently doesn't use and require sudo.

Also please use $qa_user instead of using fsgqa directly.


^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 8/8] xfstests: add new quota stress test
@ 2011-10-24  9:14     ` Christoph Hellwig
  0 siblings, 0 replies; 32+ messages in thread
From: Christoph Hellwig @ 2011-10-24  9:14 UTC (permalink / raw)
  To: Dmitry Monakhov; +Cc: jack, xfs, hch, aelder, linux-fsdevel, linux-ext4

Same comment about the subject as the previous one.

Also please use su as xfstest currently doesn't use and require sudo.

Also please use $qa_user instead of using fsgqa directly.

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 2/8] xfstests: add different logging option to fsstress
  2011-10-19 10:29   ` Dmitry Monakhov
@ 2011-10-24  9:15     ` Christoph Hellwig
  -1 siblings, 0 replies; 32+ messages in thread
From: Christoph Hellwig @ 2011-10-24  9:15 UTC (permalink / raw)
  To: Dmitry Monakhov; +Cc: linux-fsdevel, xfs, linux-ext4, jack, hch, aelder

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>


^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 2/8] xfstests: add different logging option to fsstress
@ 2011-10-24  9:15     ` Christoph Hellwig
  0 siblings, 0 replies; 32+ messages in thread
From: Christoph Hellwig @ 2011-10-24  9:15 UTC (permalink / raw)
  To: Dmitry Monakhov; +Cc: jack, xfs, hch, aelder, linux-fsdevel, linux-ext4

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 5/8] xfstests: Dump inode info when possible
  2011-10-19 10:29   ` Dmitry Monakhov
@ 2011-10-24  9:16     ` Christoph Hellwig
  -1 siblings, 0 replies; 32+ messages in thread
From: Christoph Hellwig @ 2011-10-24  9:16 UTC (permalink / raw)
  To: Dmitry Monakhov; +Cc: linux-fsdevel, xfs, linux-ext4, jack, hch, aelder

Looks good.  For the next resend please reorder it to be before the
newly added functions beeing exercised.

Reviewed-by: Christoph Hellwig <hch@lst.de>


^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 5/8] xfstests: Dump inode info when possible
@ 2011-10-24  9:16     ` Christoph Hellwig
  0 siblings, 0 replies; 32+ messages in thread
From: Christoph Hellwig @ 2011-10-24  9:16 UTC (permalink / raw)
  To: Dmitry Monakhov; +Cc: jack, xfs, hch, aelder, linux-fsdevel, linux-ext4

Looks good.  For the next resend please reorder it to be before the
newly added functions beeing exercised.

Reviewed-by: Christoph Hellwig <hch@lst.de>

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 32+ messages in thread

end of thread, other threads:[~2011-10-24  9:16 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-19 10:29 [PATCH 0/8] xfstests: Bunch of new tests Dmitry Monakhov
2011-10-19 10:29 ` Dmitry Monakhov
2011-10-19 10:29 ` [PATCH 1/8] xfstests: fsstress should kill children tasks before exit Dmitry Monakhov
2011-10-19 10:29   ` Dmitry Monakhov
2011-10-24  9:06   ` Christoph Hellwig
2011-10-24  9:06     ` Christoph Hellwig
2011-10-19 10:29 ` [PATCH 2/8] xfstests: add different logging option to fsstress Dmitry Monakhov
2011-10-19 10:29   ` Dmitry Monakhov
2011-10-24  9:15   ` Christoph Hellwig
2011-10-24  9:15     ` Christoph Hellwig
2011-10-19 10:29 ` [PATCH 3/8] xfstests: add fallocate support " Dmitry Monakhov
2011-10-19 10:29   ` Dmitry Monakhov
2011-10-19 10:29 ` [PATCH 4/8] xfstests: fsstress add FS_IOC_{SET,GET}FLAGS operations Dmitry Monakhov
2011-10-19 10:29   ` Dmitry Monakhov
2011-10-19 10:29 ` [PATCH 5/8] xfstests: Dump inode info when possible Dmitry Monakhov
2011-10-19 10:29   ` Dmitry Monakhov
2011-10-24  9:16   ` Christoph Hellwig
2011-10-24  9:16     ` Christoph Hellwig
2011-10-19 10:29 ` [PATCH 6/8] xfstests: add fiemap operation Dmitry Monakhov
2011-10-19 10:29   ` Dmitry Monakhov
2011-10-19 10:29 ` [PATCH 7/8] xfstests: add new stress test Dmitry Monakhov
2011-10-19 10:29   ` Dmitry Monakhov
2011-10-24  9:08   ` Christoph Hellwig
2011-10-24  9:08     ` Christoph Hellwig
2011-10-19 10:29 ` [PATCH 8/8] xfstests: add new quota " Dmitry Monakhov
2011-10-19 10:29   ` Dmitry Monakhov
2011-10-24  9:14   ` Christoph Hellwig
2011-10-24  9:14     ` Christoph Hellwig
2011-10-20  9:40 ` new corruption pattern on ext4 Dmitry Monakhov
2011-10-20  9:40   ` Dmitry Monakhov
2011-10-20 20:38   ` [PATCH] xfstests: add regression test for extent corruption " Dmitry Monakhov
2011-10-20 20:38     ` Dmitry Monakhov

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.