From patchwork Tue Dec 18 20:35:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 10736253 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D6E1E14E2 for ; Tue, 18 Dec 2018 20:35:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C6C802AE1D for ; Tue, 18 Dec 2018 20:35:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BAD962AE25; Tue, 18 Dec 2018 20:35:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 658912AE1D for ; Tue, 18 Dec 2018 20:35:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727249AbeLRUfz (ORCPT ); Tue, 18 Dec 2018 15:35:55 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:55296 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726638AbeLRUfz (ORCPT ); Tue, 18 Dec 2018 15:35:55 -0500 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id wBIKZ3ws100523; Tue, 18 Dec 2018 20:35:53 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2018-07-02; bh=+cx++bt0VP66r0zNo6YZGQ1TSG6H74Uxf2xokzyH7pE=; b=lZl9AV+QLltgIfBSNyVv84wD1jRkZuyB76+ImQzkWbJtWghL9UiKXh2RYWGIYvBHNOXP Gs8HP8YWZW8yfTjkmjPppwFKomp90Al8F/6CI3pF2F8XbdLMDJjnLflPWW4tMDkP71Wh eqRVIxbeg99usm6ntmR/gYyRUdNvGNhPv9w7OCec0X7H7L2fAKQ7PHmgIrZlql9v3IjE U9jPa3Z0JhgLVh0vyLy061p8mw5SInjIJY34+Ej+KMq8ToWnYY2xofdBgwNypKIOMgHm w5R0NbgaPztrrm5iOn4JpkT4Rj4OqjIrDDh+NFKkCJsOvoplbuOVS8tBH8mkZ0m8gEuy 4A== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp2130.oracle.com with ESMTP id 2pcq4dwwcu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 18 Dec 2018 20:35:52 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id wBIKZpvt008913 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 18 Dec 2018 20:35:52 GMT Received: from abhmp0005.oracle.com (abhmp0005.oracle.com [141.146.116.11]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id wBIKZpeP016002; Tue, 18 Dec 2018 20:35:51 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 18 Dec 2018 12:35:51 -0800 Subject: [PATCH 1/5] xfs/111: fix golden output From: "Darrick J. Wong" To: guaneryu@gmail.com, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org Date: Tue, 18 Dec 2018 12:35:50 -0800 Message-ID: <154516535027.31115.4827015654233888092.stgit@magnolia> In-Reply-To: <154516534392.31115.7010578395334646479.stgit@magnolia> References: <154516534392.31115.7010578395334646479.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9111 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1812180170 Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Darrick J. Wong In commit f4eee5126, this test was changed to run xfs_fsr to bulkstat its way through the filesystem until it finds the corrupt inode. The golden output was changed to capture xfs_fsr's output, but neglects the fact that when fsr's output is not a tty, all the status and error messages are sent to syslog, not stdout. Therefore, this test consistently fails because it expects output of "$SCRATCH_MNT start inode=0" but this never appears. Signed-off-by: Darrick J. Wong --- tests/xfs/111 | 2 +- tests/xfs/111.out | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/xfs/111 b/tests/xfs/111 index 2ef69f07..965eb625 100755 --- a/tests/xfs/111 +++ b/tests/xfs/111 @@ -58,7 +58,7 @@ _try_scratch_mount || _fail "Couldn't mount after itrash" echo Attempting bulkstat #src/bstat -q $SCRATCH_MNT -$XFS_FSR_PROG $SCRATCH_MNT | _filter_scratch +$XFS_FSR_PROG -g $SCRATCH_MNT | _filter_scratch # Fix up intentional corruption so test can pass _scratch_unmount diff --git a/tests/xfs/111.out b/tests/xfs/111.out index fd56c3c8..41fa48f8 100644 --- a/tests/xfs/111.out +++ b/tests/xfs/111.out @@ -10,4 +10,3 @@ Blat inode clusters Starting overwrite Overwrite complete Attempting bulkstat -SCRATCH_MNT start inode=0 From patchwork Tue Dec 18 20:35:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 10736257 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9DD7513BF for ; Tue, 18 Dec 2018 20:36:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8EFD12AE19 for ; Tue, 18 Dec 2018 20:36:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 837AF2AE25; Tue, 18 Dec 2018 20:36:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2A5E72AE19 for ; Tue, 18 Dec 2018 20:36:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727613AbeLRUgC (ORCPT ); Tue, 18 Dec 2018 15:36:02 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:54550 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727366AbeLRUgB (ORCPT ); Tue, 18 Dec 2018 15:36:01 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id wBIKYRAR104566; Tue, 18 Dec 2018 20:35:59 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2018-07-02; bh=tLatF7cu6PbCNOCPRUHbdeM3KtGxZYxweNlEVswJi40=; b=rkr+3P6Zd+MQic9+Xqa+DVOkDRzSaaR3gL7/DgrlQOA9Jpd9xsQCqMs5UVwNa/7ROscZ 149IAB7s0AOXRCTlstuvROUN2ghFQnN07ccRbgF/gZk52mlLebU97x7WB6i9cFGko71P yx5+2sRsOamcoYgevjYaKzRzcGWiAqceGWUZQVVZUdMBq+6em6fl2DU+oZM5an7vOmY6 RBQ0PwgsuKVskmV8dJ4IGtHaZmOD3Ntz+j7w0ROlutXRbLoXnD2hhnaOnMYVVNvma2bL iXYW3ZHDdZc0bx3E1FymPnZUvFoYzHUvjVi4h8dk/d6UV2AGsxKRtu6C2vUtmt6lG+iL Ng== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2120.oracle.com with ESMTP id 2pct8qwmyj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 18 Dec 2018 20:35:59 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id wBIKZwfa014207 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 18 Dec 2018 20:35:59 GMT Received: from abhmp0020.oracle.com (abhmp0020.oracle.com [141.146.116.26]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id wBIKZwrc028616; Tue, 18 Dec 2018 20:35:58 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 18 Dec 2018 12:35:58 -0800 Subject: [PATCH 2/5] xfs/123: fix remote symlink block size calculation From: "Darrick J. Wong" To: guaneryu@gmail.com, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org Date: Tue, 18 Dec 2018 12:35:57 -0800 Message-ID: <154516535699.31115.15359236623997726880.stgit@magnolia> In-Reply-To: <154516534392.31115.7010578395334646479.stgit@magnolia> References: <154516534392.31115.7010578395334646479.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9111 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1812180170 Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Darrick J. Wong In this test we try to create a remote symlink block by creating a symlink target buffer large enough to exceed the size of an inode. Unfortunately we don't use the correct block size or symlink header size, which on a 1k block filesystem causes there to be two remote blocks. This causes crc verification errors in xfs_db (because it's too dumb to load both blocks as one like the kernel does) which we don't care about because we're about to corrupt the block anyway. So, fix the block size calculation so that we end up with one block. Signed-off-by: Darrick J. Wong --- tests/xfs/123 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/xfs/123 b/tests/xfs/123 index 8a494ef9..f45e94bf 100755 --- a/tests/xfs/123 +++ b/tests/xfs/123 @@ -46,11 +46,12 @@ _scratch_mkfs_xfs > /dev/null echo "+ mount fs image" _scratch_mount -blksz=1000 +blksz=1024 echo "+ make some files" echo "file contents: moo" > "${SCRATCH_MNT}/x" -str="$(perl -e "print './' x $(( (blksz / 2) - 16));")x" +reps=$(( (blksz - (56 + 1)) / 2 )) +str="$(perl -e "print './' x $reps;")x" (cd $SCRATCH_MNT; ln -s "${str}" "long_symlink") cat "${SCRATCH_MNT}/long_symlink" inode="$(stat -c '%i' "${SCRATCH_MNT}/long_symlink")" @@ -60,7 +61,7 @@ echo "+ check fs" _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail" echo "+ corrupt image" -_scratch_xfs_db -x -c "inode ${inode}" -c "dblock 0" -c "stack" -c "blocktrash -x 32 -o 256 -y $((blksz * 8)) -z ${FUZZ_ARGS}" >> $seqres.full +_scratch_xfs_db -x -c "inode ${inode}" -c "dblock 0" -c "stack" -c "blocktrash -x 32 -o 256 -y $((blksz * 4)) -z ${FUZZ_ARGS}" >> $seqres.full echo "+ mount image" if _try_scratch_mount >> $seqres.full 2>&1; then From patchwork Tue Dec 18 20:36:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 10736267 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BC4EF13BF for ; Tue, 18 Dec 2018 20:36:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AE9DE2AE19 for ; Tue, 18 Dec 2018 20:36:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A29FB2AE25; Tue, 18 Dec 2018 20:36:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8299E2AE19 for ; Tue, 18 Dec 2018 20:36:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727597AbeLRUgO (ORCPT ); Tue, 18 Dec 2018 15:36:14 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:54624 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727051AbeLRUgH (ORCPT ); Tue, 18 Dec 2018 15:36:07 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id wBIKYSrS104574; Tue, 18 Dec 2018 20:36:05 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2018-07-02; bh=0jcd2xCNBvZ3VzbU3nXtIzVCI/1YcgSlaroV7HijwyI=; b=efSvKfIvMNBEuKZw0b9hRncVy3eHcYxc4szJsQXfKhF5eoRsq+zZKvDJN4VEBm57Lclf ausmFoeOBoZ5TWvur8m+XidB/H1qJV8KWQXAG3Ot2JoeXKqcEdOJcCM2Byg50Nob20Gl GiHGv/73XdXEY3LgREFiJj7NUe2MNA9Sa02sqcmL3edl+/uz4R4+LuAKCd+kmjlpMk9k Hu2vFuVQA5KuYSrP34cdiIF8CiGPkHHjF/HSQ6U1YH/O7k9QQaUH0543nObhAoh01Awm oZT81GjLIpSYNNbsMwdWM0gI4x+SPlxy7yUv9GXVLZuWJOESE6FUWP/EE95MsFahTJL0 3g== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp2120.oracle.com with ESMTP id 2pct8qwn03-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 18 Dec 2018 20:36:05 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id wBIKa4M2009858 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 18 Dec 2018 20:36:05 GMT Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id wBIKa4ex016067; Tue, 18 Dec 2018 20:36:04 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 18 Dec 2018 12:36:04 -0800 Subject: [PATCH 3/5] generic/050: fix ro blockdev mount of xfs with quota From: "Darrick J. Wong" To: guaneryu@gmail.com, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org Date: Tue, 18 Dec 2018 12:36:03 -0800 Message-ID: <154516536357.31115.14111308107665005322.stgit@magnolia> In-Reply-To: <154516534392.31115.7010578395334646479.stgit@magnolia> References: <154516534392.31115.7010578395334646479.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9111 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1812180170 Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Darrick J. Wong In XFS, mounting with quota always require a writable device. If the block device is read only, the mount fails, which fails this test. Since this is expected, work around this by simulating the golden output when we expect a mount failure. Signed-off-by: Darrick J. Wong --- tests/generic/050 | 62 +++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 46 insertions(+), 16 deletions(-) diff --git a/tests/generic/050 b/tests/generic/050 index 90e924db..9a327165 100755 --- a/tests/generic/050 +++ b/tests/generic/050 @@ -36,6 +36,22 @@ _require_norecovery _scratch_mkfs >/dev/null 2>&1 +filter_ro_mount() { + local arg="" + + if [ -n "$expect_mount_failure" ]; then + arg="s|mount: $SCRATCH_MNT: permission denied|mount: device write-protected, mounting read-only|g" + fi + sed -e "$arg" | _filter_ro_mount +} + +# Mounting with quota on XFS requires a writable fs, which means +# we expect to fail the ro blockdev test with with EPERM. +expect_mount_failure= +if [ "$FSTYP" = "xfs" ] && echo "$MOUNT_OPTIONS" | grep -q quota ; then + expect_mount_failure=1 +fi + # # Mark the device read-only # @@ -46,17 +62,25 @@ blockdev --setro $SCRATCH_DEV # Mount it, and make sure we can't write to it, and we can unmount it again # echo "mounting read-only block device:" -_try_scratch_mount 2>&1 | _filter_ro_mount - -echo "touching file on read-only filesystem (should fail)" -touch $SCRATCH_MNT/foo 2>&1 | _filter_scratch - -# -# Apparently this used to be broken at some point: -# http://oss.sgi.com/bugzilla/show_bug.cgi?id=807 -# -echo "unmounting read-only filesystem" -_scratch_unmount 2>&1 | _filter_scratch +_try_scratch_mount 2>&1 | filter_ro_mount +if [ "${PIPESTATUS[0]}" -eq 0 ]; then + echo "touching file on read-only filesystem (should fail)" + touch $SCRATCH_MNT/foo 2>&1 | _filter_scratch + + # + # Apparently this used to be broken at some point: + # http://oss.sgi.com/bugzilla/show_bug.cgi?id=807 + # + echo "unmounting read-only filesystem" + _scratch_unmount 2>&1 | _filter_scratch +elif [ -n "${expect_mount_failure}" ]; then + # Mount failed, so simulate EROFS instead of scribbling on root fs + echo "touching file on read-only filesystem (should fail)" + echo "touch: cannot touch 'SCRATCH_MNT/foo': Read-only file system" + echo "unmounting read-only filesystem" +else + echo "Mount failed, though it wasn't supposed to!" +fi echo "setting device read-write" blockdev --setrw $SCRATCH_DEV @@ -88,14 +112,20 @@ _scratch_unmount 2>&1 | _filter_scratch | _filter_ending_dot # # This is the way out if the underlying device really is read-only. -# Doesn't mean it's a good idea in practive, more a last resort +# Doesn't mean it's a good idea in practice, more a last resort # data recovery hack. # echo "mounting filesystem with -o norecovery on a read-only device:" -_try_scratch_mount -o norecovery 2>&1 | _filter_ro_mount - -echo "unmounting read-only filesystem" -_scratch_unmount 2>&1 | _filter_scratch +_try_scratch_mount -o norecovery 2>&1 | filter_ro_mount +if [ "${PIPESTATUS[0]}" -eq 0 ]; then + echo "unmounting read-only filesystem" + _scratch_unmount 2>&1 | _filter_scratch +elif [ -n "${expect_mount_failure}" ]; then + # Mount failed, simulate correct output + echo "unmounting read-only filesystem" +else + echo "Mount failed, though it wasn't supposed to!" +fi echo "setting device read-write" blockdev --setrw $SCRATCH_DEV From patchwork Tue Dec 18 20:36:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 10736263 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0DC0E13BF for ; Tue, 18 Dec 2018 20:36:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EF7012AE25 for ; Tue, 18 Dec 2018 20:36:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E41772AE28; Tue, 18 Dec 2018 20:36:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8517E2AE25 for ; Tue, 18 Dec 2018 20:36:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727051AbeLRUgP (ORCPT ); Tue, 18 Dec 2018 15:36:15 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:55448 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727544AbeLRUgO (ORCPT ); Tue, 18 Dec 2018 15:36:14 -0500 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id wBIKYRgR100217; Tue, 18 Dec 2018 20:36:12 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2018-07-02; bh=DakUgSHR9Nip9pokvWACfQP8KQ7hBSFms1phCxpUTn4=; b=1mXN6VOgTr4FJr8behBUDPEOS2g3nSn5pG7lZMT2DBvdqaznZnIYvnMnm8e3Gyjj+TwD MDDr7Eh5asgWnZ7sBXSqts2MxQDoOLjCep0pcY9FC1hyiNR+tI57Qll2xcOdHS2amRxd 8H/tEjuHxli8jPeJk9XQcyNfll5beb92bWTMZlNOkJrpU5Mfh9QGI9LytqUOTbMe9gVm n+1cplt6K4SQ5mOdm8JHeXrgoq5LKxtoYx4agfv+u4MH2LhMGY82sGFKZEo7EDorGjMw iV8eQMRFkOZO27NDf41RTC9hIGfZh6yTARq7l1bll1sY9V9rOevCmA6Ci6g8HFtTjLcS Hw== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by aserp2130.oracle.com with ESMTP id 2pcq4dwwee-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 18 Dec 2018 20:36:12 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id wBIKaB73015164 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 18 Dec 2018 20:36:11 GMT Received: from abhmp0019.oracle.com (abhmp0019.oracle.com [141.146.116.25]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id wBIKaBMK013352; Tue, 18 Dec 2018 20:36:11 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 18 Dec 2018 12:36:10 -0800 Subject: [PATCH 4/5] xfs: look for stringified constants in ftrace formats From: "Darrick J. Wong" To: guaneryu@gmail.com, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org Date: Tue, 18 Dec 2018 12:36:09 -0800 Message-ID: <154516536986.31115.738289589511424146.stgit@magnolia> In-Reply-To: <154516534392.31115.7010578395334646479.stgit@magnolia> References: <154516534392.31115.7010578395334646479.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9111 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1812180170 Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Darrick J. Wong Look for uninterpretable stringified constants in the ftrace format description for xfs tracepoints. Signed-off-by: Darrick J. Wong --- tests/xfs/735 | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/735.out | 3 ++ tests/xfs/group | 1 + 3 files changed, 77 insertions(+) create mode 100755 tests/xfs/735 create mode 100644 tests/xfs/735.out diff --git a/tests/xfs/735 b/tests/xfs/735 new file mode 100755 index 00000000..d5f4eba0 --- /dev/null +++ b/tests/xfs/735 @@ -0,0 +1,73 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2018 Oracle, Inc. All Rights Reserved. +# +# FS QA Test No. 735 +# +# Look for stringified constants in the __print_symbolic format strings, +# which suggest that we forgot to TRACE_DEFINE_ENUM somewhere, which causes +# incomplete ftrace reporting. +# +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 7 15 + +_cleanup() +{ + cd / + rm -rf $tmp.* +} + +# get standard environment, filters and checks +. ./common/rc + +# real QA test starts here +_supported_os Linux +_supported_fs xfs + +cprog=$tmp.ftrace.c +oprog=$tmp.ftrace +sedprog=$tmp.ftrace.sed + +ftrace_dir=/sys/kernel/debug/tracing/events/xfs + +test -d $ftrace_dir || _notrun "ftrace not enabled" + +# The second argument to __print_symbolic is stringified in the tracepoint's +# fmt file, so we look for "{ NUM, STRING }" and try to separate each of them +# into single lines so that we can build a C structure. This will (we hope) +# catch non-constant numbers that the compiler won't know about. +cat > $sedprog << ENDL +s/}, /},\n/g +s/}),/},\n/g +s/})/},\n/g +s/, {/\n{/g +ENDL + +cat > $cprog << ENDL +struct ftrace_chk { + unsigned long long num; + char *str; +} syms[] = { +ENDL +egrep '(__print_flags|__print_symbolic)' $ftrace_dir*/*/format | \ + sed -f $sedprog | grep '^{' | sort | uniq >> $cprog +cat >> $cprog << ENDL +}; + +int main(int argc, char *argv[]) { return 0; } +ENDL + +cat $cprog >> $seqres.full +echo Compiler errors imply missing TRACE_DEFINE_ENUM. +cc -o $oprog $cprog + +# success, all done +echo Silence is golden +status=0 +exit diff --git a/tests/xfs/735.out b/tests/xfs/735.out new file mode 100644 index 00000000..844cea1d --- /dev/null +++ b/tests/xfs/735.out @@ -0,0 +1,3 @@ +QA output created by 735 +Compiler errors imply missing TRACE_DEFINE_ENUM. +Silence is golden diff --git a/tests/xfs/group b/tests/xfs/group index dfaae2bc..4a986af3 100644 --- a/tests/xfs/group +++ b/tests/xfs/group @@ -496,3 +496,4 @@ 496 dangerous_fuzzers dangerous_scrub dangerous_repair 497 dangerous_fuzzers dangerous_scrub dangerous_online_repair 498 dangerous_fuzzers dangerous_norepair +735 auto quick From patchwork Tue Dec 18 20:36:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 10736271 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3B26813BF for ; Tue, 18 Dec 2018 20:36:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 24ABF2AE19 for ; Tue, 18 Dec 2018 20:36:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 158192AE25; Tue, 18 Dec 2018 20:36:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AB31A2AE19 for ; Tue, 18 Dec 2018 20:36:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726988AbeLRUgc (ORCPT ); Tue, 18 Dec 2018 15:36:32 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:54772 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727290AbeLRUgV (ORCPT ); Tue, 18 Dec 2018 15:36:21 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id wBIKYkN7104696; Tue, 18 Dec 2018 20:36:19 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2018-07-02; bh=p3sHXLbHLJJvUb23wbipcMmFlwL2JyBtK/D5yaJmuD8=; b=ZkwcDWdjE+VkfZ0Xmy1+tK5P94PD/7BZnlGXjXwlIJtVeXBosKtBG1IU4SAuzpnSJFid DYNE5qowH/XoTEi7QQY2o8rQzNr0b9eb9IntpV78WDLACIyoxw4MEZRg2HVRuPm2sQ9c nxVqDutrJ3I5Rd74kMZLcK3rSiE07AtjBVJfrPO/DqMOd37buKzcbNr5pGq6Mmox2Rtz gp2IcfDOov+TKNFaBquPQ+S6x6dAg6UnWq67H7Acmy4sWtMyy7cV8liHCPdJzh0EPhXW lBGUSRGdV0AJ7T6JttEKqDBOxdjqVNBwMCSh+Lhds5AaZacgYRl6UIytima/KgMeOTh8 Gg== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp2120.oracle.com with ESMTP id 2pct8qwn1b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 18 Dec 2018 20:36:18 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id wBIKaHPF009263 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 18 Dec 2018 20:36:18 GMT Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id wBIKaHlR028789; Tue, 18 Dec 2018 20:36:17 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 18 Dec 2018 12:36:17 -0800 Subject: [PATCH 5/5] xfs: filter out mount options that don't work on v4 filesystems From: "Darrick J. Wong" To: guaneryu@gmail.com, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org Date: Tue, 18 Dec 2018 12:36:16 -0800 Message-ID: <154516537610.31115.1785062537646476692.stgit@magnolia> In-Reply-To: <154516534392.31115.7010578395334646479.stgit@magnolia> References: <154516534392.31115.7010578395334646479.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9111 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1812180170 Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Darrick J. Wong A few tests require v4 filesystems and enforce this by disabling crc's in the _scratch_mkfs call. However, if the user specified MOUNT_OPTIONS that only work with v5 filesystems, these tests fail. If we detect a test creating a v4 scratch filesystem, filter out incompatible mount options that don't work on v4, such as simultaneous group/project quota. Signed-off-by: Darrick J. Wong --- common/xfs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/common/xfs b/common/xfs index 80340b0d..484e6ab6 100644 --- a/common/xfs +++ b/common/xfs @@ -89,6 +89,7 @@ _scratch_mkfs_xfs() _scratch_do_mkfs "$mkfs_cmd" "$mkfs_filter" $* 2>$tmp.mkfserr 1>$tmp.mkfsstd mkfs_status=$? + grep -q crc=0 $tmp.mkfsstd && _force_xfsv4_mount_options if [ $mkfs_status -eq 0 -a "$LARGE_SCRATCH_DEV" = yes ]; then # manually parse the mkfs output to get the fs size in bytes @@ -779,3 +780,26 @@ _scratch_get_bmx_prefix() { _scratch_xfs_db -c "inode ${ino}" -c 'p' >> $seqres.full return 1 } + +# +# Ensures that we don't pass any mount options incompatible with XFS v4 +# +_force_xfsv4_mount_options() +{ + local gquota=0 + local pquota=0 + + # Can't have group and project quotas in XFS v4 + echo "$MOUNT_OPTIONS" | egrep -q "(gquota|grpquota|grpjquota=|gqnoenforce)" && gquota=1 + echo "$MOUNT_OPTIONS" | egrep -q "(\bpquota|prjquota|pqnoenforce)" && pquota=1 + + if [ $gquota -gt 0 ] && [ $pquota -gt 0 ]; then + export MOUNT_OPTIONS=$(echo $MOUNT_OPTIONS \ + | sed -e 's/gquota/QUOTA/g' \ + -e 's/grpquota/QUOTA/g' \ + -e 's/grpjquota=[^, ]/QUOTA/g' \ + -e 's/gqnoenforce/QUOTA/g' \ + -e "s/QUOTA/defaults/g") + fi + echo "MOUNT_OPTIONS = $MOUNT_OPTIONS" >>$seqres.full +}