From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 951FD17BBE; Fri, 9 Aug 2024 05:37:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723181874; cv=none; b=jFxxIrKS7c2TqeEpYUCIZlYhkmvdMd7RJauJEqiuFUL3AsHX4IOaOxRsXCvuCydsuE+gUCws3VkJTm9Zdo+OOWNFPP0O9W1tdzEC+2JeP+0vFDgDcVGWxOxysEq5jKJG7klsoev93YLSTjcWhYnx3q1+GuImX2e9WkxoNTXEbvc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723181874; c=relaxed/simple; bh=lOZtihui0k4mla/fwJ1SNSDDA5JTGeFOJpE/zRPr7lI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Suqifntg7j3mchvTvB+9/eUm931N5XADPkMp/iqX+oz5vYjQVljwP+Ls+bCEEt2HtuloiEcr5fGUVov2Af8g2lUHgVXmk2tBnC/F+7YLTkzIWk/rnA+yNrIYiqWR9G1vgnuPL1qkUJo/8VoABTItfvySL/Uq07qP5t9v0L2itO8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Ja+Tlyoq; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="Ja+Tlyoq" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4B4CEC32782; Fri, 9 Aug 2024 05:37:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1723181874; bh=lOZtihui0k4mla/fwJ1SNSDDA5JTGeFOJpE/zRPr7lI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Ja+TlyoqL0I/er2EtwIN4JTQMRt46xrIy6SHLUTkaWucveylKEtv6fCgp0QsIIu5S uW4JUdOXIRUDPwYg4E+zaaRKkDuEvZ5QX7qgMMmCVmTFai624T1WvUNvhtA7Nd6oXm UqGTQUWNWrx4jf4K3Y5ja+D4LIc6uc/g6u9n6F30= Date: Fri, 9 Aug 2024 07:37:49 +0200 From: Greg Kroah-Hartman To: Martin Oliveira Cc: linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Andrew Morton , Artemy Kovalyov , Jason Gunthorpe , Leon Romanovsky , Logan Gunthorpe , Michael Guralnik , Mike Marciniszyn , Shiraz Saleem , Tejun Heo , John Hubbard , Dan Williams , David Sloan Subject: Re: [PATCH v5 1/4] kernfs: add a WARN_ON_ONCE if ->close is set Message-ID: <2024080933-jazz-supernova-9f3a@gregkh> References: <20240808183340.483468-1-martin.oliveira@eideticom.com> <20240808183340.483468-2-martin.oliveira@eideticom.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240808183340.483468-2-martin.oliveira@eideticom.com> On Thu, Aug 08, 2024 at 12:33:37PM -0600, Martin Oliveira wrote: > The next patch is going to remove .page_mkwrite from kernfs and will > WARN if an mmap implementation sets .page_mkwrite. > > In preparation for that change, and to make it consistent, add a WARN to > the ->close check. > > Co-developed-by: Logan Gunthorpe > Signed-off-by: Logan Gunthorpe > Signed-off-by: Martin Oliveira > --- > fs/kernfs/file.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/kernfs/file.c b/fs/kernfs/file.c > index 8502ef68459b..72cc51dcf870 100644 > --- a/fs/kernfs/file.c > +++ b/fs/kernfs/file.c > @@ -479,7 +479,7 @@ static int kernfs_fop_mmap(struct file *file, struct vm_area_struct *vma) > * It is not possible to successfully wrap close. > * So error if someone is trying to use close. > */ > - if (vma->vm_ops && vma->vm_ops->close) > + if (WARN_ON_ONCE(vma->vm_ops && vma->vm_ops->close)) So you just rebooted a machine that hits this, loosing data everywhere. Not nice :(