Re: [PATCH 1/1] fsopen: fsconfig syscall restart fix

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I've sent the copy to Christian and David

Cc: Christian Brauner <christian@xxxxxxxxxx>
Cc: David Howells <dhowells@xxxxxxxxxx>

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@xxxxxxxxxxxxx> wrote:

> On Wed, 23 Sep 2020 18:03:22 +0100
> Al Viro <viro@xxxxxxxxxxxxxxxxxx> 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.




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux