mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [BUG?] fsconfig restart_syscall failed
@ 2023-09-22  2:18 Cai Xinchen
  2023-09-22  8:08 ` Christian Brauner
  0 siblings, 1 reply; 3+ messages in thread
From: Cai Xinchen @ 2023-09-22  2:18 UTC (permalink / raw)
  To: Tejun Heo, Zefan Li, Johannes Weiner, cgroups, Alexander Viro,
	Christian Brauner, linux-fsdevel, dhowells, linux-kernel

Hello:
   I am doing some test for kernel 6.4, util-linux version:2.39.1.
Have you encountered similar problems? If there is a fix, please
let me know.
Thank you very much

--------------------------------------------------

util-linux version 2.39.1 call mount use fsopen->fsconfig->fsmount->close
instead of mount syscall.

And use this shell test:

#!/bin/bash
mkdir -p /tmp/cgroup/cgrouptest
while true
do
         mount -t cgroup -o none,name=foo cgroup /tmp/cgroup/cgrouptest
         ret=$?
         if [ $ret -ne 0 ];then
                 echo "mount failed , $ret"
         fi
         umount /tmp/cgroup/cgrouptest
         ret=$?
         if [ $ret -ne 0 ];then
                 echo "umount failed, $ret"
         fi
done

And as a result, we mount cgroup immediately after umount, it will return
failed.

in fsconfig syscall, we find this stack:

SYSCALL_DEFINE5(fsconfig, ...)
         vfs_fsconfig_locked
                 if (fc->phase != FS_CONTEXT_CREATE_PARAMS)
                         return -EBUSY;

                 vfs_get_tree
                         fc->ops->get_tree // cgroup1_get_tree
                                 if (!ret && !percpu_ref_tryget_live
(&ctx->root->cgrp.self.refcnt))
                                         ret = 1;
                                 ...
                                 if (unlikely(ret > 0)) {
                                         msleep(10);
                                         restart_syscall();
                                 }
                 ...
                 fc->phase = FS_CONTEXT_FAILED;

in mount syscall, no function will check fs->phase, and fc is recreate
in monnt syscall. However, in fdconfig syscall, fc->phase is not initial as
FS_CONTEXT_CREATE_PARAMS, restart_syscall will return -EBUSY. fc is created
in fsopen syscall.


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

* Re: [BUG?] fsconfig restart_syscall failed
  2023-09-22  2:18 [BUG?] fsconfig restart_syscall failed Cai Xinchen
@ 2023-09-22  8:08 ` Christian Brauner
  2023-09-29 15:53   ` Alexander Mikhalitsyn
  0 siblings, 1 reply; 3+ messages in thread
From: Christian Brauner @ 2023-09-22  8:08 UTC (permalink / raw)
  To: Cai Xinchen
  Cc: Tejun Heo, Zefan Li, Johannes Weiner, cgroups, Alexander Viro,
	linux-fsdevel, dhowells, linux-kernel

On Fri, Sep 22, 2023 at 10:18:24AM +0800, Cai Xinchen wrote:
> Hello:
>   I am doing some test for kernel 6.4, util-linux version:2.39.1.
> Have you encountered similar problems? If there is a fix, please
> let me know.
> Thank you very much
> 
> --------------------------------------------------
> 
> util-linux version 2.39.1 call mount use fsopen->fsconfig->fsmount->close
> instead of mount syscall.
> 
> And use this shell test:
> 
> #!/bin/bash
> mkdir -p /tmp/cgroup/cgrouptest
> while true
> do
>         mount -t cgroup -o none,name=foo cgroup /tmp/cgroup/cgrouptest


> in mount syscall, no function will check fs->phase, and fc is recreate
> in monnt syscall. However, in fdconfig syscall, fc->phase is not initial as
> FS_CONTEXT_CREATE_PARAMS, restart_syscall will return -EBUSY. fc is created
> in fsopen syscall.

Mount api system calls aren't restartable so that doesn't work. cgroup2
doesn't have this issue, only cgroup1 has. So cgroup1_get_tree() should
probably be fixed if anyone cares.

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

* Re: [BUG?] fsconfig restart_syscall failed
  2023-09-22  8:08 ` Christian Brauner
@ 2023-09-29 15:53   ` Alexander Mikhalitsyn
  0 siblings, 0 replies; 3+ messages in thread
From: Alexander Mikhalitsyn @ 2023-09-29 15:53 UTC (permalink / raw)
  To: Christian Brauner
  Cc: Cai Xinchen, Tejun Heo, Zefan Li, Johannes Weiner, cgroups,
	Alexander Viro, linux-fsdevel, dhowells, linux-kernel

On Fri, 22 Sep 2023 10:08:36 +0200
Christian Brauner <brauner@kernel.org> wrote:

> On Fri, Sep 22, 2023 at 10:18:24AM +0800, Cai Xinchen wrote:
> > Hello:
> >   I am doing some test for kernel 6.4, util-linux version:2.39.1.
> > Have you encountered similar problems? If there is a fix, please
> > let me know.
> > Thank you very much
> > 
> > --------------------------------------------------
> > 
> > util-linux version 2.39.1 call mount use fsopen->fsconfig->fsmount->close
> > instead of mount syscall.
> > 
> > And use this shell test:
> > 
> > #!/bin/bash
> > mkdir -p /tmp/cgroup/cgrouptest
> > while true
> > do
> >         mount -t cgroup -o none,name=foo cgroup /tmp/cgroup/cgrouptest
> 
> 
> > in mount syscall, no function will check fs->phase, and fc is recreate
> > in monnt syscall. However, in fdconfig syscall, fc->phase is not initial as
> > FS_CONTEXT_CREATE_PARAMS, restart_syscall will return -EBUSY. fc is created
> > in fsopen syscall.
> 
> Mount api system calls aren't restartable so that doesn't work. cgroup2
> doesn't have this issue, only cgroup1 has. So cgroup1_get_tree() should
> probably be fixed if anyone cares.
> 

Dear colleagues,

I've met the same issue a few years ago and tried to fix it:
https://lore.kernel.org/all/20200923164637.13032-1-alexander.mikhalitsyn@virtuozzo.com/

but didn't come into agreement about this.

Kind regards,
Alex

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

end of thread, other threads:[~2023-09-29 15:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-22  2:18 [BUG?] fsconfig restart_syscall failed Cai Xinchen
2023-09-22  8:08 ` Christian Brauner
2023-09-29 15:53   ` Alexander Mikhalitsyn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®