linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] xfs_admin: unify online/offline fs label setting
@ 2020-02-05  0:02 Darrick J. Wong
  2020-02-05  0:02 ` [PATCH 1/2] xfs: refactor calls to xfs_admin Darrick J. Wong
  2020-02-05  0:02 ` [PATCH 2/2] xfs: test setting labels with xfs_admin Darrick J. Wong
  0 siblings, 2 replies; 9+ messages in thread
From: Darrick J. Wong @ 2020-02-05  0:02 UTC (permalink / raw)
  To: guaneryu, darrick.wong; +Cc: linux-xfs, fstests

Hi all,

Unify the online and offline label setting code paths in xfs_admin so
that one program can handle both.

If you're going to start using this mess, you probably ought to just
pull from my git trees, which are linked below.

This is an extraordinary way to destroy everything.  Enjoy!
Comments and questions are, as always, welcome.

--D

fstests git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfstests-dev.git/log/?h=online-label-setting

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/2] xfs: refactor calls to xfs_admin
  2020-02-05  0:02 [PATCH 0/2] xfs_admin: unify online/offline fs label setting Darrick J. Wong
@ 2020-02-05  0:02 ` Darrick J. Wong
  2020-02-05  6:35   ` Amir Goldstein
  2020-02-05  0:02 ` [PATCH 2/2] xfs: test setting labels with xfs_admin Darrick J. Wong
  1 sibling, 1 reply; 9+ messages in thread
From: Darrick J. Wong @ 2020-02-05  0:02 UTC (permalink / raw)
  To: guaneryu, darrick.wong; +Cc: linux-xfs, fstests

From: Darrick J. Wong <darrick.wong@oracle.com>

Create a helper to run xfs_admin on the scratch device, then refactor
all tests to use it.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 common/config |    1 +
 common/xfs    |    8 ++++++++
 tests/xfs/287 |    2 +-
 3 files changed, 10 insertions(+), 1 deletion(-)


diff --git a/common/config b/common/config
index 9a9c7760..1116cb99 100644
--- a/common/config
+++ b/common/config
@@ -154,6 +154,7 @@ MKSWAP_PROG="$MKSWAP_PROG -f"
 export XFS_LOGPRINT_PROG="$(type -P xfs_logprint)"
 export XFS_REPAIR_PROG="$(type -P xfs_repair)"
 export XFS_DB_PROG="$(type -P xfs_db)"
+export XFS_ADMIN_PROG="$(type -P xfs_admin)"
 export XFS_GROWFS_PROG=$(type -P xfs_growfs)
 export XFS_SPACEMAN_PROG="$(type -P xfs_spaceman)"
 export XFS_SCRUB_PROG="$(type -P xfs_scrub)"
diff --git a/common/xfs b/common/xfs
index 706ddf85..d9a9784f 100644
--- a/common/xfs
+++ b/common/xfs
@@ -218,6 +218,14 @@ _scratch_xfs_db()
 	$XFS_DB_PROG "$@" $(_scratch_xfs_db_options)
 }
 
+_scratch_xfs_admin()
+{
+	local options=("$SCRATCH_DEV")
+	[ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \
+		options+=("$SCRATCH_LOGDEV")
+	$XFS_ADMIN_PROG "$@" "${options[@]}"
+}
+
 _scratch_xfs_logprint()
 {
 	SCRATCH_OPTIONS=""
diff --git a/tests/xfs/287 b/tests/xfs/287
index 8dc754a5..f77ed2f1 100755
--- a/tests/xfs/287
+++ b/tests/xfs/287
@@ -70,7 +70,7 @@ $XFS_IO_PROG -r -c "lsproj" $dir/32bit
 _scratch_unmount
 
 # Now, enable projid32bit support by xfs_admin
-xfs_admin -p $SCRATCH_DEV >> $seqres.full 2>&1 || _fail "xfs_admin failed"
+_scratch_xfs_admin -p >> $seqres.full 2>&1 || _fail "xfs_admin failed"
 
 # Now mount the fs, 32bit project quotas shall be supported, now
 _qmount_option "pquota"


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/2] xfs: test setting labels with xfs_admin
  2020-02-05  0:02 [PATCH 0/2] xfs_admin: unify online/offline fs label setting Darrick J. Wong
  2020-02-05  0:02 ` [PATCH 1/2] xfs: refactor calls to xfs_admin Darrick J. Wong
@ 2020-02-05  0:02 ` Darrick J. Wong
  2020-02-05  6:40   ` Amir Goldstein
  1 sibling, 1 reply; 9+ messages in thread
From: Darrick J. Wong @ 2020-02-05  0:02 UTC (permalink / raw)
  To: guaneryu, darrick.wong; +Cc: linux-xfs, fstests

From: Darrick J. Wong <darrick.wong@oracle.com>

Test setting filesystem labels with xfs_admin.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/xfs/912     |  103 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/912.out |   43 ++++++++++++++++++++++
 tests/xfs/group   |    1 +
 3 files changed, 147 insertions(+)
 create mode 100755 tests/xfs/912
 create mode 100644 tests/xfs/912.out


diff --git a/tests/xfs/912 b/tests/xfs/912
new file mode 100755
index 00000000..1eef36cd
--- /dev/null
+++ b/tests/xfs/912
@@ -0,0 +1,103 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2020, Oracle and/or its affiliates.  All Rights Reserved.
+#
+# FS QA Test No. 912
+#
+# Check that xfs_admin can set and clear filesystem labels offline and online.
+
+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 15
+
+_cleanup()
+{
+	cd /
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+
+# real QA test starts here
+_supported_fs xfs
+_supported_os Linux
+_require_scratch
+_require_xfs_db_command label
+_require_xfs_io_command label
+grep -q "xfs_io" "$(which xfs_admin)" || \
+	_notrun "xfs_admin does not support online label setting of any kind"
+
+rm -f $seqres.full
+
+echo
+echo "Format with label"
+_scratch_mkfs -L "label0" > $seqres.full
+
+echo "Read label offline"
+_scratch_xfs_admin -l
+
+echo "Read label online"
+_scratch_mount
+_scratch_xfs_admin -l
+
+echo
+echo "Set label offline"
+_scratch_unmount
+_scratch_xfs_admin -L "label1"
+
+echo "Read label offline"
+_scratch_xfs_admin -l
+
+echo "Read label online"
+_scratch_mount
+_scratch_xfs_admin -l
+
+echo
+echo "Set label online"
+_scratch_xfs_admin -L "label2"
+
+echo "Read label online"
+_scratch_xfs_admin -l
+
+echo "Read label offline"
+_scratch_unmount
+_scratch_xfs_admin -l
+
+echo
+echo "Clear label online"
+_scratch_mount
+_scratch_xfs_admin -L "--"
+
+echo "Read label online"
+_scratch_xfs_admin -l
+
+echo "Read label offline"
+_scratch_unmount
+_scratch_xfs_admin -l
+
+echo
+echo "Set label offline"
+_scratch_xfs_admin -L "label3"
+
+echo "Read label offline"
+_scratch_xfs_admin -l
+
+echo
+echo "Clear label offline"
+_scratch_xfs_admin -L "--"
+
+echo "Read label offline"
+_scratch_xfs_admin -l
+
+echo "Read label online"
+_scratch_mount
+_scratch_xfs_admin -l
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/912.out b/tests/xfs/912.out
new file mode 100644
index 00000000..186d827f
--- /dev/null
+++ b/tests/xfs/912.out
@@ -0,0 +1,43 @@
+QA output created by 912
+
+Format with label
+Read label offline
+label = "label0"
+Read label online
+label = "label0"
+
+Set label offline
+writing all SBs
+new label = "label1"
+Read label offline
+label = "label1"
+Read label online
+label = "label1"
+
+Set label online
+label = "label2"
+Read label online
+label = "label2"
+Read label offline
+label = "label2"
+
+Clear label online
+label = ""
+Read label online
+label = ""
+Read label offline
+label = ""
+
+Set label offline
+writing all SBs
+new label = "label3"
+Read label offline
+label = "label3"
+
+Clear label offline
+writing all SBs
+new label = ""
+Read label offline
+label = ""
+Read label online
+label = ""
diff --git a/tests/xfs/group b/tests/xfs/group
index edffef9a..898bd9e4 100644
--- a/tests/xfs/group
+++ b/tests/xfs/group
@@ -512,3 +512,4 @@
 512 auto quick acl attr
 747 auto quick scrub
 748 auto quick scrub
+912 auto quick label


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/2] xfs: refactor calls to xfs_admin
  2020-02-05  0:02 ` [PATCH 1/2] xfs: refactor calls to xfs_admin Darrick J. Wong
@ 2020-02-05  6:35   ` Amir Goldstein
  2020-02-05 16:23     ` Darrick J. Wong
  0 siblings, 1 reply; 9+ messages in thread
From: Amir Goldstein @ 2020-02-05  6:35 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: Eryu Guan, linux-xfs, fstests

On Wed, Feb 5, 2020 at 2:02 AM Darrick J. Wong <darrick.wong@oracle.com> wrote:
>
> From: Darrick J. Wong <darrick.wong@oracle.com>
>
> Create a helper to run xfs_admin on the scratch device, then refactor
> all tests to use it.

all tests... heh overstatement :)

Maybe say something about how logdev is needed as argument and
supported only since recent v5.4 xfsprogs.
Does older xfsprogs cope well with the extra argument?

Thanks,
Amir.

>
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
>  common/config |    1 +
>  common/xfs    |    8 ++++++++
>  tests/xfs/287 |    2 +-
>  3 files changed, 10 insertions(+), 1 deletion(-)
>
>
> diff --git a/common/config b/common/config
> index 9a9c7760..1116cb99 100644
> --- a/common/config
> +++ b/common/config
> @@ -154,6 +154,7 @@ MKSWAP_PROG="$MKSWAP_PROG -f"
>  export XFS_LOGPRINT_PROG="$(type -P xfs_logprint)"
>  export XFS_REPAIR_PROG="$(type -P xfs_repair)"
>  export XFS_DB_PROG="$(type -P xfs_db)"
> +export XFS_ADMIN_PROG="$(type -P xfs_admin)"
>  export XFS_GROWFS_PROG=$(type -P xfs_growfs)
>  export XFS_SPACEMAN_PROG="$(type -P xfs_spaceman)"
>  export XFS_SCRUB_PROG="$(type -P xfs_scrub)"
> diff --git a/common/xfs b/common/xfs
> index 706ddf85..d9a9784f 100644
> --- a/common/xfs
> +++ b/common/xfs
> @@ -218,6 +218,14 @@ _scratch_xfs_db()
>         $XFS_DB_PROG "$@" $(_scratch_xfs_db_options)
>  }
>
> +_scratch_xfs_admin()
> +{
> +       local options=("$SCRATCH_DEV")
> +       [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \
> +               options+=("$SCRATCH_LOGDEV")
> +       $XFS_ADMIN_PROG "$@" "${options[@]}"
> +}
> +
>  _scratch_xfs_logprint()
>  {
>         SCRATCH_OPTIONS=""
> diff --git a/tests/xfs/287 b/tests/xfs/287
> index 8dc754a5..f77ed2f1 100755
> --- a/tests/xfs/287
> +++ b/tests/xfs/287
> @@ -70,7 +70,7 @@ $XFS_IO_PROG -r -c "lsproj" $dir/32bit
>  _scratch_unmount
>
>  # Now, enable projid32bit support by xfs_admin
> -xfs_admin -p $SCRATCH_DEV >> $seqres.full 2>&1 || _fail "xfs_admin failed"
> +_scratch_xfs_admin -p >> $seqres.full 2>&1 || _fail "xfs_admin failed"
>
>  # Now mount the fs, 32bit project quotas shall be supported, now
>  _qmount_option "pquota"
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] xfs: test setting labels with xfs_admin
  2020-02-05  0:02 ` [PATCH 2/2] xfs: test setting labels with xfs_admin Darrick J. Wong
@ 2020-02-05  6:40   ` Amir Goldstein
  2020-02-06 17:53     ` Darrick J. Wong
  0 siblings, 1 reply; 9+ messages in thread
From: Amir Goldstein @ 2020-02-05  6:40 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: Eryu Guan, linux-xfs, fstests

On Wed, Feb 5, 2020 at 2:02 AM Darrick J. Wong <darrick.wong@oracle.com> wrote:
>
> From: Darrick J. Wong <darrick.wong@oracle.com>
>
> Test setting filesystem labels with xfs_admin.
>
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
>  tests/xfs/912     |  103 +++++++++++++++++++++++++++++++++++++++++++++++++++++
>  tests/xfs/912.out |   43 ++++++++++++++++++++++
>  tests/xfs/group   |    1 +
>  3 files changed, 147 insertions(+)
>  create mode 100755 tests/xfs/912
>  create mode 100644 tests/xfs/912.out
>
>
> diff --git a/tests/xfs/912 b/tests/xfs/912
> new file mode 100755
> index 00000000..1eef36cd
> --- /dev/null
> +++ b/tests/xfs/912
> @@ -0,0 +1,103 @@
> +#! /bin/bash
> +# SPDX-License-Identifier: GPL-2.0-or-later
> +# Copyright (c) 2020, Oracle and/or its affiliates.  All Rights Reserved.
> +#
> +# FS QA Test No. 912
> +#
> +# Check that xfs_admin can set and clear filesystem labels offline and online.
> +
> +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 15
> +
> +_cleanup()
> +{
> +       cd /

odd cleanup.
I think the standard rm tmp files is needed for in-case common
helpers generate tmp files.

> +}
> +
> +# get standard environment, filters and checks
> +. ./common/rc
> +
> +# real QA test starts here
> +_supported_fs xfs
> +_supported_os Linux
> +_require_scratch
> +_require_xfs_db_command label
> +_require_xfs_io_command label
> +grep -q "xfs_io" "$(which xfs_admin)" || \
> +       _notrun "xfs_admin does not support online label setting of any kind"

odd test. If it cannot be prettier than than perhaps hide this inside
a _require helper?

> +
> +rm -f $seqres.full
> +
> +echo
> +echo "Format with label"
> +_scratch_mkfs -L "label0" > $seqres.full
> +
> +echo "Read label offline"
> +_scratch_xfs_admin -l
> +
> +echo "Read label online"
> +_scratch_mount
> +_scratch_xfs_admin -l
> +
> +echo
> +echo "Set label offline"
> +_scratch_unmount
> +_scratch_xfs_admin -L "label1"
> +
> +echo "Read label offline"
> +_scratch_xfs_admin -l
> +
> +echo "Read label online"
> +_scratch_mount
> +_scratch_xfs_admin -l
> +
> +echo
> +echo "Set label online"
> +_scratch_xfs_admin -L "label2"
> +
> +echo "Read label online"
> +_scratch_xfs_admin -l
> +
> +echo "Read label offline"
> +_scratch_unmount
> +_scratch_xfs_admin -l
> +
> +echo
> +echo "Clear label online"
> +_scratch_mount
> +_scratch_xfs_admin -L "--"
> +
> +echo "Read label online"
> +_scratch_xfs_admin -l
> +
> +echo "Read label offline"
> +_scratch_unmount
> +_scratch_xfs_admin -l
> +
> +echo
> +echo "Set label offline"
> +_scratch_xfs_admin -L "label3"
> +
> +echo "Read label offline"
> +_scratch_xfs_admin -l
> +
> +echo
> +echo "Clear label offline"
> +_scratch_xfs_admin -L "--"
> +
> +echo "Read label offline"
> +_scratch_xfs_admin -l
> +
> +echo "Read label online"
> +_scratch_mount
> +_scratch_xfs_admin -l
> +
> +# success, all done
> +status=0
> +exit
> diff --git a/tests/xfs/912.out b/tests/xfs/912.out
> new file mode 100644
> index 00000000..186d827f
> --- /dev/null
> +++ b/tests/xfs/912.out
> @@ -0,0 +1,43 @@
> +QA output created by 912
> +
> +Format with label
> +Read label offline
> +label = "label0"
> +Read label online
> +label = "label0"
> +
> +Set label offline
> +writing all SBs
> +new label = "label1"
> +Read label offline
> +label = "label1"
> +Read label online
> +label = "label1"
> +
> +Set label online
> +label = "label2"
> +Read label online
> +label = "label2"
> +Read label offline
> +label = "label2"
> +
> +Clear label online
> +label = ""
> +Read label online
> +label = ""
> +Read label offline
> +label = ""
> +
> +Set label offline
> +writing all SBs
> +new label = "label3"
> +Read label offline
> +label = "label3"
> +
> +Clear label offline
> +writing all SBs
> +new label = ""
> +Read label offline
> +label = ""
> +Read label online
> +label = ""
> diff --git a/tests/xfs/group b/tests/xfs/group
> index edffef9a..898bd9e4 100644
> --- a/tests/xfs/group
> +++ b/tests/xfs/group
> @@ -512,3 +512,4 @@
>  512 auto quick acl attr
>  747 auto quick scrub
>  748 auto quick scrub
> +912 auto quick label
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/2] xfs: refactor calls to xfs_admin
  2020-02-05  6:35   ` Amir Goldstein
@ 2020-02-05 16:23     ` Darrick J. Wong
  0 siblings, 0 replies; 9+ messages in thread
From: Darrick J. Wong @ 2020-02-05 16:23 UTC (permalink / raw)
  To: Amir Goldstein; +Cc: Eryu Guan, linux-xfs, fstests

On Wed, Feb 05, 2020 at 08:35:05AM +0200, Amir Goldstein wrote:
> On Wed, Feb 5, 2020 at 2:02 AM Darrick J. Wong <darrick.wong@oracle.com> wrote:
> >
> > From: Darrick J. Wong <darrick.wong@oracle.com>
> >
> > Create a helper to run xfs_admin on the scratch device, then refactor
> > all tests to use it.
> 
> all tests... heh overstatement :)

"all tests that use xfs_admin"?

> Maybe say something about how logdev is needed as argument and
> supported only since recent v5.4 xfsprogs.
> Does older xfsprogs cope well with the extra argument?

Prior to 5.4, xfs_admin will reject the logdev argument and exit; and
if you try to work around it by constructing the xfs_db command by hand,
xfs_db will reject the filesystem because the log device isn't
specified.

IOWs, prior to 5.4 it just plain didn't work at all.

--D

> Thanks,
> Amir.
> 
> >
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > ---
> >  common/config |    1 +
> >  common/xfs    |    8 ++++++++
> >  tests/xfs/287 |    2 +-
> >  3 files changed, 10 insertions(+), 1 deletion(-)
> >
> >
> > diff --git a/common/config b/common/config
> > index 9a9c7760..1116cb99 100644
> > --- a/common/config
> > +++ b/common/config
> > @@ -154,6 +154,7 @@ MKSWAP_PROG="$MKSWAP_PROG -f"
> >  export XFS_LOGPRINT_PROG="$(type -P xfs_logprint)"
> >  export XFS_REPAIR_PROG="$(type -P xfs_repair)"
> >  export XFS_DB_PROG="$(type -P xfs_db)"
> > +export XFS_ADMIN_PROG="$(type -P xfs_admin)"
> >  export XFS_GROWFS_PROG=$(type -P xfs_growfs)
> >  export XFS_SPACEMAN_PROG="$(type -P xfs_spaceman)"
> >  export XFS_SCRUB_PROG="$(type -P xfs_scrub)"
> > diff --git a/common/xfs b/common/xfs
> > index 706ddf85..d9a9784f 100644
> > --- a/common/xfs
> > +++ b/common/xfs
> > @@ -218,6 +218,14 @@ _scratch_xfs_db()
> >         $XFS_DB_PROG "$@" $(_scratch_xfs_db_options)
> >  }
> >
> > +_scratch_xfs_admin()
> > +{
> > +       local options=("$SCRATCH_DEV")
> > +       [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \
> > +               options+=("$SCRATCH_LOGDEV")
> > +       $XFS_ADMIN_PROG "$@" "${options[@]}"
> > +}
> > +
> >  _scratch_xfs_logprint()
> >  {
> >         SCRATCH_OPTIONS=""
> > diff --git a/tests/xfs/287 b/tests/xfs/287
> > index 8dc754a5..f77ed2f1 100755
> > --- a/tests/xfs/287
> > +++ b/tests/xfs/287
> > @@ -70,7 +70,7 @@ $XFS_IO_PROG -r -c "lsproj" $dir/32bit
> >  _scratch_unmount
> >
> >  # Now, enable projid32bit support by xfs_admin
> > -xfs_admin -p $SCRATCH_DEV >> $seqres.full 2>&1 || _fail "xfs_admin failed"
> > +_scratch_xfs_admin -p >> $seqres.full 2>&1 || _fail "xfs_admin failed"
> >
> >  # Now mount the fs, 32bit project quotas shall be supported, now
> >  _qmount_option "pquota"
> >

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] xfs: test setting labels with xfs_admin
  2020-02-05  6:40   ` Amir Goldstein
@ 2020-02-06 17:53     ` Darrick J. Wong
  0 siblings, 0 replies; 9+ messages in thread
From: Darrick J. Wong @ 2020-02-06 17:53 UTC (permalink / raw)
  To: Amir Goldstein; +Cc: Eryu Guan, linux-xfs, fstests

On Wed, Feb 05, 2020 at 08:40:35AM +0200, Amir Goldstein wrote:
> On Wed, Feb 5, 2020 at 2:02 AM Darrick J. Wong <darrick.wong@oracle.com> wrote:
> >
> > From: Darrick J. Wong <darrick.wong@oracle.com>
> >
> > Test setting filesystem labels with xfs_admin.
> >
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > ---
> >  tests/xfs/912     |  103 +++++++++++++++++++++++++++++++++++++++++++++++++++++
> >  tests/xfs/912.out |   43 ++++++++++++++++++++++
> >  tests/xfs/group   |    1 +
> >  3 files changed, 147 insertions(+)
> >  create mode 100755 tests/xfs/912
> >  create mode 100644 tests/xfs/912.out
> >
> >
> > diff --git a/tests/xfs/912 b/tests/xfs/912
> > new file mode 100755
> > index 00000000..1eef36cd
> > --- /dev/null
> > +++ b/tests/xfs/912
> > @@ -0,0 +1,103 @@
> > +#! /bin/bash
> > +# SPDX-License-Identifier: GPL-2.0-or-later
> > +# Copyright (c) 2020, Oracle and/or its affiliates.  All Rights Reserved.
> > +#
> > +# FS QA Test No. 912
> > +#
> > +# Check that xfs_admin can set and clear filesystem labels offline and online.
> > +
> > +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 15
> > +
> > +_cleanup()
> > +{
> > +       cd /
> 
> odd cleanup.
> I think the standard rm tmp files is needed for in-case common
> helpers generate tmp files.

Heh, ok, will add that.

> > +}
> > +
> > +# get standard environment, filters and checks
> > +. ./common/rc
> > +
> > +# real QA test starts here
> > +_supported_fs xfs
> > +_supported_os Linux
> > +_require_scratch
> > +_require_xfs_db_command label
> > +_require_xfs_io_command label
> > +grep -q "xfs_io" "$(which xfs_admin)" || \
> > +       _notrun "xfs_admin does not support online label setting of any kind"
> 
> odd test. If it cannot be prettier than than perhaps hide this inside
> a _require helper?

There's only one user of it so far, though I guess if I'm going to add
get/set fs uuid ioctls then maybe this should get refactored...

...assuming Eric doesn't just nuke xfs_admin online updates out of
existence entirely. :)

--D

> > +
> > +rm -f $seqres.full
> > +
> > +echo
> > +echo "Format with label"
> > +_scratch_mkfs -L "label0" > $seqres.full
> > +
> > +echo "Read label offline"
> > +_scratch_xfs_admin -l
> > +
> > +echo "Read label online"
> > +_scratch_mount
> > +_scratch_xfs_admin -l
> > +
> > +echo
> > +echo "Set label offline"
> > +_scratch_unmount
> > +_scratch_xfs_admin -L "label1"
> > +
> > +echo "Read label offline"
> > +_scratch_xfs_admin -l
> > +
> > +echo "Read label online"
> > +_scratch_mount
> > +_scratch_xfs_admin -l
> > +
> > +echo
> > +echo "Set label online"
> > +_scratch_xfs_admin -L "label2"
> > +
> > +echo "Read label online"
> > +_scratch_xfs_admin -l
> > +
> > +echo "Read label offline"
> > +_scratch_unmount
> > +_scratch_xfs_admin -l
> > +
> > +echo
> > +echo "Clear label online"
> > +_scratch_mount
> > +_scratch_xfs_admin -L "--"
> > +
> > +echo "Read label online"
> > +_scratch_xfs_admin -l
> > +
> > +echo "Read label offline"
> > +_scratch_unmount
> > +_scratch_xfs_admin -l
> > +
> > +echo
> > +echo "Set label offline"
> > +_scratch_xfs_admin -L "label3"
> > +
> > +echo "Read label offline"
> > +_scratch_xfs_admin -l
> > +
> > +echo
> > +echo "Clear label offline"
> > +_scratch_xfs_admin -L "--"
> > +
> > +echo "Read label offline"
> > +_scratch_xfs_admin -l
> > +
> > +echo "Read label online"
> > +_scratch_mount
> > +_scratch_xfs_admin -l
> > +
> > +# success, all done
> > +status=0
> > +exit
> > diff --git a/tests/xfs/912.out b/tests/xfs/912.out
> > new file mode 100644
> > index 00000000..186d827f
> > --- /dev/null
> > +++ b/tests/xfs/912.out
> > @@ -0,0 +1,43 @@
> > +QA output created by 912
> > +
> > +Format with label
> > +Read label offline
> > +label = "label0"
> > +Read label online
> > +label = "label0"
> > +
> > +Set label offline
> > +writing all SBs
> > +new label = "label1"
> > +Read label offline
> > +label = "label1"
> > +Read label online
> > +label = "label1"
> > +
> > +Set label online
> > +label = "label2"
> > +Read label online
> > +label = "label2"
> > +Read label offline
> > +label = "label2"
> > +
> > +Clear label online
> > +label = ""
> > +Read label online
> > +label = ""
> > +Read label offline
> > +label = ""
> > +
> > +Set label offline
> > +writing all SBs
> > +new label = "label3"
> > +Read label offline
> > +label = "label3"
> > +
> > +Clear label offline
> > +writing all SBs
> > +new label = ""
> > +Read label offline
> > +label = ""
> > +Read label online
> > +label = ""
> > diff --git a/tests/xfs/group b/tests/xfs/group
> > index edffef9a..898bd9e4 100644
> > --- a/tests/xfs/group
> > +++ b/tests/xfs/group
> > @@ -512,3 +512,4 @@
> >  512 auto quick acl attr
> >  747 auto quick scrub
> >  748 auto quick scrub
> > +912 auto quick label
> >

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 0/2] xfs_admin: unify online/offline fs label setting
@ 2020-01-16  5:11 Darrick J. Wong
  0 siblings, 0 replies; 9+ messages in thread
From: Darrick J. Wong @ 2020-01-16  5:11 UTC (permalink / raw)
  To: guaneryu, darrick.wong; +Cc: linux-xfs, fstests

Hi all,

Unify the online and offline label setting code paths in xfs_admin so
that one program can handle both.

If you're going to start using this mess, you probably ought to just
pull from my git trees, which are linked below.

This is an extraordinary way to destroy everything.  Enjoy!
Comments and questions are, as always, welcome.

--D

fstests git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfstests-dev.git/log/?h=online-label-setting

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 0/2] xfs_admin: unify online/offline fs label setting
@ 2019-12-02 17:37 Darrick J. Wong
  0 siblings, 0 replies; 9+ messages in thread
From: Darrick J. Wong @ 2019-12-02 17:37 UTC (permalink / raw)
  To: sandeen, darrick.wong; +Cc: linux-xfs

Hi all,

Here are two fixes for the xfs_admin script.  The first enables callers
to pass an external log device, because xfs_db requires that to work on
filesystems that do not have an internal log.

The second patch enables xfs_admin to call xfs_io, which is then used to
pass label get and set commands (-l and -L) to the kernel (via xfs_io) if
the filesystem is mounted.

This is an extraordinary way to destroy everything.  Enjoy!
Comments and questions are, as always, welcome.

--D

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-02-06 17:53 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-05  0:02 [PATCH 0/2] xfs_admin: unify online/offline fs label setting Darrick J. Wong
2020-02-05  0:02 ` [PATCH 1/2] xfs: refactor calls to xfs_admin Darrick J. Wong
2020-02-05  6:35   ` Amir Goldstein
2020-02-05 16:23     ` Darrick J. Wong
2020-02-05  0:02 ` [PATCH 2/2] xfs: test setting labels with xfs_admin Darrick J. Wong
2020-02-05  6:40   ` Amir Goldstein
2020-02-06 17:53     ` Darrick J. Wong
  -- strict thread matches above, loose matches on Subject: below --
2020-01-16  5:11 [PATCH 0/2] xfs_admin: unify online/offline fs label setting Darrick J. Wong
2019-12-02 17:37 Darrick J. Wong

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).