All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH 0/2] df01.sh: fix for XFS on kernel >= 5.19
@ 2023-03-07 14:55 Petr Vorel
  2023-03-07 14:55 ` [LTP] [PATCH 1/2] lib: Add tst_fsfreeze.c Petr Vorel
  2023-03-07 14:55 ` [LTP] [PATCH 2/2] df01.sh: Use tst_fsfreeze for XFS on kernel >= 5.19 Petr Vorel
  0 siblings, 2 replies; 10+ messages in thread
From: Petr Vorel @ 2023-03-07 14:55 UTC (permalink / raw)
  To: ltp; +Cc: Eric Sandeen, Darrick J . Wong

I finally find a time to fix this.

Kind regards,
Petr

Petr Vorel (2):
  lib: Add tst_fsfreeze.c
  df01.sh: Use tst_fsfreeze for XFS on kernel >= 5.19

 testcases/commands/df/df01.sh |  7 ++++++-
 testcases/lib/.gitignore      |  3 ++-
 testcases/lib/Makefile        |  2 +-
 testcases/lib/tst_fsfreeze.c  | 38 +++++++++++++++++++++++++++++++++++
 4 files changed, 47 insertions(+), 3 deletions(-)
 create mode 100644 testcases/lib/tst_fsfreeze.c

-- 
2.39.2


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

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

* [LTP] [PATCH 1/2] lib: Add tst_fsfreeze.c
  2023-03-07 14:55 [LTP] [PATCH 0/2] df01.sh: fix for XFS on kernel >= 5.19 Petr Vorel
@ 2023-03-07 14:55 ` Petr Vorel
  2023-03-07 14:55 ` [LTP] [PATCH 2/2] df01.sh: Use tst_fsfreeze for XFS on kernel >= 5.19 Petr Vorel
  1 sibling, 0 replies; 10+ messages in thread
From: Petr Vorel @ 2023-03-07 14:55 UTC (permalink / raw)
  To: ltp; +Cc: Eric Sandeen, Darrick J . Wong

It will be needed for df01.sh run in XFS since kernel 5.19.
Instead of requiring users to have fsfreeze implement LTP helper.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 testcases/lib/.gitignore     |  3 ++-
 testcases/lib/Makefile       |  2 +-
 testcases/lib/tst_fsfreeze.c | 38 ++++++++++++++++++++++++++++++++++++
 3 files changed, 41 insertions(+), 2 deletions(-)
 create mode 100644 testcases/lib/tst_fsfreeze.c

diff --git a/testcases/lib/.gitignore b/testcases/lib/.gitignore
index 34dea272d..fc8214b88 100644
--- a/testcases/lib/.gitignore
+++ b/testcases/lib/.gitignore
@@ -3,10 +3,12 @@
 /tst_check_kconfigs
 /tst_checkpoint
 /tst_device
+/tst_fsfreeze
 /tst_getconf
 /tst_get_free_pids
 /tst_get_median
 /tst_get_unused_port
+/tst_hexdump
 /tst_kvcmp
 /tst_net_iface_prefix
 /tst_net_ip_prefix
@@ -15,5 +17,4 @@
 /tst_rod
 /tst_sleep
 /tst_supported_fs
-/tst_hexdump
 /tst_timeout_kill
diff --git a/testcases/lib/Makefile b/testcases/lib/Makefile
index f4f8c8524..abdfe464c 100644
--- a/testcases/lib/Makefile
+++ b/testcases/lib/Makefile
@@ -12,6 +12,6 @@ MAKE_TARGETS		:= tst_sleep tst_random tst_checkpoint tst_rod tst_kvcmp\
 			   tst_device tst_net_iface_prefix tst_net_ip_prefix tst_net_vars\
 			   tst_getconf tst_supported_fs tst_check_drivers tst_get_unused_port\
 			   tst_get_median tst_hexdump tst_get_free_pids tst_timeout_kill\
-			   tst_check_kconfigs tst_cgctl
+			   tst_check_kconfigs tst_cgctl tst_fsfreeze
 
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/lib/tst_fsfreeze.c b/testcases/lib/tst_fsfreeze.c
new file mode 100644
index 000000000..4b0b12cba
--- /dev/null
+++ b/testcases/lib/tst_fsfreeze.c
@@ -0,0 +1,38 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (C) 2010 Hajime Taira <htaira@redhat.com>
+ *                    Masatake Yamato <yamato@redhat.com>
+ * Copyright (c) 2023 Petr Vorel <pvorel@suse.cz>
+ *
+ * Based on fsfreeze from util-linux.
+ */
+
+#include <linux/fs.h>
+#include <stdio.h>
+
+#define TST_NO_DEFAULT_MAIN
+#include "tst_test.h"
+#include "tst_safe_macros.h"
+
+static void help(void)
+{
+	printf("Freeze and unfreeze the device.\n");
+	printf("Usage: tst_fsfreeze device\n");
+}
+
+int main(int argc, char *argv[])
+{
+	int fd;
+
+	if (argc < 2) {
+		help();
+		return 1;
+	}
+
+	fd = SAFE_OPEN(argv[1], O_RDONLY);
+	SAFE_IOCTL(fd, FIFREEZE, 0);
+	SAFE_IOCTL(fd, FITHAW, 0);
+	SAFE_CLOSE(fd);
+
+	return 0;
+}
-- 
2.39.2


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

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

* [LTP] [PATCH 2/2] df01.sh: Use tst_fsfreeze for XFS on kernel >= 5.19
  2023-03-07 14:55 [LTP] [PATCH 0/2] df01.sh: fix for XFS on kernel >= 5.19 Petr Vorel
  2023-03-07 14:55 ` [LTP] [PATCH 1/2] lib: Add tst_fsfreeze.c Petr Vorel
@ 2023-03-07 14:55 ` Petr Vorel
  2023-03-13 14:38   ` Cyril Hrubis
  1 sibling, 1 reply; 10+ messages in thread
From: Petr Vorel @ 2023-03-07 14:55 UTC (permalink / raw)
  To: ltp; +Cc: Eric Sandeen, Eric Sandeen, Darrick J . Wong

XFS since kernel 5.19 postpone certain operation.  Use LTP fsfreeze
implementation to force all the background garbage collection to run
to completion.

Link: https://lore.kernel.org/linux-block/974cc110-d47e-5fae-af5f-e2e610720e2d@redhat.com/
Suggested-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 testcases/commands/df/df01.sh | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/testcases/commands/df/df01.sh b/testcases/commands/df/df01.sh
index ae0449c3c..699d1538f 100755
--- a/testcases/commands/df/df01.sh
+++ b/testcases/commands/df/df01.sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2015 Fujitsu Ltd.
-# Copyright (c) 2018-2022 Petr Vorel <pvorel@suse.cz>
+# Copyright (c) 2018-2023 Petr Vorel <pvorel@suse.cz>
 # Author: Zhang Jin <jy_zhangjin@cn.fujitsu.com>
 #
 # Test df command with some basic options.
@@ -46,6 +46,11 @@ df_test()
 
 	ROD_SILENT rm -rf $TST_MNTPOINT/testimg
 
+	# force all the background garbage collection to run to completion
+	if [ "$TST_FS_TYPE" = "xfs" ] && tst_kvcmp -ge "5.19"; then
+		tst_fsfreeze $TST_MNTPOINT
+	fi
+
 	# flush file system buffers, then we can get the actual sizes.
 	sync
 }
-- 
2.39.2


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

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

* Re: [LTP] [PATCH 2/2] df01.sh: Use tst_fsfreeze for XFS on kernel >= 5.19
  2023-03-07 14:55 ` [LTP] [PATCH 2/2] df01.sh: Use tst_fsfreeze for XFS on kernel >= 5.19 Petr Vorel
@ 2023-03-13 14:38   ` Cyril Hrubis
  2023-03-13 15:09     ` Eric Sandeen
  0 siblings, 1 reply; 10+ messages in thread
From: Cyril Hrubis @ 2023-03-13 14:38 UTC (permalink / raw)
  To: Petr Vorel; +Cc: Darrick J . Wong, Eric Sandeen, ltp, Eric Sandeen

Hi!
> XFS since kernel 5.19 postpone certain operation.  Use LTP fsfreeze
> implementation to force all the background garbage collection to run
> to completion.
> 
> Link: https://lore.kernel.org/linux-block/974cc110-d47e-5fae-af5f-e2e610720e2d@redhat.com/
> Suggested-by: Eric Sandeen <sandeen@redhat.com>
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
>  testcases/commands/df/df01.sh | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/testcases/commands/df/df01.sh b/testcases/commands/df/df01.sh
> index ae0449c3c..699d1538f 100755
> --- a/testcases/commands/df/df01.sh
> +++ b/testcases/commands/df/df01.sh
> @@ -1,7 +1,7 @@
>  #!/bin/sh
>  # SPDX-License-Identifier: GPL-2.0-or-later
>  # Copyright (c) 2015 Fujitsu Ltd.
> -# Copyright (c) 2018-2022 Petr Vorel <pvorel@suse.cz>
> +# Copyright (c) 2018-2023 Petr Vorel <pvorel@suse.cz>
>  # Author: Zhang Jin <jy_zhangjin@cn.fujitsu.com>
>  #
>  # Test df command with some basic options.
> @@ -46,6 +46,11 @@ df_test()
>  
>  	ROD_SILENT rm -rf $TST_MNTPOINT/testimg
>  
> +	# force all the background garbage collection to run to completion
> +	if [ "$TST_FS_TYPE" = "xfs" ] && tst_kvcmp -ge "5.19"; then
> +		tst_fsfreeze $TST_MNTPOINT
> +	fi

This looks overly specific, can't we just freeze and unfreeze the FS
without looking at kernel version? Or will we get errors on older XFS?

I suppose that this may still start to fail on distribution kernels if
some of the newer functionality gets backported...

Otherwise it looks good.

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

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

* Re: [LTP] [PATCH 2/2] df01.sh: Use tst_fsfreeze for XFS on kernel >= 5.19
  2023-03-13 14:38   ` Cyril Hrubis
@ 2023-03-13 15:09     ` Eric Sandeen
  2023-03-13 15:30       ` Petr Vorel
  0 siblings, 1 reply; 10+ messages in thread
From: Eric Sandeen @ 2023-03-13 15:09 UTC (permalink / raw)
  To: Cyril Hrubis, Petr Vorel; +Cc: Darrick J . Wong, Eric Sandeen, ltp

On 3/13/23 9:38 AM, Cyril Hrubis wrote:
> Hi!
>> XFS since kernel 5.19 postpone certain operation.  Use LTP fsfreeze
>> implementation to force all the background garbage collection to run
>> to completion.
>>
>> Link: https://lore.kernel.org/linux-block/974cc110-d47e-5fae-af5f-e2e610720e2d@redhat.com/
>> Suggested-by: Eric Sandeen <sandeen@redhat.com>
>> Signed-off-by: Petr Vorel <pvorel@suse.cz>
>> ---
>>  testcases/commands/df/df01.sh | 7 ++++++-
>>  1 file changed, 6 insertions(+), 1 deletion(-)
>>
>> diff --git a/testcases/commands/df/df01.sh b/testcases/commands/df/df01.sh
>> index ae0449c3c..699d1538f 100755
>> --- a/testcases/commands/df/df01.sh
>> +++ b/testcases/commands/df/df01.sh
>> @@ -1,7 +1,7 @@
>>  #!/bin/sh
>>  # SPDX-License-Identifier: GPL-2.0-or-later
>>  # Copyright (c) 2015 Fujitsu Ltd.
>> -# Copyright (c) 2018-2022 Petr Vorel <pvorel@suse.cz>
>> +# Copyright (c) 2018-2023 Petr Vorel <pvorel@suse.cz>
>>  # Author: Zhang Jin <jy_zhangjin@cn.fujitsu.com>
>>  #
>>  # Test df command with some basic options.
>> @@ -46,6 +46,11 @@ df_test()
>>  
>>  	ROD_SILENT rm -rf $TST_MNTPOINT/testimg
>>  
>> +	# force all the background garbage collection to run to completion
>> +	if [ "$TST_FS_TYPE" = "xfs" ] && tst_kvcmp -ge "5.19"; then
>> +		tst_fsfreeze $TST_MNTPOINT
>> +	fi
> 
> This looks overly specific, can't we just freeze and unfreeze the FS
> without looking at kernel version? Or will we get errors on older XFS?
> 
> I suppose that this may still start to fail on distribution kernels if
> some of the newer functionality gets backported...

Yup, I agree. Freeze should be safe for any kernel, I wouldn't condition it either.

(You do want to be very sure that you're not freezing the root fs, tho,
if that is any possibility.)

-Eric

> Otherwise it looks good.
> 


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

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

* Re: [LTP] [PATCH 2/2] df01.sh: Use tst_fsfreeze for XFS on kernel >= 5.19
  2023-03-13 15:09     ` Eric Sandeen
@ 2023-03-13 15:30       ` Petr Vorel
  2023-03-13 15:33         ` Petr Vorel
  0 siblings, 1 reply; 10+ messages in thread
From: Petr Vorel @ 2023-03-13 15:30 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: Darrick J . Wong, Eric Sandeen, ltp

> On 3/13/23 9:38 AM, Cyril Hrubis wrote:
> > Hi!
> >> XFS since kernel 5.19 postpone certain operation.  Use LTP fsfreeze
> >> implementation to force all the background garbage collection to run
> >> to completion.

> >> Link: https://lore.kernel.org/linux-block/974cc110-d47e-5fae-af5f-e2e610720e2d@redhat.com/
> >> Suggested-by: Eric Sandeen <sandeen@redhat.com>
> >> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> >> ---
> >>  testcases/commands/df/df01.sh | 7 ++++++-
> >>  1 file changed, 6 insertions(+), 1 deletion(-)

> >> diff --git a/testcases/commands/df/df01.sh b/testcases/commands/df/df01.sh
> >> index ae0449c3c..699d1538f 100755
> >> --- a/testcases/commands/df/df01.sh
> >> +++ b/testcases/commands/df/df01.sh
> >> @@ -1,7 +1,7 @@
> >>  #!/bin/sh
> >>  # SPDX-License-Identifier: GPL-2.0-or-later
> >>  # Copyright (c) 2015 Fujitsu Ltd.
> >> -# Copyright (c) 2018-2022 Petr Vorel <pvorel@suse.cz>
> >> +# Copyright (c) 2018-2023 Petr Vorel <pvorel@suse.cz>
> >>  # Author: Zhang Jin <jy_zhangjin@cn.fujitsu.com>

> >>  # Test df command with some basic options.
> >> @@ -46,6 +46,11 @@ df_test()

> >>  	ROD_SILENT rm -rf $TST_MNTPOINT/testimg

> >> +	# force all the background garbage collection to run to completion
> >> +	if [ "$TST_FS_TYPE" = "xfs" ] && tst_kvcmp -ge "5.19"; then
> >> +		tst_fsfreeze $TST_MNTPOINT
> >> +	fi

> > This looks overly specific, can't we just freeze and unfreeze the FS
> > without looking at kernel version? Or will we get errors on older XFS?

> > I suppose that this may still start to fail on distribution kernels if
> > some of the newer functionality gets backported...

So far it's OK on SLES, likely nothing related has been backported to it.
I wonder if we should remove the check or just wait till first complaint.

> Yup, I agree. Freeze should be safe for any kernel, I wouldn't condition it either.

> (You do want to be very sure that you're not freezing the root fs, tho,
> if that is any possibility.)

$TST_MNTPOINT in on $TMPDIR, which is by default /tmp. In case of /tmp being on
root fs we're freezing root tmpfs. But it works on openSUSE, which found the
problem.

Kind regards,
Petr

> -Eric

> > Otherwise it looks good.



-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

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

* Re: [LTP] [PATCH 2/2] df01.sh: Use tst_fsfreeze for XFS on kernel >= 5.19
  2023-03-13 15:30       ` Petr Vorel
@ 2023-03-13 15:33         ` Petr Vorel
  2023-03-13 16:12           ` Darrick J. Wong
  0 siblings, 1 reply; 10+ messages in thread
From: Petr Vorel @ 2023-03-13 15:33 UTC (permalink / raw)
  To: Eric Sandeen, Cyril Hrubis, ltp, Darrick J . Wong, Eric Sandeen

> > On 3/13/23 9:38 AM, Cyril Hrubis wrote:
> > > Hi!
> > >> XFS since kernel 5.19 postpone certain operation.  Use LTP fsfreeze
> > >> implementation to force all the background garbage collection to run
> > >> to completion.

> > >> Link: https://lore.kernel.org/linux-block/974cc110-d47e-5fae-af5f-e2e610720e2d@redhat.com/
> > >> Suggested-by: Eric Sandeen <sandeen@redhat.com>
> > >> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> > >> ---
> > >>  testcases/commands/df/df01.sh | 7 ++++++-
> > >>  1 file changed, 6 insertions(+), 1 deletion(-)

> > >> diff --git a/testcases/commands/df/df01.sh b/testcases/commands/df/df01.sh
> > >> index ae0449c3c..699d1538f 100755
> > >> --- a/testcases/commands/df/df01.sh
> > >> +++ b/testcases/commands/df/df01.sh
> > >> @@ -1,7 +1,7 @@
> > >>  #!/bin/sh
> > >>  # SPDX-License-Identifier: GPL-2.0-or-later
> > >>  # Copyright (c) 2015 Fujitsu Ltd.
> > >> -# Copyright (c) 2018-2022 Petr Vorel <pvorel@suse.cz>
> > >> +# Copyright (c) 2018-2023 Petr Vorel <pvorel@suse.cz>
> > >>  # Author: Zhang Jin <jy_zhangjin@cn.fujitsu.com>

> > >>  # Test df command with some basic options.
> > >> @@ -46,6 +46,11 @@ df_test()

> > >>  	ROD_SILENT rm -rf $TST_MNTPOINT/testimg

> > >> +	# force all the background garbage collection to run to completion
> > >> +	if [ "$TST_FS_TYPE" = "xfs" ] && tst_kvcmp -ge "5.19"; then
> > >> +		tst_fsfreeze $TST_MNTPOINT
> > >> +	fi

> > > This looks overly specific, can't we just freeze and unfreeze the FS
> > > without looking at kernel version? Or will we get errors on older XFS?

> > > I suppose that this may still start to fail on distribution kernels if
> > > some of the newer functionality gets backported...

> So far it's OK on SLES, likely nothing related has been backported to it.
> I wonder if we should remove the check or just wait till first complaint.

Well, I haven't seen any problems with older kernels, but I'll retest it more.
I don't expect any problems, thus I'm OK with removing it.

Kind regards,
Petr

> > Yup, I agree. Freeze should be safe for any kernel, I wouldn't condition it either.

> > (You do want to be very sure that you're not freezing the root fs, tho,
> > if that is any possibility.)

> $TST_MNTPOINT in on $TMPDIR, which is by default /tmp. In case of /tmp being on
> root fs we're freezing root tmpfs. But it works on openSUSE, which found the
> problem.

> Kind regards,
> Petr

> > -Eric

> > > Otherwise it looks good.



-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

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

* Re: [LTP] [PATCH 2/2] df01.sh: Use tst_fsfreeze for XFS on kernel >= 5.19
  2023-03-13 15:33         ` Petr Vorel
@ 2023-03-13 16:12           ` Darrick J. Wong
  2023-03-13 22:08             ` Petr Vorel
  2023-03-15 12:23             ` Petr Vorel
  0 siblings, 2 replies; 10+ messages in thread
From: Darrick J. Wong @ 2023-03-13 16:12 UTC (permalink / raw)
  To: Petr Vorel; +Cc: Eric Sandeen, Eric Sandeen, ltp

On Mon, Mar 13, 2023 at 04:33:09PM +0100, Petr Vorel wrote:
> > > On 3/13/23 9:38 AM, Cyril Hrubis wrote:
> > > > Hi!
> > > >> XFS since kernel 5.19 postpone certain operation.  Use LTP fsfreeze
> > > >> implementation to force all the background garbage collection to run
> > > >> to completion.
> 
> > > >> Link: https://lore.kernel.org/linux-block/974cc110-d47e-5fae-af5f-e2e610720e2d@redhat.com/
> > > >> Suggested-by: Eric Sandeen <sandeen@redhat.com>
> > > >> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> > > >> ---
> > > >>  testcases/commands/df/df01.sh | 7 ++++++-
> > > >>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> > > >> diff --git a/testcases/commands/df/df01.sh b/testcases/commands/df/df01.sh
> > > >> index ae0449c3c..699d1538f 100755
> > > >> --- a/testcases/commands/df/df01.sh
> > > >> +++ b/testcases/commands/df/df01.sh
> > > >> @@ -1,7 +1,7 @@
> > > >>  #!/bin/sh
> > > >>  # SPDX-License-Identifier: GPL-2.0-or-later
> > > >>  # Copyright (c) 2015 Fujitsu Ltd.
> > > >> -# Copyright (c) 2018-2022 Petr Vorel <pvorel@suse.cz>
> > > >> +# Copyright (c) 2018-2023 Petr Vorel <pvorel@suse.cz>
> > > >>  # Author: Zhang Jin <jy_zhangjin@cn.fujitsu.com>
> 
> > > >>  # Test df command with some basic options.
> > > >> @@ -46,6 +46,11 @@ df_test()
> 
> > > >>  	ROD_SILENT rm -rf $TST_MNTPOINT/testimg
> 
> > > >> +	# force all the background garbage collection to run to completion
> > > >> +	if [ "$TST_FS_TYPE" = "xfs" ] && tst_kvcmp -ge "5.19"; then
> > > >> +		tst_fsfreeze $TST_MNTPOINT
> > > >> +	fi
> 
> > > > This looks overly specific, can't we just freeze and unfreeze the FS
> > > > without looking at kernel version? Or will we get errors on older XFS?
> 
> > > > I suppose that this may still start to fail on distribution kernels if
> > > > some of the newer functionality gets backported...
> 
> > So far it's OK on SLES, likely nothing related has been backported to it.
> > I wonder if we should remove the check or just wait till first complaint.
> 
> Well, I haven't seen any problems with older kernels, but I'll retest it more.
> I don't expect any problems, thus I'm OK with removing it.

If the fs doesn't support freezing (e.g. tmpfs), you'll get a -1 return
value and errno == EOPNOTUPP or NOTTY.  Is that going to cause the test
to fail due to tst_brk?

> Kind regards,
> Petr
> 
> > > Yup, I agree. Freeze should be safe for any kernel, I wouldn't condition it either.
> 
> > > (You do want to be very sure that you're not freezing the root fs, tho,
> > > if that is any possibility.)

Why?  Are you worried about not being able to unfreeze the rootfs?
I know fstests has had problems with people doing:

xfs_io -c freeze "/$moo"	# whoops, moo is undefined
<something that blocks>
xfs_io -c thaw "/$moo"		# never gets here

But that's not the case here.

Even if it is the rootfs, the text page containing the two ioctls should
be in memory due to the instruction pointer, and even if it gets paged
out, freezes don't block read faults.

--D

> > $TST_MNTPOINT in on $TMPDIR, which is by default /tmp. In case of /tmp being on
> > root fs we're freezing root tmpfs. But it works on openSUSE, which found the
> > problem.
> 
> > Kind regards,
> > Petr
> 
> > > -Eric
> 
> > > > Otherwise it looks good.
> 
> 

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

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

* Re: [LTP] [PATCH 2/2] df01.sh: Use tst_fsfreeze for XFS on kernel >= 5.19
  2023-03-13 16:12           ` Darrick J. Wong
@ 2023-03-13 22:08             ` Petr Vorel
  2023-03-15 12:23             ` Petr Vorel
  1 sibling, 0 replies; 10+ messages in thread
From: Petr Vorel @ 2023-03-13 22:08 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: Eric Sandeen, Eric Sandeen, ltp

> On Mon, Mar 13, 2023 at 04:33:09PM +0100, Petr Vorel wrote:
> > > > On 3/13/23 9:38 AM, Cyril Hrubis wrote:
> > > > > Hi!
> > > > >> XFS since kernel 5.19 postpone certain operation.  Use LTP fsfreeze
> > > > >> implementation to force all the background garbage collection to run
> > > > >> to completion.

> > > > >> Link: https://lore.kernel.org/linux-block/974cc110-d47e-5fae-af5f-e2e610720e2d@redhat.com/
> > > > >> Suggested-by: Eric Sandeen <sandeen@redhat.com>
> > > > >> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> > > > >> ---
> > > > >>  testcases/commands/df/df01.sh | 7 ++++++-
> > > > >>  1 file changed, 6 insertions(+), 1 deletion(-)

> > > > >> diff --git a/testcases/commands/df/df01.sh b/testcases/commands/df/df01.sh
> > > > >> index ae0449c3c..699d1538f 100755
> > > > >> --- a/testcases/commands/df/df01.sh
> > > > >> +++ b/testcases/commands/df/df01.sh
> > > > >> @@ -1,7 +1,7 @@
> > > > >>  #!/bin/sh
> > > > >>  # SPDX-License-Identifier: GPL-2.0-or-later
> > > > >>  # Copyright (c) 2015 Fujitsu Ltd.
> > > > >> -# Copyright (c) 2018-2022 Petr Vorel <pvorel@suse.cz>
> > > > >> +# Copyright (c) 2018-2023 Petr Vorel <pvorel@suse.cz>
> > > > >>  # Author: Zhang Jin <jy_zhangjin@cn.fujitsu.com>

> > > > >>  # Test df command with some basic options.
> > > > >> @@ -46,6 +46,11 @@ df_test()

> > > > >>  	ROD_SILENT rm -rf $TST_MNTPOINT/testimg

> > > > >> +	# force all the background garbage collection to run to completion
> > > > >> +	if [ "$TST_FS_TYPE" = "xfs" ] && tst_kvcmp -ge "5.19"; then
> > > > >> +		tst_fsfreeze $TST_MNTPOINT
> > > > >> +	fi

> > > > > This looks overly specific, can't we just freeze and unfreeze the FS
> > > > > without looking at kernel version? Or will we get errors on older XFS?

> > > > > I suppose that this may still start to fail on distribution kernels if
> > > > > some of the newer functionality gets backported...

> > > So far it's OK on SLES, likely nothing related has been backported to it.
> > > I wonder if we should remove the check or just wait till first complaint.

> > Well, I haven't seen any problems with older kernels, but I'll retest it more.
> > I don't expect any problems, thus I'm OK with removing it.

> If the fs doesn't support freezing (e.g. tmpfs), you'll get a -1 return
> value and errno == EOPNOTUPP or NOTTY.  Is that going to cause the test
> to fail due to tst_brk?

FYI I haven't noticed any problem so far, but need to test more.

> > Kind regards,
> > Petr

> > > > Yup, I agree. Freeze should be safe for any kernel, I wouldn't condition it either.

> > > > (You do want to be very sure that you're not freezing the root fs, tho,
> > > > if that is any possibility.)

> Why?  Are you worried about not being able to unfreeze the rootfs?
> I know fstests has had problems with people doing:

> xfs_io -c freeze "/$moo"	# whoops, moo is undefined
> <something that blocks>
> xfs_io -c thaw "/$moo"		# never gets here

> But that's not the case here.

Yes, if you mean "/", that's not going to happen ($TST_MNTPOINT is never going
to be "/").  I'm sorry, I mixed up mountpoint (used by fsfreeze and therefore
also tst_fsfreeze.c) and device (=> there shouldn't be a problem).

Kind regards,
Petr

> Even if it is the rootfs, the text page containing the two ioctls should
> be in memory due to the instruction pointer, and even if it gets paged
> out, freezes don't block read faults.

> --D

> > > $TST_MNTPOINT in on $TMPDIR, which is by default /tmp. In case of /tmp being on
> > > root fs we're freezing root tmpfs. But it works on openSUSE, which found the
> > > problem.

> > > Kind regards,
> > > Petr

> > > > -Eric

> > > > > Otherwise it looks good.



-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

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

* Re: [LTP] [PATCH 2/2] df01.sh: Use tst_fsfreeze for XFS on kernel >= 5.19
  2023-03-13 16:12           ` Darrick J. Wong
  2023-03-13 22:08             ` Petr Vorel
@ 2023-03-15 12:23             ` Petr Vorel
  1 sibling, 0 replies; 10+ messages in thread
From: Petr Vorel @ 2023-03-15 12:23 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: Eric Sandeen, Eric Sandeen, ltp

Hi all,

FYI merged without kernel specific check.
Thanks all for your input.

Kind regards,
Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

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

end of thread, other threads:[~2023-03-15 12:24 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-07 14:55 [LTP] [PATCH 0/2] df01.sh: fix for XFS on kernel >= 5.19 Petr Vorel
2023-03-07 14:55 ` [LTP] [PATCH 1/2] lib: Add tst_fsfreeze.c Petr Vorel
2023-03-07 14:55 ` [LTP] [PATCH 2/2] df01.sh: Use tst_fsfreeze for XFS on kernel >= 5.19 Petr Vorel
2023-03-13 14:38   ` Cyril Hrubis
2023-03-13 15:09     ` Eric Sandeen
2023-03-13 15:30       ` Petr Vorel
2023-03-13 15:33         ` Petr Vorel
2023-03-13 16:12           ` Darrick J. Wong
2023-03-13 22:08             ` Petr Vorel
2023-03-15 12:23             ` Petr Vorel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.