From patchwork Fri Jan 26 13:28:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13532575 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 66984C47DDF for ; Fri, 26 Jan 2024 13:30:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F24816B0082; Fri, 26 Jan 2024 08:30:07 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id EAE0A6B0088; Fri, 26 Jan 2024 08:30:07 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D75896B008A; Fri, 26 Jan 2024 08:30:07 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id BF3CA6B0082 for ; Fri, 26 Jan 2024 08:30:07 -0500 (EST) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 85C9E80F34 for ; Fri, 26 Jan 2024 13:30:07 +0000 (UTC) X-FDA: 81721545654.07.317E30A Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf28.hostedemail.com (Postfix) with ESMTP id DB64CC0023 for ; Fri, 26 Jan 2024 13:30:05 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=LO+DAdQY; dmarc=none; spf=none (imf28.hostedemail.com: domain of BATV+8230b42af99c397292d7+7460+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+8230b42af99c397292d7+7460+infradead.org+hch@bombadil.srs.infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1706275805; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=WZPrkSzC6JP8KIWSSwxcdUJBQA5TQKYe+UX++Ksig+4=; b=syi2S8mKjk5PdpKMYleerAcN8s4ZW3kBa7UT/yBS+ruNGFtbVk2+FUcKORC/sQJo209gLc gfEjOetrDTUXJ7KR5GuVeOBVSHdqnPJ93gmqqM5U3hyWp79U0eS5nRt02uj82IwiymlnCQ xB2wHLopCXpxUHRToLYZSgq2wPT+hK0= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=LO+DAdQY; dmarc=none; spf=none (imf28.hostedemail.com: domain of BATV+8230b42af99c397292d7+7460+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+8230b42af99c397292d7+7460+infradead.org+hch@bombadil.srs.infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1706275805; a=rsa-sha256; cv=none; b=AWIClea1ktFqJNVFVNTO4a/KeoVWOMFIzl+S3tzyazs9RHu4CismNm+iA9omRFDv56x3Uq TuBCxpxn8dw3oP7T4H70INfQahAIHWeHxo3ubVns0P6hi+mr+l2tHZd3d6BBG806e9ydTm xS7gzlngyS1sxHFkUaL95cAuglr9MfI= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=WZPrkSzC6JP8KIWSSwxcdUJBQA5TQKYe+UX++Ksig+4=; b=LO+DAdQYF+uOX8P49gTNG+QF1I iomfriNZnLrSsbT+efu9ZZXDF39DBlZIPZaw6ArFquVPkduQutCMvzh6oOd6PogtNkPlSClaZG+VU MOU+WEVg9/Wvpk39S11AcVL6pUcFgdh6w6nVt/nhtQtw/mUnUKl4ZjobkCPZ6vXsiqUo6lVxUDUAJ a6zoDPLVBnonIiXI3nl8p0altSRMBdxDvz/Dn+p4uyE5eDbw/Ad529L5WjibG1+bxH7TfAVlkd8+d YLpMJi+IoZsAverQmxLphYqvJ2F0m4+adZrixurxP2Vj74Nzur0pWuKELHXzvf4ngQ9iYrPAXSoPE osusjb6A==; Received: from 2a02-8389-2341-5b80-39d3-4735-9a3c-88d8.cable.dynamic.v6.surfer.at ([2a02:8389:2341:5b80:39d3:4735:9a3c:88d8] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rTMHS-00000004CpB-3el1; Fri, 26 Jan 2024 13:30:03 +0000 From: Christoph Hellwig To: Chandan Babu R , "Darrick J. Wong" , Hugh Dickins , Andrew Morton Cc: linux-xfs@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 12/21] xfs: don't modify file and inode flags for shmem files Date: Fri, 26 Jan 2024 14:28:54 +0100 Message-Id: <20240126132903.2700077-13-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240126132903.2700077-1-hch@lst.de> References: <20240126132903.2700077-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Rspamd-Queue-Id: DB64CC0023 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: 6yh6zb5dmjdmdb8ga76hyun85ndo9c75 X-HE-Tag: 1706275805-644278 X-HE-Meta: U2FsdGVkX1/T6J9jtC2nv9v9+3ab+cYO75GXKgEksjpXoSoAh59H21yP/9oObenqxA+LnSyg6JVEXahfpLimNJmWVqEJsXgLf6NQ7UIk8XAyf+zdqdNadEevPjHbOx59wE6IMp9Kt4Ou1jby5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HfRopybB2ZCUbD3w4z38MG+6hFaitY4ibjFlHCfj+nZ4ka5xaRoe4vnvnmfzcXD+GGvRg0i1r883GAt/m6nWetWCeI9RhGwlHDte6/hzVEMXek8/4eNoPCXNspX1HBX6tH+XIvv3JCkzUJTLaQNrK5pjGCibJlCiRY//qY5hP60G1iHgileBCC4wwSTJBRxGVBZ6H2glETa/Zf8aTVbrukhEe86lFCtY7b6w3VDxmDg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: shmem_file_setup is explicitly intended for a file that can be fully read and written by kernel users without restrictions. Don't poke into internals to change random flags in the file or inode. Signed-off-by: Christoph Hellwig Reviewed-by: Darrick J. Wong --- fs/xfs/scrub/xfile.c | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/fs/xfs/scrub/xfile.c b/fs/xfs/scrub/xfile.c index 7785afacf21809..7e915385ef0011 100644 --- a/fs/xfs/scrub/xfile.c +++ b/fs/xfs/scrub/xfile.c @@ -68,28 +68,13 @@ xfile_create( if (!xf) return -ENOMEM; - xf->file = shmem_file_setup(description, isize, 0); + xf->file = shmem_kernel_file_setup(description, isize, 0); if (IS_ERR(xf->file)) { error = PTR_ERR(xf->file); goto out_xfile; } - /* - * We want a large sparse file that we can pread, pwrite, and seek. - * xfile users are responsible for keeping the xfile hidden away from - * all other callers, so we skip timestamp updates and security checks. - * Make the inode only accessible by root, just in case the xfile ever - * escapes. - */ - xf->file->f_mode |= FMODE_PREAD | FMODE_PWRITE | FMODE_NOCMTIME | - FMODE_LSEEK; - xf->file->f_flags |= O_RDWR | O_LARGEFILE | O_NOATIME; inode = file_inode(xf->file); - inode->i_flags |= S_PRIVATE | S_NOCMTIME | S_NOATIME; - inode->i_mode &= ~0177; - inode->i_uid = GLOBAL_ROOT_UID; - inode->i_gid = GLOBAL_ROOT_GID; - lockdep_set_class(&inode->i_rwsem, &xfile_i_mutex_key); trace_xfile_create(xf);