From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C7A8AC83F18 for ; Tue, 29 Aug 2023 13:04:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235796AbjH2ND4 (ORCPT ); Tue, 29 Aug 2023 09:03:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235899AbjH2NDp (ORCPT ); Tue, 29 Aug 2023 09:03:45 -0400 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41B4FCED; Tue, 29 Aug 2023 06:03:31 -0700 (PDT) Received: by verein.lst.de (Postfix, from userid 2407) id 93D3A6732D; Tue, 29 Aug 2023 15:03:27 +0200 (CEST) Date: Tue, 29 Aug 2023 15:03:27 +0200 From: Christoph Hellwig To: Al Viro Cc: Christoph Hellwig , Jens Axboe , "Darrick J. Wong" , Andrew Morton , Matthew Wilcox , Christian Brauner , linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/6] block: open code __generic_file_write_iter for blkdev writes Message-ID: <20230829130327.GA26482@lst.de> References: <20230801172201.1923299-1-hch@lst.de> <20230801172201.1923299-4-hch@lst.de> <20230829020614.GB325446@ZenIV> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230829020614.GB325446@ZenIV> User-Agent: Mutt/1.5.17 (2007-11-01) Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org On Tue, Aug 29, 2023 at 03:06:14AM +0100, Al Viro wrote: > On Tue, Aug 01, 2023 at 07:21:58PM +0200, Christoph Hellwig wrote: > > @@ -569,7 +594,23 @@ static ssize_t blkdev_write_iter(struct kiocb *iocb, struct iov_iter *from) > > iov_iter_truncate(from, size); > > } > > > > - ret = __generic_file_write_iter(iocb, from); > > + ret = file_remove_privs(file); > > + if (ret) > > + return ret; > > That chunk is a bit of a WTF generator... Thankfully, > > static int __file_remove_privs(struct file *file, unsigned int flags) > { > struct dentry *dentry = file_dentry(file); > struct inode *inode = file_inode(file); > int error = 0; > int kill; > > if (IS_NOSEC(inode) || !S_ISREG(inode->i_mode)) > return 0; > > means that it's really a no-op. But I'd still suggest > removing it, just to reduce the amount of head-scratching > for people who'll be reading that code later... I'll send an incremental patch to remove it once the changes hit Linus' tree.