On Tue, Jul 31, 2018 at 09:52:36AM +0100, David Howells wrote: > Andrei Vagin <avagin@xxxxxxxxxx> wrote: > > > @@ -3435,9 +3435,6 @@ SYSCALL_DEFINE3(fsmount, int, fs_fd, unsigned int, flags, unsigned int, ms_flags > > * do any memory allocation or anything like that at this point as we > > * don't want to have to handle any errors incurred. > > */ > > - if (fc->ops && fc->ops->free) > > - fc->ops->free(fc); > > - fc->fs_private = NULL; > > fc->s_fs_info = NULL; > > fc->sb_flags = 0; > > fc->sloppy = false; > > This isn't the right fix. The context needs to be reset at this point so that > it's prepared to be reinitialised into in the same state as one generated by > fspick(). I understand this. init_fs_context() is called from fspick() and fs_context->free() is called for contexts which have been created in fspick(). > > I can do this two ways: (1) stick a flag in the context that says if ->free() > needs calling, (2) make all the ->free() routines aware that they may see the > reset state. I think (1) is less error prone. Does it mean that fc->fs_type->init_fs_context() should not be called contexts which are created from fspick()? > > David