From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx3-rdu2.redhat.com ([66.187.233.73]:45328 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729224AbeGaKbz (ORCPT ); Tue, 31 Jul 2018 06:31:55 -0400 From: David Howells In-Reply-To: <20180731072928.2413-1-avagin@openvz.org> References: <20180731072928.2413-1-avagin@openvz.org> To: Andrei Vagin Cc: dhowells@redhat.com, linux-fsdevel@vger.kernel.org, Andrei Vagin Subject: Re: [PATCH dhowells/mount-context] fs: don't call fs_context->free() from fsmount() MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <14900.1533027156.1@warthog.procyon.org.uk> Content-Transfer-Encoding: 8BIT Date: Tue, 31 Jul 2018 09:52:36 +0100 Message-ID: <14901.1533027156@warthog.procyon.org.uk> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Andrei Vagin 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 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. David