linux-unionfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] overlay: workaround libmount failure to remount,ro
@ 2025-05-26  8:18 Amir Goldstein
  2025-06-05 17:00 ` Zorro Lang
  0 siblings, 1 reply; 3+ messages in thread
From: Amir Goldstein @ 2025-05-26  8:18 UTC (permalink / raw)
  To: Zorro Lang
  Cc: Christian Brauner, Miklos Szeredi, linux-unionfs, fstests,
	André Almeida, Karel Zak

libmount v1.41 calls several unneeded fsconfig() calls to reconfigure
lowerdir/upperdir when user requests only -o remount,ro.

Those calls fail because overlayfs does not allow making any config
changes with new mount api, besides MS_RDONLY.

force mount(8) to use mount(2) to remount ro/rw to workaround
this issue, by setting LIBMOUNT_FORCE_MOUNT2=always.

Reported-by: André Almeida <andrealmeid@igalia.com>
Cc: Karel Zak <kzak@redhat.com>
Link: https://lore.kernel.org/linux-fsdevel/20250521-ovl_ro-v1-1-2350b1493d94@igalia.com/
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
---
 common/overlay    | 4 +++-
 tests/overlay/035 | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/common/overlay b/common/overlay
index a6d37a93..5ee9f561 100644
--- a/common/overlay
+++ b/common/overlay
@@ -127,7 +127,9 @@ _overlay_base_scratch_mount()
 _overlay_scratch_mount()
 {
 	if echo "$*" | grep -q remount; then
-		$MOUNT_PROG $SCRATCH_MNT $*
+		# force mount(8) to use mount(2), to workaround libmount v1.41
+		# failed fsconfig() calls to reconfigure lowerdir/upperdir
+		LIBMOUNT_FORCE_MOUNT2=always $MOUNT_PROG $SCRATCH_MNT $*
 		return
 	fi
 
diff --git a/tests/overlay/035 b/tests/overlay/035
index 0b3257c4..2a4df99a 100755
--- a/tests/overlay/035
+++ b/tests/overlay/035
@@ -42,7 +42,7 @@ mkdir -p $lowerdir1 $lowerdir2 $upperdir $workdir
 # Verify that overlay is mounted read-only and that it cannot be remounted rw.
 _overlay_scratch_mount_opts -o"lowerdir=$lowerdir2:$lowerdir1"
 touch $SCRATCH_MNT/foo 2>&1 | _filter_scratch
-$MOUNT_PROG -o remount,rw $SCRATCH_MNT 2>&1 | _filter_ro_mount
+_scratch_remount rw 2>&1 | _filter_ro_mount
 $UMOUNT_PROG $SCRATCH_MNT
 
 # Make workdir immutable to prevent workdir re-create on mount
-- 
2.34.1


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

* Re: [PATCH] overlay: workaround libmount failure to remount,ro
  2025-05-26  8:18 [PATCH] overlay: workaround libmount failure to remount,ro Amir Goldstein
@ 2025-06-05 17:00 ` Zorro Lang
  2025-06-05 17:08   ` Amir Goldstein
  0 siblings, 1 reply; 3+ messages in thread
From: Zorro Lang @ 2025-06-05 17:00 UTC (permalink / raw)
  To: Amir Goldstein
  Cc: Christian Brauner, Miklos Szeredi, linux-unionfs, fstests,
	André Almeida, Karel Zak

On Mon, May 26, 2025 at 10:18:52AM +0200, Amir Goldstein wrote:
> libmount v1.41 calls several unneeded fsconfig() calls to reconfigure
> lowerdir/upperdir when user requests only -o remount,ro.
> 
> Those calls fail because overlayfs does not allow making any config
> changes with new mount api, besides MS_RDONLY.
> 
> force mount(8) to use mount(2) to remount ro/rw to workaround
> this issue, by setting LIBMOUNT_FORCE_MOUNT2=always.
> 
> Reported-by: André Almeida <andrealmeid@igalia.com>
> Cc: Karel Zak <kzak@redhat.com>
> Link: https://lore.kernel.org/linux-fsdevel/20250521-ovl_ro-v1-1-2350b1493d94@igalia.com/

Is my bug report (a year ago) gotten fixed?
https://lore.kernel.org/linux-fsdevel/20241026180741.cfqm6oqp3frvasfm@dell-per750-06-vm-08.rhts.eng.pek2.redhat.com/

If this kernel fix works, do we still need this workaround?

Thanks,
Zorro

> Signed-off-by: Amir Goldstein <amir73il@gmail.com>
> ---
>  common/overlay    | 4 +++-
>  tests/overlay/035 | 2 +-
>  2 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/common/overlay b/common/overlay
> index a6d37a93..5ee9f561 100644
> --- a/common/overlay
> +++ b/common/overlay
> @@ -127,7 +127,9 @@ _overlay_base_scratch_mount()
>  _overlay_scratch_mount()
>  {
>  	if echo "$*" | grep -q remount; then
> -		$MOUNT_PROG $SCRATCH_MNT $*
> +		# force mount(8) to use mount(2), to workaround libmount v1.41
> +		# failed fsconfig() calls to reconfigure lowerdir/upperdir
> +		LIBMOUNT_FORCE_MOUNT2=always $MOUNT_PROG $SCRATCH_MNT $*
>  		return
>  	fi
>  
> diff --git a/tests/overlay/035 b/tests/overlay/035
> index 0b3257c4..2a4df99a 100755
> --- a/tests/overlay/035
> +++ b/tests/overlay/035
> @@ -42,7 +42,7 @@ mkdir -p $lowerdir1 $lowerdir2 $upperdir $workdir
>  # Verify that overlay is mounted read-only and that it cannot be remounted rw.
>  _overlay_scratch_mount_opts -o"lowerdir=$lowerdir2:$lowerdir1"
>  touch $SCRATCH_MNT/foo 2>&1 | _filter_scratch
> -$MOUNT_PROG -o remount,rw $SCRATCH_MNT 2>&1 | _filter_ro_mount
> +_scratch_remount rw 2>&1 | _filter_ro_mount
>  $UMOUNT_PROG $SCRATCH_MNT
>  
>  # Make workdir immutable to prevent workdir re-create on mount
> -- 
> 2.34.1
> 


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

* Re: [PATCH] overlay: workaround libmount failure to remount,ro
  2025-06-05 17:00 ` Zorro Lang
@ 2025-06-05 17:08   ` Amir Goldstein
  0 siblings, 0 replies; 3+ messages in thread
From: Amir Goldstein @ 2025-06-05 17:08 UTC (permalink / raw)
  To: Zorro Lang
  Cc: Christian Brauner, Miklos Szeredi, linux-unionfs, fstests,
	André Almeida, Karel Zak

On Thu, Jun 5, 2025 at 7:00 PM Zorro Lang <zlang@redhat.com> wrote:
>
> On Mon, May 26, 2025 at 10:18:52AM +0200, Amir Goldstein wrote:
> > libmount v1.41 calls several unneeded fsconfig() calls to reconfigure
> > lowerdir/upperdir when user requests only -o remount,ro.
> >
> > Those calls fail because overlayfs does not allow making any config
> > changes with new mount api, besides MS_RDONLY.
> >
> > force mount(8) to use mount(2) to remount ro/rw to workaround
> > this issue, by setting LIBMOUNT_FORCE_MOUNT2=always.
> >
> > Reported-by: André Almeida <andrealmeid@igalia.com>
> > Cc: Karel Zak <kzak@redhat.com>
> > Link: https://lore.kernel.org/linux-fsdevel/20250521-ovl_ro-v1-1-2350b1493d94@igalia.com/
>
> Is my bug report (a year ago) gotten fixed?
> https://lore.kernel.org/linux-fsdevel/20241026180741.cfqm6oqp3frvasfm@dell-per750-06-vm-08.rhts.eng.pek2.redhat.com/
>

Please see v2 (this is v1):
https://lore.kernel.org/fstests/20250603100745.2022891-2-amir73il@gmail.com/
The suggested workaround is exactly the same as suggested one year ago

> If this kernel fix works, do we still need this workaround?
>

Which kernel fix?
There was no agreement on a kernel fix (yet).

Thanks,
Amir.

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

end of thread, other threads:[~2025-06-05 17:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-26  8:18 [PATCH] overlay: workaround libmount failure to remount,ro Amir Goldstein
2025-06-05 17:00 ` Zorro Lang
2025-06-05 17:08   ` Amir Goldstein

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