From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Eryu Guan <guan@eryu.me>
Cc: Ritesh Harjani <riteshh@linux.ibm.com>,
fstests@vger.kernel.org, linux-ext4@vger.kernel.org,
linux-xfs@vger.kernel.org, anju@linux.vnet.ibm.com
Subject: Re: [PATCHv2 1/2] common/rc: Add whitelisted FS support in _require_scratch_swapfile()
Date: Mon, 4 Jan 2021 10:25:45 -0800 [thread overview]
Message-ID: <20210104182545.GF6908@magnolia> (raw)
In-Reply-To: <20201220153906.GC3853@desktop>
On Sun, Dec 20, 2020 at 11:39:06PM +0800, Eryu Guan wrote:
> On Wed, Dec 16, 2020 at 10:53:45AM +0530, Ritesh Harjani wrote:
> >
> >
> > On 12/16/20 10:47 AM, Ritesh Harjani wrote:
> > > Filesystems e.g. ext4 and XFS supports swapon by default and an error
> > > returned with swapon should be treated as a failure. Hence
> > > add ext4/xfs as whitelisted fstype in _require_scratch_swapfile()
> > >
> > > Signed-off-by: Ritesh Harjani <riteshh@linux.ibm.com>
> > > ---
> > > v1->v2: Addressed comments from Eryu @[1]
> > > [1]: https://patchwork.kernel.org/project/fstests/cover/cover.1604000570.git.riteshh@linux.ibm.com/
> > >
> > > common/rc | 20 ++++++++++++++++----
> > > 1 file changed, 16 insertions(+), 4 deletions(-)
> > >
> > > diff --git a/common/rc b/common/rc
> > > index 33b5b598a198..635b77a005c6 100644
> > > --- a/common/rc
> > > +++ b/common/rc
> > > @@ -2380,6 +2380,7 @@ _format_swapfile() {
> > > # Check that the filesystem supports swapfiles
> > > _require_scratch_swapfile()
> > > {
> > > + local fstyp=$FSTYP
> > > _require_scratch
> > > _require_command "$MKSWAP_PROG" "mkswap"
> > >
> > > @@ -2401,10 +2402,21 @@ _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
> > > + # For whitelisted fstyp swapon should not fail.
I would use a different phase than 'whitelisted', since that doesn't
tell us why ext4 and xfs are special:
# ext* and xfs have supported all variants of swap files since their
# introduction, so swapon should not fail.
> > > + case "$fstyp" in
$FSTYP, not $fstyp
> > > + ext4|xfs)
I would also add a few more FSTYPs here, since at least ext2 and ext3
supported swap files. Are there other old fses that do?
--D
> > > + if ! swapon "$SCRATCH_MNT/swap" >/dev/null 2>&1; then
> > > + _scratch_unmount
> > > + _fail "swapon failed for $fstyp"
> >
> > @Eryu,
> > As of now I added _fail() if swapon failed for given whitelisting fstype.
> > Do you think this is alright, or should I just ignore the error in
>
> I think it's reasonable.
>
> But I'd like to leave the patchset on the list for review for another
> week, to see if ext4 and/or xfs folks will chime in and have different
> thoughts.
>
> Thanks,
> Eryu
>
> > case of such FS?
> >
> >
> >
> > > + 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
> > > --
> > > 2.26.2
> > >
next prev parent reply other threads:[~2021-01-04 18:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-16 5:17 [PATCHv2 1/2] common/rc: Add whitelisted FS support in _require_scratch_swapfile() Ritesh Harjani
2020-12-16 5:17 ` [PATCHv2 2/2] generic/496: Add whitelisted FS support for swapon test Ritesh Harjani
2020-12-16 5:23 ` [PATCHv2 1/2] common/rc: Add whitelisted FS support in _require_scratch_swapfile() Ritesh Harjani
2020-12-20 15:39 ` Eryu Guan
2021-01-04 18:25 ` Darrick J. Wong [this message]
2021-01-05 11:00 ` Ritesh Harjani
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210104182545.GF6908@magnolia \
--to=darrick.wong@oracle.com \
--cc=anju@linux.vnet.ibm.com \
--cc=fstests@vger.kernel.org \
--cc=guan@eryu.me \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=riteshh@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).