diff mbox series

[3/3] Use --yes option to lvcreate

Message ID 20210427164419.3729180-4-kent.overstreet@gmail.com (mailing list archive)
State New, archived
Headers show
Series bcachefs support | expand

Commit Message

Kent Overstreet April 27, 2021, 4:44 p.m. UTC
This fixes spurious test failures caused by broken pipe messages.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
---
 tests/generic/081 | 2 +-
 tests/generic/108 | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Eryu Guan April 27, 2021, 5:03 p.m. UTC | #1
On Tue, Apr 27, 2021 at 12:44:19PM -0400, Kent Overstreet wrote:
> This fixes spurious test failures caused by broken pipe messages.
> 
> Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
> ---
>  tests/generic/081 | 2 +-
>  tests/generic/108 | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/generic/081 b/tests/generic/081
> index 5dff079852..26702007ab 100755
> --- a/tests/generic/081
> +++ b/tests/generic/081
> @@ -70,7 +70,7 @@ _scratch_mkfs_sized $((300 * 1024 * 1024)) >>$seqres.full 2>&1
>  $LVM_PROG vgcreate -f $vgname $SCRATCH_DEV >>$seqres.full 2>&1
>  # We use yes pipe instead of 'lvcreate --yes' because old version of lvm
>  # (like 2.02.95 in RHEL6) don't support --yes option
> -yes | $LVM_PROG lvcreate -L 256M -n $lvname $vgname >>$seqres.full 2>&1
> +$LVM_PROG lvcreate --yes -L 256M -n $lvname $vgname >>$seqres.full 2>&1

Please see above comments, we use yes pipe intentionally. I don't see
how this would result in broken pipe. Would you please provide more
details? And let's see if we could fix the broken pipe issue.

Thanks,
Eryu

>  # wait for lvcreation to fully complete
>  $UDEV_SETTLE_PROG >>$seqres.full 2>&1
>  
> diff --git a/tests/generic/108 b/tests/generic/108
> index 6fb194f43c..74945fdf3c 100755
> --- a/tests/generic/108
> +++ b/tests/generic/108
> @@ -56,7 +56,7 @@ $LVM_PROG pvcreate -f $SCSI_DEBUG_DEV $SCRATCH_DEV >>$seqres.full 2>&1
>  $LVM_PROG vgcreate -f $vgname $SCSI_DEBUG_DEV $SCRATCH_DEV >>$seqres.full 2>&1
>  # We use yes pipe instead of 'lvcreate --yes' because old version of lvm
>  # (like 2.02.95 in RHEL6) don't support --yes option
> -yes | $LVM_PROG lvcreate -i 2 -I 4m -L 275m -n $lvname $vgname \
> +$LVM_PROG lvcreate --yes -i 2 -I 4m -L 275m -n $lvname $vgname \
>  	>>$seqres.full 2>&1
>  # wait for lv creation to fully complete
>  $UDEV_SETTLE_PROG >>$seqres.full 2>&1
> -- 
> 2.31.1
Kent Overstreet April 27, 2021, 8:29 p.m. UTC | #2
On Wed, Apr 28, 2021 at 01:03:39AM +0800, Eryu Guan wrote:
> On Tue, Apr 27, 2021 at 12:44:19PM -0400, Kent Overstreet wrote:
> > This fixes spurious test failures caused by broken pipe messages.
> > 
> > Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
> > ---
> >  tests/generic/081 | 2 +-
> >  tests/generic/108 | 2 +-
> >  2 files changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/tests/generic/081 b/tests/generic/081
> > index 5dff079852..26702007ab 100755
> > --- a/tests/generic/081
> > +++ b/tests/generic/081
> > @@ -70,7 +70,7 @@ _scratch_mkfs_sized $((300 * 1024 * 1024)) >>$seqres.full 2>&1
> >  $LVM_PROG vgcreate -f $vgname $SCRATCH_DEV >>$seqres.full 2>&1
> >  # We use yes pipe instead of 'lvcreate --yes' because old version of lvm
> >  # (like 2.02.95 in RHEL6) don't support --yes option
> > -yes | $LVM_PROG lvcreate -L 256M -n $lvname $vgname >>$seqres.full 2>&1
> > +$LVM_PROG lvcreate --yes -L 256M -n $lvname $vgname >>$seqres.full 2>&1
> 
> Please see above comments, we use yes pipe intentionally. I don't see
> how this would result in broken pipe. Would you please provide more
> details? And let's see if we could fix the broken pipe issue.

If lvcreate never ask y/n - never reads from standard input, then echo sees a
broken pipe when it tries to write. That's what I get without this patch.
Matthew Wilcox April 27, 2021, 8:43 p.m. UTC | #3
On Tue, Apr 27, 2021 at 04:29:23PM -0400, Kent Overstreet wrote:
> On Wed, Apr 28, 2021 at 01:03:39AM +0800, Eryu Guan wrote:
> > On Tue, Apr 27, 2021 at 12:44:19PM -0400, Kent Overstreet wrote:
> > > This fixes spurious test failures caused by broken pipe messages.
> > > 
> > > Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
> > > ---
> > >  tests/generic/081 | 2 +-
> > >  tests/generic/108 | 2 +-
> > >  2 files changed, 2 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/tests/generic/081 b/tests/generic/081
> > > index 5dff079852..26702007ab 100755
> > > --- a/tests/generic/081
> > > +++ b/tests/generic/081
> > > @@ -70,7 +70,7 @@ _scratch_mkfs_sized $((300 * 1024 * 1024)) >>$seqres.full 2>&1
> > >  $LVM_PROG vgcreate -f $vgname $SCRATCH_DEV >>$seqres.full 2>&1
> > >  # We use yes pipe instead of 'lvcreate --yes' because old version of lvm
> > >  # (like 2.02.95 in RHEL6) don't support --yes option
> > > -yes | $LVM_PROG lvcreate -L 256M -n $lvname $vgname >>$seqres.full 2>&1
> > > +$LVM_PROG lvcreate --yes -L 256M -n $lvname $vgname >>$seqres.full 2>&1
> > 
> > Please see above comments, we use yes pipe intentionally. I don't see
> > how this would result in broken pipe. Would you please provide more
> > details? And let's see if we could fix the broken pipe issue.
> 
> If lvcreate never ask y/n - never reads from standard input, then echo sees a
> broken pipe when it tries to write. That's what I get without this patch.

I think it's something in how ktest sets up the environment.  I also see
the SIGPIPEs when using your ktest scripts, but not when ssh'ing into
the guest and running the test.

What that thing is, I don't know.  I'm not tall enough to understand
signal handling.
Eric Biggers April 27, 2021, 9:02 p.m. UTC | #4
On Tue, Apr 27, 2021 at 09:43:19PM +0100, Matthew Wilcox wrote:
> On Tue, Apr 27, 2021 at 04:29:23PM -0400, Kent Overstreet wrote:
> > On Wed, Apr 28, 2021 at 01:03:39AM +0800, Eryu Guan wrote:
> > > On Tue, Apr 27, 2021 at 12:44:19PM -0400, Kent Overstreet wrote:
> > > > This fixes spurious test failures caused by broken pipe messages.
> > > > 
> > > > Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
> > > > ---
> > > >  tests/generic/081 | 2 +-
> > > >  tests/generic/108 | 2 +-
> > > >  2 files changed, 2 insertions(+), 2 deletions(-)
> > > > 
> > > > diff --git a/tests/generic/081 b/tests/generic/081
> > > > index 5dff079852..26702007ab 100755
> > > > --- a/tests/generic/081
> > > > +++ b/tests/generic/081
> > > > @@ -70,7 +70,7 @@ _scratch_mkfs_sized $((300 * 1024 * 1024)) >>$seqres.full 2>&1
> > > >  $LVM_PROG vgcreate -f $vgname $SCRATCH_DEV >>$seqres.full 2>&1
> > > >  # We use yes pipe instead of 'lvcreate --yes' because old version of lvm
> > > >  # (like 2.02.95 in RHEL6) don't support --yes option
> > > > -yes | $LVM_PROG lvcreate -L 256M -n $lvname $vgname >>$seqres.full 2>&1
> > > > +$LVM_PROG lvcreate --yes -L 256M -n $lvname $vgname >>$seqres.full 2>&1
> > > 
> > > Please see above comments, we use yes pipe intentionally. I don't see
> > > how this would result in broken pipe. Would you please provide more
> > > details? And let's see if we could fix the broken pipe issue.
> > 
> > If lvcreate never ask y/n - never reads from standard input, then echo sees a
> > broken pipe when it tries to write. That's what I get without this patch.
> 
> I think it's something in how ktest sets up the environment.  I also see
> the SIGPIPEs when using your ktest scripts, but not when ssh'ing into
> the guest and running the test.
> 
> What that thing is, I don't know.  I'm not tall enough to understand
> signal handling.

See xfstests commit 9bcb266cd778 ("generic/397: be compatible with ignored
SIGPIPE") for an example of the same problem being fixed in another test, with
some more explanation.

But it's better to just not execute xfstests (or any shell script, for that
matter) in an environment where SIGPIPE is ignored.

- Eric
Kent Overstreet April 27, 2021, 9:18 p.m. UTC | #5
On Tue, Apr 27, 2021 at 02:02:15PM -0700, Eric Biggers wrote:
> On Tue, Apr 27, 2021 at 09:43:19PM +0100, Matthew Wilcox wrote:
> > On Tue, Apr 27, 2021 at 04:29:23PM -0400, Kent Overstreet wrote:
> > > On Wed, Apr 28, 2021 at 01:03:39AM +0800, Eryu Guan wrote:
> > > > On Tue, Apr 27, 2021 at 12:44:19PM -0400, Kent Overstreet wrote:
> > > > > This fixes spurious test failures caused by broken pipe messages.
> > > > > 
> > > > > Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
> > > > > ---
> > > > >  tests/generic/081 | 2 +-
> > > > >  tests/generic/108 | 2 +-
> > > > >  2 files changed, 2 insertions(+), 2 deletions(-)
> > > > > 
> > > > > diff --git a/tests/generic/081 b/tests/generic/081
> > > > > index 5dff079852..26702007ab 100755
> > > > > --- a/tests/generic/081
> > > > > +++ b/tests/generic/081
> > > > > @@ -70,7 +70,7 @@ _scratch_mkfs_sized $((300 * 1024 * 1024)) >>$seqres.full 2>&1
> > > > >  $LVM_PROG vgcreate -f $vgname $SCRATCH_DEV >>$seqres.full 2>&1
> > > > >  # We use yes pipe instead of 'lvcreate --yes' because old version of lvm
> > > > >  # (like 2.02.95 in RHEL6) don't support --yes option
> > > > > -yes | $LVM_PROG lvcreate -L 256M -n $lvname $vgname >>$seqres.full 2>&1
> > > > > +$LVM_PROG lvcreate --yes -L 256M -n $lvname $vgname >>$seqres.full 2>&1
> > > > 
> > > > Please see above comments, we use yes pipe intentionally. I don't see
> > > > how this would result in broken pipe. Would you please provide more
> > > > details? And let's see if we could fix the broken pipe issue.
> > > 
> > > If lvcreate never ask y/n - never reads from standard input, then echo sees a
> > > broken pipe when it tries to write. That's what I get without this patch.
> > 
> > I think it's something in how ktest sets up the environment.  I also see
> > the SIGPIPEs when using your ktest scripts, but not when ssh'ing into
> > the guest and running the test.
> > 
> > What that thing is, I don't know.  I'm not tall enough to understand
> > signal handling.
> 
> See xfstests commit 9bcb266cd778 ("generic/397: be compatible with ignored
> SIGPIPE") for an example of the same problem being fixed in another test, with
> some more explanation.
> 
> But it's better to just not execute xfstests (or any shell script, for that
> matter) in an environment where SIGPIPE is ignored.

Ah, thanks for the info. I'll see if I can figure out what's mucking with the
signal handler (probably systemd...)
diff mbox series

Patch

diff --git a/tests/generic/081 b/tests/generic/081
index 5dff079852..26702007ab 100755
--- a/tests/generic/081
+++ b/tests/generic/081
@@ -70,7 +70,7 @@  _scratch_mkfs_sized $((300 * 1024 * 1024)) >>$seqres.full 2>&1
 $LVM_PROG vgcreate -f $vgname $SCRATCH_DEV >>$seqres.full 2>&1
 # We use yes pipe instead of 'lvcreate --yes' because old version of lvm
 # (like 2.02.95 in RHEL6) don't support --yes option
-yes | $LVM_PROG lvcreate -L 256M -n $lvname $vgname >>$seqres.full 2>&1
+$LVM_PROG lvcreate --yes -L 256M -n $lvname $vgname >>$seqres.full 2>&1
 # wait for lvcreation to fully complete
 $UDEV_SETTLE_PROG >>$seqres.full 2>&1
 
diff --git a/tests/generic/108 b/tests/generic/108
index 6fb194f43c..74945fdf3c 100755
--- a/tests/generic/108
+++ b/tests/generic/108
@@ -56,7 +56,7 @@  $LVM_PROG pvcreate -f $SCSI_DEBUG_DEV $SCRATCH_DEV >>$seqres.full 2>&1
 $LVM_PROG vgcreate -f $vgname $SCSI_DEBUG_DEV $SCRATCH_DEV >>$seqres.full 2>&1
 # We use yes pipe instead of 'lvcreate --yes' because old version of lvm
 # (like 2.02.95 in RHEL6) don't support --yes option
-yes | $LVM_PROG lvcreate -i 2 -I 4m -L 275m -n $lvname $vgname \
+$LVM_PROG lvcreate --yes -i 2 -I 4m -L 275m -n $lvname $vgname \
 	>>$seqres.full 2>&1
 # wait for lv creation to fully complete
 $UDEV_SETTLE_PROG >>$seqres.full 2>&1