Commit Graph

3673 Commits

Author SHA1 Message Date
Dave Chinner c432589da3 src/: spdx license conversion
Mostly scripted like all the others, manually added tags to
Makefile, nsexec.c and t_mmap_writev.c. Manually touched up
open_by_handle.c and t_encrypted_d_revalidate.c post script.

Notes for future reference:
- src/log-writes/ code has no explicit copyright or license tags,
  nor does the upstream repository, hence license is unknown.
  Need Josef to clarify the license and send a patch adding SPDX
  tags to those files.

- src/perf code has no explicit copyright or license tags, but it
  was code submitted explictly for fstests so it is assumed to be
  GPLv2.0 and tagged as such. If this is incorrect, Josef will need
  to clarify copyright and the license and send patches to correct
  it.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
2018-06-22 10:38:07 +08:00
Dave Chinner 09faacc129 src/aio-dio-regress/: spdx license conversion
The license headers all had to be manually editted into a consistent
format, then converted to spdx tags via scripting.  Manually added
tag to Makefile.

Notes for future reference and research:
- quoted source repositories for aio-dio suite no longer exist
- src/aio-dio-regress/aiodio_sparse2.c has no explicit license
  statement, so need to find original source to determine actual
  license before tagging.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
2018-06-22 10:38:04 +08:00
Dave Chinner f65752b73e lib/: spdx license conversion
Scripted like all the others, manually added tags to
Makefile, touchups required for random.c

Signed-off-by: Dave Chinner <dchinner@redhat.com>
2018-06-22 10:38:00 +08:00
Dave Chinner fa993e5130 include/: spdx license conversion
Mostly scripted like all the others, manually added tags to
Makefile and build/config input files.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
2018-06-22 10:37:57 +08:00
Dave Chinner a3b48623c3 dmapi: spdx license conversion
Scripted like all the others.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
2018-06-22 10:37:53 +08:00
Ross Zwisler 424cdb8c0a src: fix up mmap() error checking
I noticed that in some of my C tests in src/ I was incorrectly
checking for mmap() failure by looking for NULL instead of
MAP_FAILED.  Fix those and clean up some places where we were
testing against -1 (the actual value of MAP_FAILED) which was
manually being cast to a pointer.

Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-06-22 10:23:55 +08:00
Marco Benatto f5cc573281 common/xfs: Add _scratch_get_sfdir_prefix function
Move get_sfdir_prefix function from xfs/278 to commom/xfs
and rename it to _scratch_get_sfdir_prefix so it can be
used in other xfs tests.

This commit also changes xfs/278 to make use of
_scratch_get_sfdir_prefix instead previous one.

Signed-off-by: Marco Benatto <mbenatto@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-06-22 10:23:30 +08:00
Lu Fengqi 8865de330f btrfs: replace btrfs-debug-tree with btrfs inspect-internal dump-tree
Since btrfs-dump-tree has been removed from btrfs-progs, use btrfs
inspect-internal dump-tree instead of btrfs-dump-tree.

Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com>
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-06-22 10:22:51 +08:00
Xiao Yang ec91652eb6 src/t_stripealign.c: Fix complier error
The FIEMAP_EXTENT_SHARED flag was added into kernel since commit
8c0414cd524e, so undefined FIEMAP_EXTENT_SHARED resulted in complier
error on old distros(e.g. RHEL6), as below:
----------------------------------------------------------------------
t_stripealign.c:99: error: 'FIEMAP_EXTENT_SHARED' undeclared (first use in this function)
----------------------------------------------------------------------

We fix it by defining the flag manually.

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-06-20 16:01:57 +08:00
Zorro Lang f15f05a9ba xfs/170: increase agsize for bigger internal log size
xfs/170 always fails on xfs with "-m rmapbt=1,reflink=1", because
XFS need bigger internal log size if rmapbt and reflink are both
enabled.

One line of xfs/170 as below:

  _test_streams 8 16 4 8 3 0 0

Refer to common/filestreams, we can see xfs/170 trys to create a
128M XFS (agcount=8, agsize=16M), then each stream writes
24M (8 * 3M files), and there're 4 streams.

So the case expects each stream takes 2 AGs, 4 streams takes
different 8 AGs just enough. But internal log will break this
balance. For example:

"mkfs.xfs -f -b size=4k -m rmapbt=1,reflink=1 $dev" will take 3075
4k blocks (12M) by default:
  meta-data=/dev/mapper/xxxx-xfscratch isize=512    agcount=8, agsize=4096 blks
  ...
  log      =internal               bsize=4096   blocks=3075, version=2
           =                       sectsz=512   sunit=0 blks, lazy-count=1
  ...

And the internal log is in the 4th AG:
  # xfs_logprint: /dev/mapper/xxxx-xfscratch
  xfs_logprint:
      data device: 0xfd03
      log device: 0xfd03 daddr: 131120 length: 24600
  # xfs_db -c "convert daddr 131120 agno" /dev/mapper/xxxx-xfscratch
  0x4 (4)

Then if one stream write data into AG-1 at first, then turn to AG-4
after fill 16M agsize. But AG-4 has 12M space for log section, so
only 4M free space for data. Then this stream have to turn to the
next AG after fill the 4M space. All these as below:

  # xfs_bmap -vp stream2-dir/*
  stream2-dir/frame-1:
   EXT: FILE-OFFSET      BLOCK-RANGE      AG AG-OFFSET        TOTAL FLAGS
     0: [0..6143]:       32960..39103      1 (192..6335)       6144 000000
  ...
  ...
  stream2-dir/frame-5:
   EXT: FILE-OFFSET      BLOCK-RANGE      AG AG-OFFSET        TOTAL FLAGS
     0: [0..6143]:       57536..63679      1 (24768..30911)    6144 000000
  stream2-dir/frame-6:
   EXT: FILE-OFFSET      BLOCK-RANGE      AG AG-OFFSET        TOTAL FLAGS
     0: [0..6143]:       155776..161919    4 (24704..30847)    6144 000000
  stream2-dir/frame-7:
   EXT: FILE-OFFSET      BLOCK-RANGE      AG AG-OFFSET        TOTAL FLAGS
     0: [0..6143]:       170088..176231    5 (6248..12391)     6144 000000
  stream2-dir/frame-8:
   EXT: FILE-OFFSET      BLOCK-RANGE      AG AG-OFFSET        TOTAL FLAGS
     0: [0..6143]:       176232..182375    5 (12392..18535)    6144 000000

Later _test_streams maybe takes AG-5 again, and cause two streams use
AG-5. To avoid this failure, increase the agsize from 16M to 22M,
others stay the same, each stream still writes 2 AGs. Even internal
log takes some space from someone AG, left space should be enough to
write (24 - 22)=2M data.

Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-06-15 11:00:54 +08:00
Darrick J. Wong 16be889bc9 generic/223: port t_stripealign to FIEMAP
Since XFS has deprecated FIBMAP on FSDAX filesystems, we can't use
FIBMAP to verify stripe alignment anymore.  FIEMAP has existed for
quite some time now, so port it to use that instead, and only fall
back to FIBMAP if FIEMAP doesn't exist.

Tested-by: ross.zwisler@linux.intel.com
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-06-15 11:00:54 +08:00
Misono Tomohiro e1ca827f83 btrfs: Add test that checks rmdir(2) can delete a subvolume
Add btrfs test that checks "rmdir" or "rm -r" command can delete a
subvolume like an ordinary directory.

This behavior has been restricted long time but becomes allowed by
kernel commit a79a464d5675 ("btrfs: Allow rmdir(2) to delete an
empty subvolume")

The test will be skipped if kernel does not support the feature,
which can be checked whether /sys/fs/btrfs/features/rmdir_subvol
exists or not.

Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: Misono Tomohiro <misono.tomohiro@jp.fujitsu.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-06-13 15:00:50 +08:00
Hou Tao 9618c0adca ltp/fsx: output the seed value after logid is initialized
When running multiple fsx processes simultaneously (e.g.
generic/455), it is difficult to tell the seed value for one fsx
process if the seed value is needed to reproduce a log-replay
failure.

Fix it by outputting the seed value after logid is initialized.

Signed-off-by: Hou Tao <houtao1@huawei.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-06-13 10:13:55 +08:00
Filipe Manana 8e38c06860 generic: add test for fsync of directory after creating hard link
Test that if we create a new hard link for a file which was
previously fsync'ed, fsync a parent directory of the new hard link
and power fail, the parent directory exists after mounting the
filesystem again. The parent directory must be a new directory, not
yet persisted.

This test is motivated by a bug found in btrfs, where the fsync'ed
parent directory was lost after a power failure. The bug in btrfs is
fixed by a patch for the linux kernel titled:

 "Btrfs: sync log after logging new name"

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-06-13 10:07:54 +08:00
Jakob Unterwurzacher 072ff808cf generic/391: add _require_odirect
On filesystems that do not support O_DIRECT, the test should skip
itself with

 generic/391	 [not run] O_DIRECT is not supported

instead of failing with

 generic/391	 - output mismatch ...
     ...
     +open: Invalid argument
      Silence is golden
     ...

This patch make it do that by adding a call to _require_odirect.
Fixes https://github.com/rfjakob/gocryptfs/issues/244 .

Signed-off-by: Jakob Unterwurzacher <jakobunt@gmail.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-06-13 09:48:53 +08:00
Zorro Lang 9b07c2d4fd common: improve regex in _check_dmesg
A dmesg output as below cause all cases fail:

[  508.002072] EDAC DEBUG: ie31200_check: MC0

Due to it matches `egrep -e "BUG:"` in _check_dmesg. But it's not a
real BUG output, so use "\bBUG:" to avoid this mistake.

Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
2018-06-12 16:37:19 +08:00
Dave Chinner 3805d7e97a fstests: make lsqa.pl work with SPDX tags
The regex matches used to dump the test headers are no longer valid,
so update them to work with the new test header format.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
2018-06-09 11:45:38 +10:00
Dave Chinner f3e65e9150 fstests: convert top level files and tools to SPDX
Scripted conversion, see script in initial SPDX license commit
message. Many files required touch-ups after the script had run
because of the old and widely different formats. most touchups were
to remove excess empty comment lines the script left behind.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
2018-06-09 11:36:01 +10:00
Dave Chinner 0c1a95d067 fstests: convert remaining tests to SPDX license tags
Fully scripted conversion, see script in initial SPDX license commit
message.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
2018-06-09 11:35:53 +10:00
Dave Chinner 1ff4192932 btrfs: convert tests to SPDX license tags
Fully scripted conversion, see script in initial SPDX license commit
message.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
2018-06-09 11:35:50 +10:00
Dave Chinner 2529c9486a xfs: convert tests to SPDX license tags
Fully scripted conversion, see script in initial SPDX license commit
message.

tests/xfs/044 was hand massaged to remove duplicate copyright and
divider lines before running the script.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
2018-06-09 11:35:45 +10:00
Dave Chinner cf89aed924 generic: convert tests to SPDX license tags
Fully scripted conversion, see script in initial SPDX license commit
message.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
2018-06-09 11:35:42 +10:00
Dave Chinner f3faa8173a fstests: convert new test template to SPDX tags
Signed-off-by: Dave Chinner <dchinner@redhat.com>
2018-06-09 11:35:32 +10:00
Dave Chinner 98a3b42b42 common: convert to SPDX license tags
These have been scripted conversions then cleaned up by hand as
there was no consistency to the formatting of the license headers in
the common/ directory. Author information was also removed (it's in
the git history) and so now the header format is consistently:

##/bin/bash
# SPDX-License-Identifier: GPL-2.0(+)
# Copyright (c) <date> <owner>. All Rights Reserved.
#
# <file description>

Signed-off-by: Dave Chinner <dchinner@redhat.com>
2018-06-09 11:34:49 +10:00
Dave Chinner 99f34d0714 fstests: Add LICENSES directory
In preparation for changing tests over to use SPDX tags, add the
initial licenses needed for the common/ and tests/ changeover to
the LICENSES/ directory. For this initial patch set, only the GPLv2
license text is required.

The tests and other common scripts will be converted to tags via a
script and, if necessary touched up to fix any warts the script
can't handle. The script is run on a target via:

for f in `git grep -l "GNU General" <target>` ; do
	echo $f
	cat $f | awk -f hdr.awk > $f.new
	mv -f $f.new $f
done

This, unfortunately, changes the permissions of the files, so each
patch was post processed to remove the mode change fields from
the patches before they were committed. This preserves the file
modes, even though the files were replaced.

The awk script that dos all the substitution work is as follows:

$ cat hdr.awk
BEGIN {
        hdr = 1
        tag = "GPL-2.0"
	ignore = 0
        str = ""
	cstr = ""
}

/^#[\!#][ ]*\/bin\/bash/ {
	print $0
	next
}

/^#[\!#][ ]*.*\/perl/ {
	print $0
	next
}

/any later version./ {
        tag = "GPL-2.0+"
        next
}

/^#[\-]{65}/ {
	if (hdr == 1 && ignore == 0) {
		ignore = 1
		hdr = 0
	} else if (ignore == 1) {
		# use this to ignore empty comment line after license
		ignore = 2
	}
	next
}

/This program is free software/ {
	if (hdr == 1 && ignore == 0) {
		ignore = 1
		hdr = 0
	}
	next
}

/02110-1301[, ] *USA/ {
	# use this to ignore empty comment line after license
	if (ignore = 1) {
		ignore = 2
	}
	next
}

/^#[ ]*Copyright/ {
	if (cstr != "")
		cstr = cstr "\n"
	cstr = cstr $0
	next
}

// {
	if (ignore == 2) {
		print "# SPDX-License-Identifier: " tag
		print cstr "\n#"
		print str
		str=""
		ignore = 3

	}
	if (ignore == 1) {
		next
	} else if (ignore == 3) {
		# ignore trailing empty comment lines
		if ($0 == "#")
			next
		ignore = 0
	}

	if (str != "")
		str = str "\n"
	str = str $0
}

END {
	print str
}
$

Signed-off-by: Dave Chinner <dchinner@redhat.com>
2018-06-09 11:29:45 +10:00