* [PATCH 1/9] xfstests: fsstress add command line style output for show_opts
@ 2011-11-03 17:55 Dmitry Monakhov
2011-11-03 17:55 ` [PATCH 2/9] xfstests: freeze fsstress options for 117'th Dmitry Monakhov
` (8 more replies)
0 siblings, 9 replies; 16+ messages in thread
From: Dmitry Monakhov @ 2011-11-03 17:55 UTC (permalink / raw)
To: linux-fsdevel; +Cc: xfs, hch, aelder, tytso, Dmitry Monakhov
Once some combination of seed+fs_ops result in regression it is
reasonable to document that combination. It is usefull to dump
that configuration in command line style. Later this line may be
simply hardcoded in to regression test.
Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
070 | 2 +-
117 | 2 +-
ltp/fsstress.c | 21 +++++++++++++++++----
3 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/070 b/070
index 4458011..f48c33c 100755
--- a/070
+++ b/070
@@ -62,7 +62,7 @@ $FSSTRESS_PROG \
-f unresvsp=0 \
-f attr_set=100 \
-f attr_remove=100 \
- -S -p 1 -n 10000 >$seq.full 2>&1
+ -p 1 -n 10000 -S c >$seq.full 2>&1
status=$?
exit
diff --git a/117 b/117
index fcf0485..edec157 100755
--- a/117
+++ b/117
@@ -85,7 +85,7 @@ while [ $i -lt $ITERATIONS ]; do
-f attr_set=100 \
-f attr_remove=100 \
-s $seed \
- -S -p 1 -n 1000 >>$seq.full 2>&1
+ -p 1 -n 1000 -S c >>$seq.full 2>&1
let i=$i+1
done
diff --git a/ltp/fsstress.c b/ltp/fsstress.c
index 133a247..f9d7d6e 100644
--- a/ltp/fsstress.c
+++ b/ltp/fsstress.c
@@ -284,7 +284,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:o:p:rs:vwzHS")) != -1) {
+ while ((c = getopt(argc, argv, "d:e:f:i:m:n:o:p:rs:S:vwzH")) != -1) {
switch (c) {
case 'd':
dirname = optarg;
@@ -345,7 +345,10 @@ int main(int argc, char **argv)
zero_freq();
break;
case 'S':
- show_ops(0, NULL);
+ i = 0;
+ if (optarg[0] == 'c')
+ i = 1;
+ show_ops(1, NULL);
printf("\n");
nousage=1;
break;
@@ -1310,7 +1313,8 @@ show_ops(int flag, char *lead_str)
x+=printf("%s ", p->name);
}
printf("\n");
- } else {
+ } else if (flag == 0) {
+ /* Table view style */
int f;
for (f = 0, p = ops; p < ops_end; p++)
f += p->freq;
@@ -1327,6 +1331,15 @@ show_ops(int flag, char *lead_str)
(p->iswrite == 0) ? " " : "write op");
}
}
+ } else {
+ /* Command line style */
+ if (lead_str != NULL)
+ printf("%s", lead_str);
+ printf ("-z -s %ld -m %d -n %d -p %d \\\n", seed, idmodulo,
+ operations, nproc);
+ for (p = ops; p < ops_end; p++)
+ if (p->freq > 0)
+ printf("-f %s=%d \\\n",p->name, p->freq);
}
}
@@ -1433,7 +1446,7 @@ usage(void)
printf(" -v specifies verbose mode\n");
printf(" -w zeros frequencies of non-write operations\n");
printf(" -z zeros frequencies of all operations\n");
- printf(" -S prints the table of operations (omitting zero frequency)\n");
+ printf(" -S [c,t] prints the list of operations (omitting zero frequency) in command line or table style\n");
printf(" -H prints usage and exits\n");
}
--
1.7.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 2/9] xfstests: freeze fsstress options for 117'th
2011-11-03 17:55 [PATCH 1/9] xfstests: fsstress add command line style output for show_opts Dmitry Monakhov
@ 2011-11-03 17:55 ` Dmitry Monakhov
2011-11-03 17:55 ` [PATCH 3/9] xfstests: add fallocate support to fsstress Dmitry Monakhov
` (7 subsequent siblings)
8 siblings, 0 replies; 16+ messages in thread
From: Dmitry Monakhov @ 2011-11-03 17:55 UTC (permalink / raw)
To: linux-fsdevel; +Cc: xfs, hch, aelder, tytso, Dmitry Monakhov
This is regression tescase for explicit combination of seed+fs_opts.
Let's hardcode all options to prevent interactions with fsstress
changes in future.
Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
117 | 39 ++++++++++++++++++++++++++++-----------
1 files changed, 28 insertions(+), 11 deletions(-)
diff --git a/117 b/117
index edec157..2e3f658 100755
--- a/117
+++ b/117
@@ -33,8 +33,34 @@ tmp=/tmp/$$
status=1 # failure is the default!
trap "_cleanup; exit \$status" 0 1 2 3 15
-# seed for fsstress known to cause curruptions
+# seed and options for fsstress known to cause curruptions
seed=1122413794
+fss_ops=" -z \
+ -f attr_remove=100 \
+ -f attr_set=100 \
+ -f chown=3 \
+ -f creat=4 \
+ -f dread=4 \
+ -f dwrite=4 \
+ -f fdatasync=1 \
+ -f fsync=1 \
+ -f getdents=1 \
+ -f link=1 \
+ -f mkdir=2 \
+ -f mknod=2 \
+ -f read=1 \
+ -f readlink=1 \
+ -f rename=2 \
+ -f rmdir=1 \
+ -f setxattr=1 \
+ -f stat=1 \
+ -f symlink=2 \
+ -f sync=1 \
+ -f truncate=2 \
+ -f unlink=1 \
+ -f write=4 \
+ -s $seed \
+ -m 31 -n 1000 -p 1"
ITERATIONS=10
@@ -76,16 +102,7 @@ while [ $i -lt $ITERATIONS ]; do
echo fsstress iteration: $i | tee -a $seq.full
$FSSTRESS_PROG \
-d $SCRATCH_MNT/fsstress \
- -f allocsp=0 \
- -f freesp=0 \
- -f bulkstat=0 \
- -f bulkstat1=0 \
- -f resvsp=0 \
- -f unresvsp=0 \
- -f attr_set=100 \
- -f attr_remove=100 \
- -s $seed \
- -p 1 -n 1000 -S c >>$seq.full 2>&1
+ $fss_ops -S c >>$seq.full 2>&1
let i=$i+1
done
--
1.7.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 3/9] xfstests: add fallocate support to fsstress
2011-11-03 17:55 [PATCH 1/9] xfstests: fsstress add command line style output for show_opts Dmitry Monakhov
2011-11-03 17:55 ` [PATCH 2/9] xfstests: freeze fsstress options for 117'th Dmitry Monakhov
@ 2011-11-03 17:55 ` Dmitry Monakhov
2011-11-03 17:55 ` [PATCH 4/9] xfstests: fsstress add FS_IOC_{SET,GET}FLAGS operations v2 Dmitry Monakhov
` (6 subsequent siblings)
8 siblings, 0 replies; 16+ messages in thread
From: Dmitry Monakhov @ 2011-11-03 17:55 UTC (permalink / raw)
To: linux-fsdevel; +Cc: xfs, hch, aelder, tytso, 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 | 127 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 126 insertions(+), 1 deletions(-)
diff --git a/ltp/fsstress.c b/ltp/fsstress.c
index f9d7d6e..e9e4e67 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 },
@@ -2011,6 +2023,63 @@ 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;
+ char st[1024];
+ 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;
+ }
+ 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;
+ 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 %st %lld %lld %d\n",
+ procid, opno, mode,
+ f.path, st, (long long)off, (long long)len, e);
+ free_pathname(&f);
+ close(fd);
+#endif
+}
+
+
+void
fdatasync_f(int opno, long r)
{
int e;
@@ -2283,6 +2352,62 @@ 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;
+ char st[1024];
+ 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;
+ }
+ 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;
+ 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 %s %lld %lld %d\n",
+ procid, opno, mode,
+ f.path, st, (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] 16+ messages in thread
* [PATCH 4/9] xfstests: fsstress add FS_IOC_{SET,GET}FLAGS operations v2
2011-11-03 17:55 [PATCH 1/9] xfstests: fsstress add command line style output for show_opts Dmitry Monakhov
2011-11-03 17:55 ` [PATCH 2/9] xfstests: freeze fsstress options for 117'th Dmitry Monakhov
2011-11-03 17:55 ` [PATCH 3/9] xfstests: add fallocate support to fsstress Dmitry Monakhov
@ 2011-11-03 17:55 ` Dmitry Monakhov
2011-11-03 17:55 ` [PATCH 5/9] xfstests: add fiemap operation to fsstress Dmitry Monakhov
` (5 subsequent siblings)
8 siblings, 0 replies; 16+ messages in thread
From: Dmitry Monakhov @ 2011-11-03 17:55 UTC (permalink / raw)
To: linux-fsdevel; +Cc: xfs, hch, aelder, tytso, Dmitry Monakhov
Add two new operations:
- getattr: ioctl(fd, FS_IOC_GETFLAGS, &fl)
- setattr: ioctl(fd, FS_IOC_SETFLAGS, &random_flags)
Attribute mask may be passed via -M opt, by default is (~0).
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 | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-
3 files changed, 72 insertions(+), 1 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 e9e4e67..c258ee9 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,
@@ -140,6 +151,7 @@ void fallocate_f(int, long);
void fdatasync_f(int, long);
void freesp_f(int, long);
void fsync_f(int, long);
+void getattr_f(int, long);
void getdents_f(int, long);
void link_f(int, long);
void mkdir_f(int, long);
@@ -150,6 +162,7 @@ void readlink_f(int, long);
void rename_f(int, long);
void resvsp_f(int, long);
void rmdir_f(int, long);
+void setattr_f(int, long);
void setxattr_f(int, long);
void stat_f(int, long);
void symlink_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 },
@@ -218,6 +233,7 @@ int nops;
int nproc = 1;
int operations = 1;
unsigned int idmodulo = XFS_IDMODULO_MAX;
+unsigned int attr_mask = ~0;
int procid;
int rtpct;
unsigned long seed = 0;
@@ -296,7 +312,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:o:p:rs:S:vwzH")) != -1) {
+ while ((c = getopt(argc, argv, "d:e:f:i:m:M:n:o:p:rs:S:vwzH")) != -1) {
switch (c) {
case 'd':
dirname = optarg;
@@ -356,6 +372,9 @@ int main(int argc, char **argv)
case 'z':
zero_freq();
break;
+ case 'M':
+ attr_mask = strtoul(optarg, NULL, 0);
+ break;
case 'S':
i = 0;
if (optarg[0] == 'c')
@@ -2198,6 +2217,29 @@ fsync_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
getdents_f(int opno, long r)
{
DIR *dir;
@@ -2643,6 +2685,30 @@ rmdir_f(int opno, long r)
}
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 = attr_mask & (uint)random();
+ e = ioctl(fd, FS_IOC_SETFLAGS, &fl);
+ if (v)
+ printf("%d/%d: setattr %s %x %d\n", procid, opno, f.path, fl, e);
+ free_pathname(&f);
+ close(fd);
+}
+
+void
stat_f(int opno, long r)
{
int e;
--
1.7.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 5/9] xfstests: add fiemap operation to fsstress
2011-11-03 17:55 [PATCH 1/9] xfstests: fsstress add command line style output for show_opts Dmitry Monakhov
` (2 preceding siblings ...)
2011-11-03 17:55 ` [PATCH 4/9] xfstests: fsstress add FS_IOC_{SET,GET}FLAGS operations v2 Dmitry Monakhov
@ 2011-11-03 17:55 ` Dmitry Monakhov
2011-11-03 17:55 ` [PATCH 6/9] xfstests: add a new test that runs fsstress under ENOSPC conditions Dmitry Monakhov
` (4 subsequent siblings)
8 siblings, 0 replies; 16+ messages in thread
From: Dmitry Monakhov @ 2011-11-03 17:55 UTC (permalink / raw)
To: linux-fsdevel; +Cc: xfs, hch, aelder, tytso, 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 c258ee9..09c9529 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 getattr_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 },
@@ -2130,6 +2136,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] 16+ messages in thread
* [PATCH 6/9] xfstests: add a new test that runs fsstress under ENOSPC conditions
2011-11-03 17:55 [PATCH 1/9] xfstests: fsstress add command line style output for show_opts Dmitry Monakhov
` (3 preceding siblings ...)
2011-11-03 17:55 ` [PATCH 5/9] xfstests: add fiemap operation to fsstress Dmitry Monakhov
@ 2011-11-03 17:55 ` Dmitry Monakhov
2011-11-07 13:25 ` David Sterba
2011-11-03 17:55 ` [PATCH 7/9] xfstests: add a new quota " Dmitry Monakhov
` (3 subsequent siblings)
8 siblings, 1 reply; 16+ messages in thread
From: Dmitry Monakhov @ 2011-11-03 17:55 UTC (permalink / raw)
To: linux-fsdevel; +Cc: xfs, hch, aelder, tytso, 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 the same file with O_TRUNC.
Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
269 | 86 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
269.out | 5 +++
group | 1 +
3 files changed, 92 insertions(+), 0 deletions(-)
create mode 100755 269
create mode 100644 269.out
diff --git a/269 b/269
new file mode 100755
index 0000000..61e83ad
--- /dev/null
+++ b/269
@@ -0,0 +1,86 @@
+#! /bin/bash
+# FSQA Test No. 269
+#
+# 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/269.out b/269.out
new file mode 100644
index 0000000..0a83965
--- /dev/null
+++ b/269.out
@@ -0,0 +1,5 @@
+QA output created by 269
+
+Run fsstress
+
+Run dd writers in parallel
diff --git a/group b/group
index aaa8eba..8a5c334 100644
--- a/group
+++ b/group
@@ -382,3 +382,4 @@ deprecated
266 dump ioctl auto quick
267 dump ioctl tape
268 dump ioctl tape
+269 auto rw prealloc ioctl enospc
--
1.7.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 7/9] xfstests: add a new quota test that runs fsstress under ENOSPC conditions
2011-11-03 17:55 [PATCH 1/9] xfstests: fsstress add command line style output for show_opts Dmitry Monakhov
` (4 preceding siblings ...)
2011-11-03 17:55 ` [PATCH 6/9] xfstests: add a new test that runs fsstress under ENOSPC conditions Dmitry Monakhov
@ 2011-11-03 17:55 ` Dmitry Monakhov
2011-11-03 19:39 ` Christoph Hellwig
2011-11-03 17:55 ` [PATCH 8/9] xfstress: add regression testcase for d583fb87a3ff0 Dmitry Monakhov
` (2 subsequent siblings)
8 siblings, 1 reply; 16+ messages in thread
From: Dmitry Monakhov @ 2011-11-03 17:55 UTC (permalink / raw)
To: linux-fsdevel; +Cc: xfs, hch, aelder, tytso, Dmitry Monakhov
- Same as 264 but with quota enabled.
- IO performed from $qa_user user
- fsstress granted with CAP_CHOWN capability.
Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
270 | 108 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
270.out | 8 +++++
group | 1 +
3 files changed, 117 insertions(+), 0 deletions(-)
create mode 100755 270
create mode 100644 270.out
diff --git a/270 b/270
new file mode 100755
index 0000000..ed1e31e
--- /dev/null
+++ b/270
@@ -0,0 +1,108 @@
+#! /bin/bash
+# FSQA Test No. 270
+#
+# Run fsstress and ENSPC hitters in parallel, check quota and
+# 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"
+_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
+
+ (su $qa_user -c "$tmp.fsstress.bin $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
+ su $qa_user -c "dd if=/dev/zero \
+ of=$SCRATCH_MNT/SPACE_CONSUMER bs=1M " \
+ > /dev/null 2>&1
+ sleep $enospc_time
+ done
+
+ killall $tmp.fsstress.bin
+ 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/270.out b/270.out
new file mode 100644
index 0000000..bbd8026
--- /dev/null
+++ b/270.out
@@ -0,0 +1,8 @@
+QA output created by 270
+
+Run fsstress
+
+Run dd writers in parallel
+Comparing user usage
+Comparing group usage
+Comparing filesystem consistency
diff --git a/group b/group
index 8a5c334..84e81f5 100644
--- a/group
+++ b/group
@@ -383,3 +383,4 @@ deprecated
267 dump ioctl tape
268 dump ioctl tape
269 auto rw prealloc ioctl enospc
+270 auto quota rw prealloc ioctl enospc
--
1.7.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 8/9] xfstress: add regression testcase for d583fb87a3ff0
2011-11-03 17:55 [PATCH 1/9] xfstests: fsstress add command line style output for show_opts Dmitry Monakhov
` (5 preceding siblings ...)
2011-11-03 17:55 ` [PATCH 7/9] xfstests: add a new quota " Dmitry Monakhov
@ 2011-11-03 17:55 ` Dmitry Monakhov
2011-11-03 17:55 ` [PATCH 9/9] xfstress: Test data journaling flag switch for a single file Dmitry Monakhov
2011-11-07 20:52 ` [PATCH 1/9] xfstests: fsstress add command line style output for show_opts Dave Chinner
8 siblings, 0 replies; 16+ messages in thread
From: Dmitry Monakhov @ 2011-11-03 17:55 UTC (permalink / raw)
To: linux-fsdevel; +Cc: xfs, hch, aelder, tytso, Dmitry Monakhov
Should be fixed by following patch http://patchwork.ozlabs.org/patch/120883/
Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
271 | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
271.out | 44 ++++++++++++++++++++++++++++++++++++++++
group | 1 +
3 files changed, 114 insertions(+), 0 deletions(-)
create mode 100755 271
create mode 100644 271.out
diff --git a/271 b/271
new file mode 100755
index 0000000..b4e6043
--- /dev/null
+++ b/271
@@ -0,0 +1,69 @@
+#! /bin/bash
+# FSQA Test No. 271
+#
+# 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/271.out b/271.out
new file mode 100644
index 0000000..22a3c50
--- /dev/null
+++ b/271.out
@@ -0,0 +1,44 @@
+QA output created by 271
+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 84e81f5..fefa580 100644
--- a/group
+++ b/group
@@ -384,3 +384,4 @@ deprecated
268 dump ioctl tape
269 auto rw prealloc ioctl enospc
270 auto quota rw prealloc ioctl enospc
+271 auto rw quick
--
1.7.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 9/9] xfstress: Test data journaling flag switch for a single file
2011-11-03 17:55 [PATCH 1/9] xfstests: fsstress add command line style output for show_opts Dmitry Monakhov
` (6 preceding siblings ...)
2011-11-03 17:55 ` [PATCH 8/9] xfstress: add regression testcase for d583fb87a3ff0 Dmitry Monakhov
@ 2011-11-03 17:55 ` Dmitry Monakhov
2011-11-07 20:52 ` [PATCH 1/9] xfstests: fsstress add command line style output for show_opts Dave Chinner
8 siblings, 0 replies; 16+ messages in thread
From: Dmitry Monakhov @ 2011-11-03 17:55 UTC (permalink / raw)
To: linux-fsdevel; +Cc: xfs, hch, aelder, tytso, Dmitry Monakhov
Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
272 | 108 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
272.out | 37 +++++++++++++++++++++
group | 1 +
3 files changed, 146 insertions(+), 0 deletions(-)
create mode 100755 272
create mode 100644 272.out
diff --git a/272 b/272
new file mode 100755
index 0000000..a35ef83
--- /dev/null
+++ b/272
@@ -0,0 +1,108 @@
+#! /bin/bash
+# FSQA Test No. 272
+#
+# Test data journaling flag switch for a single file
+#
+#-----------------------------------------------------------------------
+# 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
+_workout()
+{
+ echo ""
+ echo " Switch data journalling mode"
+ echo ""
+ write_opt_list="iflag=noatime conv=notrunc conv=fsync oflag=direct"
+ chattr_opt_list="+j -j +jS -j"
+ idx=0
+ #
+ for write_opt in $write_opt_list
+ do
+ idx=$((idx + 1))
+ for chattr_opt in $chattr_opt_list
+ do
+
+ echo "OP write_opt: $write_opt 4M, \
+chattr_opt: $chattr_opt"
+ dd if=/dev/zero of=$SCRATCH_MNT/file.$idx \
+ bs=1M count=4 $write_opt \
+ >> $seq.full 2>&1 || exit
+ chattr $chattr_opt $SCRATCH_MNT/file.$idx >> $seq.full \
+ || exit
+ done
+ done
+ sync
+ # Same as previous test, but for one file,
+ # and with ENOSPC triggering
+ for write_opt in $write_opt_list
+ do
+ idx=$((idx + 1))
+ for chattr_opt in $chattr_opt_list
+ do
+
+ echo "OP write_opt: $write_opt ENOSPC, \
+chattr_opt: $chattr_opt"
+ dd if=/dev/zero of=$SCRATCH_MNT/file.$idx \
+ bs=1M $write_opt >> $seq.full 2>&1
+ chattr $chattr_opt $SCRATCH_MNT/file.$idx \
+ >> $seq.full || exit
+ done
+ sync
+ unlink $SCRATCH_MNT/file.$idx
+ done
+}
+
+# real QA test starts here
+_supported_fs ext3 ext4
+_supported_os Linux
+_require_scratch
+_need_to_be_root
+
+umount $SCRATCH_DEV 2>/dev/null
+_scratch_mkfs_sized $((64 * 1024 * 1024)) >> $seq.full 2>&1
+_scratch_mount
+
+if ! _workout; then
+ echo "workout failed"
+ _scratch_unmount
+ status=1
+ exit
+fi
+
+if ! _scratch_unmount; then
+ echo "failed to umount"
+ status=1
+ exit
+fi
+echo "Check filesystem"
+_check_scratch_fs
+status=$?
+exit
diff --git a/272.out b/272.out
new file mode 100644
index 0000000..cc687aa
--- /dev/null
+++ b/272.out
@@ -0,0 +1,37 @@
+QA output created by 272
+
+ Switch data journalling mode
+
+OP write_opt: iflag=noatime 4M, chattr_opt: +j
+OP write_opt: iflag=noatime 4M, chattr_opt: -j
+OP write_opt: iflag=noatime 4M, chattr_opt: +jS
+OP write_opt: iflag=noatime 4M, chattr_opt: -j
+OP write_opt: conv=notrunc 4M, chattr_opt: +j
+OP write_opt: conv=notrunc 4M, chattr_opt: -j
+OP write_opt: conv=notrunc 4M, chattr_opt: +jS
+OP write_opt: conv=notrunc 4M, chattr_opt: -j
+OP write_opt: conv=fsync 4M, chattr_opt: +j
+OP write_opt: conv=fsync 4M, chattr_opt: -j
+OP write_opt: conv=fsync 4M, chattr_opt: +jS
+OP write_opt: conv=fsync 4M, chattr_opt: -j
+OP write_opt: oflag=direct 4M, chattr_opt: +j
+OP write_opt: oflag=direct 4M, chattr_opt: -j
+OP write_opt: oflag=direct 4M, chattr_opt: +jS
+OP write_opt: oflag=direct 4M, chattr_opt: -j
+OP write_opt: iflag=noatime ENOSPC, chattr_opt: +j
+OP write_opt: iflag=noatime ENOSPC, chattr_opt: -j
+OP write_opt: iflag=noatime ENOSPC, chattr_opt: +jS
+OP write_opt: iflag=noatime ENOSPC, chattr_opt: -j
+OP write_opt: conv=notrunc ENOSPC, chattr_opt: +j
+OP write_opt: conv=notrunc ENOSPC, chattr_opt: -j
+OP write_opt: conv=notrunc ENOSPC, chattr_opt: +jS
+OP write_opt: conv=notrunc ENOSPC, chattr_opt: -j
+OP write_opt: conv=fsync ENOSPC, chattr_opt: +j
+OP write_opt: conv=fsync ENOSPC, chattr_opt: -j
+OP write_opt: conv=fsync ENOSPC, chattr_opt: +jS
+OP write_opt: conv=fsync ENOSPC, chattr_opt: -j
+OP write_opt: oflag=direct ENOSPC, chattr_opt: +j
+OP write_opt: oflag=direct ENOSPC, chattr_opt: -j
+OP write_opt: oflag=direct ENOSPC, chattr_opt: +jS
+OP write_opt: oflag=direct ENOSPC, chattr_opt: -j
+Check filesystem
diff --git a/group b/group
index fefa580..616cbdd 100644
--- a/group
+++ b/group
@@ -385,3 +385,4 @@ deprecated
269 auto rw prealloc ioctl enospc
270 auto quota rw prealloc ioctl enospc
271 auto rw quick
+272 auto enospc rw
--
1.7.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH 7/9] xfstests: add a new quota test that runs fsstress under ENOSPC conditions
2011-11-03 17:55 ` [PATCH 7/9] xfstests: add a new quota " Dmitry Monakhov
@ 2011-11-03 19:39 ` Christoph Hellwig
2011-11-07 6:15 ` Dmitry Monakhov
0 siblings, 1 reply; 16+ messages in thread
From: Christoph Hellwig @ 2011-11-03 19:39 UTC (permalink / raw)
To: Dmitry Monakhov; +Cc: linux-fsdevel, aelder, tytso, hch, xfs
On Thu, Nov 03, 2011 at 09:55:51PM +0400, Dmitry Monakhov wrote:
> - Same as 264 but with quota enabled.
269 is the new 270
> - IO performed from $qa_user user
> - fsstress granted with CAP_CHOWN capability.
This fails in my test VM because it doesn't have setcap. If you
want to use additional non-standard tools please do a _notrun if
they aren't present.
I don't quite understand why it would need CAP_CHOWN - chowns
from owned files do not require it, and the test runs fine with
the setcap line commented out.
I'll commit it as-is for now, but unless I get some feedback on
why the setcap is require I'll add another commit to remove it ASAP.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 7/9] xfstests: add a new quota test that runs fsstress under ENOSPC conditions
2011-11-03 19:39 ` Christoph Hellwig
@ 2011-11-07 6:15 ` Dmitry Monakhov
0 siblings, 0 replies; 16+ messages in thread
From: Dmitry Monakhov @ 2011-11-07 6:15 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: linux-fsdevel, aelder, tytso, hch, xfs
[-- Attachment #1: Type: text/plain, Size: 1215 bytes --]
On Thu, 3 Nov 2011 15:39:35 -0400, Christoph Hellwig <hch@infradead.org> wrote:
> On Thu, Nov 03, 2011 at 09:55:51PM +0400, Dmitry Monakhov wrote:
> > - Same as 264 but with quota enabled.
>
> 269 is the new 270
>
> > - IO performed from $qa_user user
> > - fsstress granted with CAP_CHOWN capability.
>
> This fails in my test VM because it doesn't have setcap. If you
> want to use additional non-standard tools please do a _notrun if
> they aren't present.
>
> I don't quite understand why it would need CAP_CHOWN - chowns
> from owned files do not require it, and the test runs fine with
> the setcap line commented out.
Yes, but fsstress want chown to random uid/gid
int inode_change_ok(..)
...
/* Make sure a caller can chown. */
if ((ia_valid & ATTR_UID) &&
(current_fsuid() != inode->i_uid ||
attr->ia_uid != inode->i_uid) && !capable(CAP_CHOWN))
return -EPERM;
>From my experience fssstess with chown enabled is the most valuable
quota accounting test. W/o chown this is just an useless time consumer.
>
> I'll commit it as-is for now, but unless I get some feedback on
> why the setcap is require I'll add another commit to remove it ASAP.
[-- Attachment #2: 0001-xfstests-270-th-test-want-use-setcap-8.patch --]
[-- Type: text/plain, Size: 1012 bytes --]
>From f8611f3bbc5ea2ac3672ee6c88d2d43d69351d49 Mon Sep 17 00:00:00 2001
From: Dmitry Monakhov <dmonakhov@openvz.org>
Date: Mon, 7 Nov 2011 08:07:57 +0300
Subject: [PATCH] xfstests: 270'th test want use setcap(8)
It wants to grant CAP_CHOWN to fsstress, without this capability
chown(2) will fail due to EPERM. Since chown(2) is one of the most
error prone places of quota accounting this makes 270'th
test almost useless, so it is better to simply skip it.
Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
270 | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/270 b/270
index ed1e31e..90e24f5 100755
--- a/270
+++ b/270
@@ -52,6 +52,9 @@ _workout()
echo "fsstress $args" >> $here/$seq.full
# Grant chown capability
cp $FSSTRESS_PROG $tmp.fsstress.bin
+ if [ "`whereis setcap`" == "setcap:" ]; then
+ _notrun "setcap not installed."
+ fi
setcap cap_chown=epi $tmp.fsstress.bin
(su $qa_user -c "$tmp.fsstress.bin $args" &) > /dev/null 2>&1
--
1.7.1
[-- Attachment #3: Type: text/plain, Size: 208 bytes --]
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH 6/9] xfstests: add a new test that runs fsstress under ENOSPC conditions
2011-11-03 17:55 ` [PATCH 6/9] xfstests: add a new test that runs fsstress under ENOSPC conditions Dmitry Monakhov
@ 2011-11-07 13:25 ` David Sterba
2011-11-07 13:31 ` Dmitry Monakhov
0 siblings, 1 reply; 16+ messages in thread
From: David Sterba @ 2011-11-07 13:25 UTC (permalink / raw)
To: Dmitry Monakhov; +Cc: linux-fsdevel, aelder, tytso, hch, xfs
Hi,
I saw this while running the newly added tests on btrfs:
On Thu, Nov 03, 2011 at 09:55:50PM +0400, Dmitry Monakhov wrote:
> --- /dev/null
> +++ b/269
> +_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
269 [failed, exit status 1] - output mismatch (see 269.out.bad)
--- 269.out 2011-11-07 13:26:23.000000000 +0100
+++ 269.out.bad 2011-11-07 14:07:44.000000000 +0100
@@ -3,3 +3,4 @@
Run fsstress
Run dd writers in parallel
+./269: line 60: kill: (9754) - No such process
> + wait $pid
> +}
and the test is reported to fail. Seems that the dd commands finish in less 2
seconds.
david
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 6/9] xfstests: add a new test that runs fsstress under ENOSPC conditions
2011-11-07 13:25 ` David Sterba
@ 2011-11-07 13:31 ` Dmitry Monakhov
2011-11-08 17:01 ` David Sterba
2011-11-08 17:04 ` Christoph Hellwig
0 siblings, 2 replies; 16+ messages in thread
From: Dmitry Monakhov @ 2011-11-07 13:31 UTC (permalink / raw)
To: dave; +Cc: linux-fsdevel, aelder, tytso, hch, xfs
On Mon, 7 Nov 2011 14:25:33 +0100, David Sterba <dave@jikos.cz> wrote:
> Hi,
>
> I saw this while running the newly added tests on btrfs:
>
> On Thu, Nov 03, 2011 at 09:55:50PM +0400, Dmitry Monakhov wrote:
> > --- /dev/null
> > +++ b/269
> > +_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
>
> 269 [failed, exit status 1] - output mismatch (see 269.out.bad)
> --- 269.out 2011-11-07 13:26:23.000000000 +0100
> +++ 269.out.bad 2011-11-07 14:07:44.000000000 +0100
> @@ -3,3 +3,4 @@
> Run fsstress
>
> Run dd writers in parallel
> +./269: line 60: kill: (9754) - No such process
>
> > + wait $pid
> > +}
>
> and the test is reported to fail. Seems that the dd commands finish in less 2
> seconds.
Have you recompile fsstress via make?
test explicitly want use new feature "-f setattr=1"
>
>
> david
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 1/9] xfstests: fsstress add command line style output for show_opts
2011-11-03 17:55 [PATCH 1/9] xfstests: fsstress add command line style output for show_opts Dmitry Monakhov
` (7 preceding siblings ...)
2011-11-03 17:55 ` [PATCH 9/9] xfstress: Test data journaling flag switch for a single file Dmitry Monakhov
@ 2011-11-07 20:52 ` Dave Chinner
8 siblings, 0 replies; 16+ messages in thread
From: Dave Chinner @ 2011-11-07 20:52 UTC (permalink / raw)
To: Dmitry Monakhov; +Cc: linux-fsdevel, xfs, hch, aelder, tytso
On Thu, Nov 03, 2011 at 09:55:45PM +0400, Dmitry Monakhov wrote:
> Once some combination of seed+fs_ops result in regression it is
> reasonable to document that combination. It is usefull to dump
> that configuration in command line style. Later this line may be
> simply hardcoded in to regression test.
.....
> @@ -345,7 +345,10 @@ int main(int argc, char **argv)
> zero_freq();
> break;
> case 'S':
> - show_ops(0, NULL);
> + i = 0;
> + if (optarg[0] == 'c')
> + i = 1;
> + show_ops(1, NULL);
I don't think that does what it is supposed to do...
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 6/9] xfstests: add a new test that runs fsstress under ENOSPC conditions
2011-11-07 13:31 ` Dmitry Monakhov
@ 2011-11-08 17:01 ` David Sterba
2011-11-08 17:04 ` Christoph Hellwig
1 sibling, 0 replies; 16+ messages in thread
From: David Sterba @ 2011-11-08 17:01 UTC (permalink / raw)
To: Dmitry Monakhov; +Cc: dave, linux-fsdevel, aelder, tytso, hch, xfs
On Mon, Nov 07, 2011 at 05:31:11PM +0400, Dmitry Monakhov wrote:
> > 269 [failed, exit status 1] - output mismatch (see 269.out.bad)
> > --- 269.out 2011-11-07 13:26:23.000000000 +0100
> > +++ 269.out.bad 2011-11-07 14:07:44.000000000 +0100
> > @@ -3,3 +3,4 @@
> > Run fsstress
> >
> > Run dd writers in parallel
> > +./269: line 60: kill: (9754) - No such process
> >
> > > + wait $pid
> > > +}
> >
> > and the test is reported to fail. Seems that the dd commands finish in less 2
> > seconds.
> Have you recompile fsstress via make?
That was it, thanks.
david
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 6/9] xfstests: add a new test that runs fsstress under ENOSPC conditions
2011-11-07 13:31 ` Dmitry Monakhov
2011-11-08 17:01 ` David Sterba
@ 2011-11-08 17:04 ` Christoph Hellwig
1 sibling, 0 replies; 16+ messages in thread
From: Christoph Hellwig @ 2011-11-08 17:04 UTC (permalink / raw)
To: Dmitry Monakhov; +Cc: dave, linux-fsdevel, aelder, tytso, hch, xfs
On Mon, Nov 07, 2011 at 05:31:11PM +0400, Dmitry Monakhov wrote:
> Have you recompile fsstress via make?
> test explicitly want use new feature "-f setattr=1"
Btw, one useful thing for these patches would be to clearly error
out if fsstress does't recognize the option.
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2011-11-08 17:04 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-03 17:55 [PATCH 1/9] xfstests: fsstress add command line style output for show_opts Dmitry Monakhov
2011-11-03 17:55 ` [PATCH 2/9] xfstests: freeze fsstress options for 117'th Dmitry Monakhov
2011-11-03 17:55 ` [PATCH 3/9] xfstests: add fallocate support to fsstress Dmitry Monakhov
2011-11-03 17:55 ` [PATCH 4/9] xfstests: fsstress add FS_IOC_{SET,GET}FLAGS operations v2 Dmitry Monakhov
2011-11-03 17:55 ` [PATCH 5/9] xfstests: add fiemap operation to fsstress Dmitry Monakhov
2011-11-03 17:55 ` [PATCH 6/9] xfstests: add a new test that runs fsstress under ENOSPC conditions Dmitry Monakhov
2011-11-07 13:25 ` David Sterba
2011-11-07 13:31 ` Dmitry Monakhov
2011-11-08 17:01 ` David Sterba
2011-11-08 17:04 ` Christoph Hellwig
2011-11-03 17:55 ` [PATCH 7/9] xfstests: add a new quota " Dmitry Monakhov
2011-11-03 19:39 ` Christoph Hellwig
2011-11-07 6:15 ` Dmitry Monakhov
2011-11-03 17:55 ` [PATCH 8/9] xfstress: add regression testcase for d583fb87a3ff0 Dmitry Monakhov
2011-11-03 17:55 ` [PATCH 9/9] xfstress: Test data journaling flag switch for a single file Dmitry Monakhov
2011-11-07 20:52 ` [PATCH 1/9] xfstests: fsstress add command line style output for show_opts Dave Chinner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).