From patchwork Tue Jan 5 14:31:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ritesh Harjani X-Patchwork-Id: 11999151 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8C6D3C433E0 for ; Tue, 5 Jan 2021 14:32:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 56EDC22A84 for ; Tue, 5 Jan 2021 14:32:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726499AbhAEOci (ORCPT ); Tue, 5 Jan 2021 09:32:38 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:59392 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726429AbhAEOch (ORCPT ); Tue, 5 Jan 2021 09:32:37 -0500 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 105EAOJe115940; Tue, 5 Jan 2021 09:31:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding; s=pp1; bh=mhxO1yNpwDzubrD22PikR7AmV6DiGBm6utdbPUIFYCc=; b=hcb4GuxmhLkwHq2Lq/baCfAjpqfPSlhVg9Cd3B0Vm0nGkjSF6GibsH/85bI+HuUZ2c3I 46qr9wdWbSFTgDRMOu0nwykGh/D1jlOOJotoP386asLdtfzOuE8fzYs2WLPRe1W1jw3a wvtm9c3RYqWHYL2HcgijUfu36VTOzgsBgEmYTQ75VqkO96ssxabhCi7GWOsglnOB9Ajk DHoasWea7RBYEdH3Pqv+pCKERFjoGeJH5o/+twcqUysdD0brMf3lYmco9FA/2XZtU1vD Z/bHrYe5RTjYyGXmsih/WeyjfPgojCfsCkezM8YC1pbwMhjeN8AD6TaAxuZOZCChgNFU aQ== Received: from ppma03fra.de.ibm.com (6b.4a.5195.ip4.static.sl-reverse.com [149.81.74.107]) by mx0a-001b2d01.pphosted.com with ESMTP id 35vsn20p5b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 05 Jan 2021 09:31:53 -0500 Received: from pps.filterd (ppma03fra.de.ibm.com [127.0.0.1]) by ppma03fra.de.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 105ESqdr027842; Tue, 5 Jan 2021 14:31:49 GMT Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by ppma03fra.de.ibm.com with ESMTP id 35tgf8hhdx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 05 Jan 2021 14:31:49 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 105EVk8Z22610226 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 5 Jan 2021 14:31:47 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C08074C052; Tue, 5 Jan 2021 14:31:46 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 813294C058; Tue, 5 Jan 2021 14:31:45 +0000 (GMT) Received: from riteshh-domain.ibmuc.com (unknown [9.199.32.130]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 5 Jan 2021 14:31:45 +0000 (GMT) From: Ritesh Harjani To: fstests@vger.kernel.org Cc: linux-xfs@vger.kernel.org, linux-ext4@vger.kernel.org, anju@linux.vnet.ibm.com, guan@eryu.me, darrick.wong@oracle.com, Ritesh Harjani Subject: [PATCHv3 1/2] common/rc: swapon should not fail for given FS in _require_scratch_swapfile() Date: Tue, 5 Jan 2021 20:01:42 +0530 Message-Id: X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.343,18.0.737 definitions=2021-01-05_02:2021-01-05,2021-01-05 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 impostorscore=0 clxscore=1011 spamscore=0 bulkscore=0 adultscore=0 lowpriorityscore=0 phishscore=0 priorityscore=1501 suspectscore=0 mlxlogscore=773 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101050089 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org Filesystems e.g. ext* and XFS supports swapon by default and an error returned with swapon should be treated as a failure. Signed-off-by: Ritesh Harjani Reviewed-by: Darrick J. Wong --- v2 -> v3: 1. Removed whitelisted naming convention. 2. Added ext2/ext3 as well as supported FS for swapon. 3. Removed local variable $fstyp, instead used $FSTYP directly in switch case. common/rc | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) -- 2.26.2 diff --git a/common/rc b/common/rc index 33b5b598a198..649b1cfd884a 100644 --- a/common/rc +++ b/common/rc @@ -2401,10 +2401,22 @@ _require_scratch_swapfile() # Minimum size for mkswap is 10 pages _format_swapfile "$SCRATCH_MNT/swap" $(($(get_page_size) * 10)) - if ! swapon "$SCRATCH_MNT/swap" >/dev/null 2>&1; then - _scratch_unmount - _notrun "swapfiles are not supported" - fi + # ext* and xfs have supported all variants of swap files since their + # introduction, so swapon should not fail. + case "$FSTYP" in + ext2|ext3|ext4|xfs) + if ! swapon "$SCRATCH_MNT/swap" >/dev/null 2>&1; then + _scratch_unmount + _fail "swapon failed for $FSTYP" + fi + ;; + *) + if ! swapon "$SCRATCH_MNT/swap" >/dev/null 2>&1; then + _scratch_unmount + _notrun "swapfiles are not supported" + fi + ;; + esac swapoff "$SCRATCH_MNT/swap" >/dev/null 2>&1 _scratch_unmount From patchwork Tue Jan 5 14:31:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ritesh Harjani X-Patchwork-Id: 11999153 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7B174C433DB for ; Tue, 5 Jan 2021 14:33:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4B78F22AAE for ; Tue, 5 Jan 2021 14:33:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726352AbhAEOdC (ORCPT ); Tue, 5 Jan 2021 09:33:02 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:30696 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726076AbhAEOdC (ORCPT ); Tue, 5 Jan 2021 09:33:02 -0500 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 105EW9f6071208; Tue, 5 Jan 2021 09:32:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=VjOyvlwRQ8IN757uWSoatarB17Xy/ESK3JmlD7zhSzw=; b=Q82bEc6D5A4V3Q3Z/1RlTKKNdAii4rHl19rG4de5xMgHS2C0zbfN59KlYw5HwsFAAaZZ 24Ek3lOt++lVKTf4B2+ZUdB8QkFN92BIT4jLr2WKaR2Xo91auicM+klrxc2YTRe3icAb ayO1yRlt1U33XhOH1unI0nEWUBNk1UgjVZTe7ePDtTd/rHmysEeTjXZkGN9PWXFzzMOJ JPcHCSblMIPMxvtrI6z3CcbBUjC0tXTrcuWc3JbmoigaovoMgiPs6SuCvB2NUedx3cFO iutVBOOuSS45TQKXvE7g+mAdeT1/t8onM4cbXbfRcPbeo/J6GR51iSTCQH1+iopRr5w/ Nw== Received: from ppma06fra.de.ibm.com (48.49.7a9f.ip4.static.sl-reverse.com [159.122.73.72]) by mx0a-001b2d01.pphosted.com with ESMTP id 35vs671rpe-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 05 Jan 2021 09:32:12 -0500 Received: from pps.filterd (ppma06fra.de.ibm.com [127.0.0.1]) by ppma06fra.de.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 105ESAKd030134; Tue, 5 Jan 2021 14:31:50 GMT Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by ppma06fra.de.ibm.com with ESMTP id 35tg3hhhg4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 05 Jan 2021 14:31:50 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 105EVmZS41877910 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 5 Jan 2021 14:31:48 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7155B4C050; Tue, 5 Jan 2021 14:31:48 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1AB5D4C040; Tue, 5 Jan 2021 14:31:47 +0000 (GMT) Received: from riteshh-domain.ibmuc.com (unknown [9.199.32.130]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 5 Jan 2021 14:31:46 +0000 (GMT) From: Ritesh Harjani To: fstests@vger.kernel.org Cc: linux-xfs@vger.kernel.org, linux-ext4@vger.kernel.org, anju@linux.vnet.ibm.com, guan@eryu.me, darrick.wong@oracle.com, Ritesh Harjani Subject: [PATCHv3 2/2] generic/496: ext4 and xfs supports swapon on fallocated file Date: Tue, 5 Jan 2021 20:01:43 +0530 Message-Id: <12d1420a4a3fe6be0918a8a13a1960db47032330.1609848797.git.riteshh@linux.ibm.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.343,18.0.737 definitions=2021-01-05_02:2021-01-05,2021-01-05 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 malwarescore=0 mlxlogscore=728 bulkscore=0 mlxscore=0 lowpriorityscore=0 spamscore=0 clxscore=1015 suspectscore=0 impostorscore=0 adultscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101050089 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org ext4, xfs should not fail swapon on fallocated file. Currently if this fails the fstst was not returning a failure. Fix those for given filesystems (for now added ext4/xfs). There were some regressions which went unnoticed due to this in ext4 tree, which later got fixed as part of this patch [1] [1]: https://patchwork.ozlabs.org/patch/1357275 Signed-off-by: Ritesh Harjani Reviewed-by: Darrick J. Wong --- v2 -> v3: 1. Removed whitelisted naming convention. tests/generic/496 | 16 +++++++++++++--- tests/generic/group | 2 +- 2 files changed, 14 insertions(+), 4 deletions(-) -- 2.26.2 diff --git a/tests/generic/496 b/tests/generic/496 index 805c6ac1c0ea..1bfd16411b8a 100755 --- a/tests/generic/496 +++ b/tests/generic/496 @@ -5,7 +5,7 @@ # FS QA Test No. 496 # # Test various swapfile activation oddities on filesystems that support -# fallocated swapfiles. +# fallocated swapfiles (for given fs ext4/xfs) # seq=`basename $0` seqres=$RESULT_DIR/$seq @@ -61,8 +61,18 @@ touch $swapfile $CHATTR_PROG +C $swapfile >> $seqres.full 2>&1 $XFS_IO_PROG -f -c "falloc 0 $len" $swapfile >> $seqres.full "$here/src/mkswap" $swapfile -"$here/src/swapon" $swapfile >> $seqres.full 2>&1 || \ - _notrun "fallocated swap not supported here" + +# ext4/xfs should not fail for swapon on fallocated files +case $FSTYP in +ext4|xfs) + "$here/src/swapon" $swapfile >> $seqres.full 2>&1 || \ + _fail "swapon failed on fallocated file" + ;; +*) + "$here/src/swapon" $swapfile >> $seqres.full 2>&1 || \ + _notrun "fallocated swap not supported here" + ;; +esac swapoff $swapfile # Create a fallocated swap file and touch every other $PAGE_SIZE to create diff --git a/tests/generic/group b/tests/generic/group index fec35d8e7b12..30a73605610d 100644 --- a/tests/generic/group +++ b/tests/generic/group @@ -498,7 +498,7 @@ 493 auto quick swap dedupe 494 auto quick swap punch 495 auto quick swap -496 auto quick swap +496 auto quick swap prealloc 497 auto quick swap collapse 498 auto quick log 499 auto quick rw collapse zero