From patchwork Thu Nov 1 23:19:21 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: 10664667 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 1B7CC17DF for ; Thu, 1 Nov 2018 23:19:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0DF782C4F4 for ; Thu, 1 Nov 2018 23:19:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F3A142C524; Thu, 1 Nov 2018 23:19:31 +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 9EDDB2C512 for ; Thu, 1 Nov 2018 23:19:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728143AbeKBIYc (ORCPT ); Fri, 2 Nov 2018 04:24:32 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:54134 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727749AbeKBIYc (ORCPT ); Fri, 2 Nov 2018 04:24:32 -0400 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 wA1NJ2At087596; Thu, 1 Nov 2018 23:19:28 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=1bPsTbGWK80fKuimb5GbCByQyJn1EcMlQgKxwEzg+94=; b=KnxLIASGxrkzT+Z5UQ0LfGZnYvpvFqEdnrllqtw9mjw2IEqkuVlh+Nr8fmuZlhCT1tT1 1FHCx9CsBwuf+Bzm1swv6hR+mGOIZ9FZnA5uD7ODesJc6lUyTwF6Pkxc+T085wmWoY0p +xudUOkQCT0zAKcCO3S1f8AaNIp7NuEW5GVKM/25LcPsoKF0wtB3bB5q5TelfJXp3RQF OD5q2CfmMuFs8ZrAgpop3ZU8LWufj/W/GwE/FdAkyFlKpO2URdSQDob67THhRyNCXCRe U/B3J+3MS+eRw/Y0uUBU71u4gk6UYsVWpQYbKQh5AMk7D82QCA1NY1F9WBZ7gvqA29Zn Ew== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp2120.oracle.com with ESMTP id 2ncgnrbq4u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 01 Nov 2018 23:19:28 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id wA1NJM1o010658 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 1 Nov 2018 23:19:23 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 wA1NJMPT031716; Thu, 1 Nov 2018 23:19:22 GMT Received: from localhost (/10.145.178.77) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 01 Nov 2018 16:19:22 -0700 Subject: [PATCH 3/8] 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: Thu, 01 Nov 2018 16:19:21 -0700 Message-ID: <154111436126.6577.15057711037961689350.stgit@magnolia> In-Reply-To: <154111434286.6577.15010861884505931015.stgit@magnolia> References: <154111434286.6577.15010861884505931015.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9064 signatures=668683 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-1807170000 definitions=main-1811010194 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@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. Signed-off-by: Darrick J. Wong --- tests/generic/050 | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/tests/generic/050 b/tests/generic/050 index 90e924db..33da228d 100755 --- a/tests/generic/050 +++ b/tests/generic/050 @@ -36,6 +36,21 @@ _require_norecovery _scratch_mkfs >/dev/null 2>&1 +filter_ro_mount() { + local arg="" + + # Mounting with quota on XFS requires a writable fs, which means + # we fail the ro blockdev test with with EPERM. + if [ "$FSTYP" = "xfs" ] && echo "$MOUNT_OPTIONS" | grep -q quota ; then + arg="s|mount: $SCRATCH_MNT: permission denied|mount: device write-protected, mounting read-only|g" + fi + sed -e "$arg" | _filter_ro_mount +} + +filter_umount() { + sed -e "\|umount: $SCRATCH_DEV: not mounted.|d" | _filter_scratch +} + # # Mark the device read-only # @@ -46,7 +61,7 @@ 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 +_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 @@ -56,7 +71,7 @@ touch $SCRATCH_MNT/foo 2>&1 | _filter_scratch # http://oss.sgi.com/bugzilla/show_bug.cgi?id=807 # echo "unmounting read-only filesystem" -_scratch_unmount 2>&1 | _filter_scratch +_scratch_unmount 2>&1 | filter_umount echo "setting device read-write" blockdev --setrw $SCRATCH_DEV @@ -92,10 +107,10 @@ _scratch_unmount 2>&1 | _filter_scratch | _filter_ending_dot # data recovery hack. # echo "mounting filesystem with -o norecovery on a read-only device:" -_try_scratch_mount -o norecovery 2>&1 | _filter_ro_mount +_try_scratch_mount -o norecovery 2>&1 | filter_ro_mount echo "unmounting read-only filesystem" -_scratch_unmount 2>&1 | _filter_scratch +_scratch_unmount 2>&1 | filter_umount echo "setting device read-write" blockdev --setrw $SCRATCH_DEV