From: Alexander Mikhalitsyn <alexander.mikhalitsyn@virtuozzo.com>
To: linux-fsdevel@vger.kernel.org
Cc: christian@brauner.io, dhowells@redhat.com
Subject: Re: [PATCH 1/1] fsopen: fsconfig syscall restart fix
Date: Thu, 24 Sep 2020 18:31:45 +0300 [thread overview]
Message-ID: <20200924183145.040df323d6b86b12d7bd22a2@virtuozzo.com> (raw)
In-Reply-To: <20200923201958.b27ecda5a1e788fb5f472bcd@virtuozzo.com>
I've sent the copy to Christian and David
Cc: Christian Brauner <christian@brauner.io>
Cc: David Howells <dhowells@redhat.com>
Guys, please take a look once time permit.
Thank you.
Regards, Alex
On Wed, 23 Sep 2020 20:19:58 +0300
Alexander Mikhalitsyn <alexander.mikhalitsyn@virtuozzo.com> wrote:
> On Wed, 23 Sep 2020 18:03:22 +0100
> Al Viro <viro@zeniv.linux.org.uk> wrote:
>
> > On Wed, Sep 23, 2020 at 07:46:36PM +0300, Alexander Mikhalitsyn wrote:
> > > During execution of vfs_fsconfig_locked function we can get ERESTARTNOINTR
> > > error (or other interrupt error). But we changing fs context fc->phase
> > > field to transient states and our entry fc->phase checks in switch cases
> > > (see FS_CONTEXT_CREATE_PARAMS, FS_CONTEXT_RECONF_PARAMS) will always fail
> > > after syscall restart which will lead to returning -EBUSY to the userspace.
> > >
> > > The idea of the fix is to save entry-time fs_context phase field value and
> > > recover fc->phase value to the original one before exiting with
> > > "interrupt error" (ERESTARTNOINTR or similar).
> >
> > If you have e.g. vfs_create_tree() fail in the middle of ->get_tree(),
> > the only thing you can do to that thing is to discard it. The state is
> > *NOT* required to be recoverable after a failure exit - quite a bit of
> > config might've been consumed and freed by that point.
> >
> > CREATE and RECONFIGURE are simply not restartable.
>
> Thank you for quick response!
>
> I got you idea. But as far as I understand fsopen/fsconfig API is in
> early-development stage and we can think about convenience here.
>
> Consider the typical code here:
> int fsfd;
> fsfd = fsopen("somefs", 0);
> // a lot of:
> fsconfig(fsfd, FSCONFIG_SET_FLAG, ...);
> fsconfig(fsfd, FSCONFIG_SET_STRING, ...);
> fsconfig(fsfd, FSCONFIG_SET_BINARY, ...);
> //...
>
> // now call:
> fsconfig(sfd, FSCONFIG_CMD_CREATE, NULL, NULL, 0)
> -> get signal here or something else
> -> syscall restarted but this doesn't work because
> of broken fc->phase state
> -> get EBUSY
> -> now we need to repeat *all* steps with
> fsconfig(fsfd, FSCONFIG_SET_FLAG/FSCONFIG_SET_STRING, ...).
> Speaking honestly, this looks weird.
>
> Regards,
> Alex.
prev parent reply other threads:[~2020-09-24 15:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-23 16:46 [PATCH 0/1] fsopen: fsconfig syscall restart fix Alexander Mikhalitsyn
2020-09-23 16:46 ` [PATCH 1/1] " Alexander Mikhalitsyn
2020-09-23 17:03 ` Al Viro
2020-09-23 17:19 ` Alexander Mikhalitsyn
2020-09-24 15:31 ` Alexander Mikhalitsyn [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200924183145.040df323d6b86b12d7bd22a2@virtuozzo.com \
--to=alexander.mikhalitsyn@virtuozzo.com \
--cc=christian@brauner.io \
--cc=dhowells@redhat.com \
--cc=linux-fsdevel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).