generic: add test for executables on read-only DAX mounts
authorRoss Zwisler <ross.zwisler@linux.intel.com>
Thu, 31 Aug 2017 04:09:10 +0000 (22:09 -0600)
committerEryu Guan <eguan@redhat.com>
Sun, 3 Sep 2017 04:20:00 +0000 (12:20 +0800)
This adds a regression test for the following kernel patch:

commit 42d4a99b09cb ("ext4: fix fault handling when mounted with -o
dax,ro")

The above patch fixes an issue with ext4 where executables cannot be
run on read-only filesystems mounted with the DAX option.

This issue does not appear to be present in ext2 or XFS, as they
both pass the test.  I've also confirmed outside of the test that
they are both indeed able to execute binaries on read-only DAX
mounts.

Thanks to Randy Dodgen for the bug report and reproduction steps.

Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
Cc: Randy Dodgen <rdodgen@gmail.com>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
tests/generic/452 [new file with mode: 0755]
tests/generic/452.out [new file with mode: 0644]
tests/generic/group

diff --git a/tests/generic/452 b/tests/generic/452
new file mode 100755 (executable)
index 0000000..c9eaa88
--- /dev/null
@@ -0,0 +1,73 @@
+#! /bin/bash
+# FS QA Test 452
+#
+# This is a regression test for kernel patch:
+#   commit 42d4a99b09cb ("ext4: fix fault handling when mounted with -o dax,ro")
+# created by Ross Zwisler <ross.zwisler@linux.intel.com>
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2017 Intel Corporation.  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
+#-----------------------------------------------------------------------
+#
+
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1       # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+       cd /
+       rm -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# remove previous $seqres.full before test
+rm -f $seqres.full
+
+# Modify as appropriate.
+_supported_fs generic
+_supported_os Linux
+_require_scratch
+
+# we need to be able to execute binaries on scratch
+_exclude_scratch_mount_option "noexec"
+
+# real QA test starts here
+# format and mount
+_scratch_mkfs > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
+
+LS=$(which ls --skip-alias --skip-functions)
+SCRATCH_LS=$SCRATCH_MNT/ls_on_scratch
+cp $LS $SCRATCH_LS
+
+$SCRATCH_LS $SCRATCH_LS | _filter_scratch
+
+_scratch_remount ro
+
+$SCRATCH_LS $SCRATCH_LS | _filter_scratch
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/452.out b/tests/generic/452.out
new file mode 100644 (file)
index 0000000..1d24d6b
--- /dev/null
@@ -0,0 +1,3 @@
+QA output created by 452
+SCRATCH_MNT/ls_on_scratch
+SCRATCH_MNT/ls_on_scratch
index a5fdf2d4cd9817d71be955fda6e8696220fb0de1..4214b7be408c2d82390f25f63a889ad10f367ca3 100644 (file)
 449 auto quick acl enospc
 450 auto quick rw
 451 auto quick rw aio
 449 auto quick acl enospc
 450 auto quick rw
 451 auto quick rw aio
+452 auto quick