From patchwork Wed Jan 3 08:41:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13509725 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 C597BC3DA6E for ; Wed, 3 Jan 2024 08:42:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5562C8D0038; Wed, 3 Jan 2024 03:42:20 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5061D8D0035; Wed, 3 Jan 2024 03:42:20 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3CE0F8D0038; Wed, 3 Jan 2024 03:42:20 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 2BB6E8D0035 for ; Wed, 3 Jan 2024 03:42:20 -0500 (EST) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 0932D1A0277 for ; Wed, 3 Jan 2024 08:42:19 +0000 (UTC) X-FDA: 81637358040.18.7194E67 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf04.hostedemail.com (Postfix) with ESMTP id 5FC7940016 for ; Wed, 3 Jan 2024 08:42:18 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=dIo4HWAQ; dmarc=none; spf=none (imf04.hostedemail.com: domain of BATV+f852f126c6d693376302+7437+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+f852f126c6d693376302+7437+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=1704271338; 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=vVoQtZKk55rO4xv81RRfDMeBVcwce9ZJZyjeyjkymuE=; b=IIpVBzErKg/pGJbeQE4qQo4F1isEUQnIiu+4J10sW83tuqSAs/Di/XITfPJMLorpp0i/Ou WVY7jMKsr7PJdXPLIYG1CwLr+fenOX+LWkfBcvxu7TImeOXOfDRKG4/R1Ne9qB8eeyP1YT hm7Z6UgmJWxxx/0QSzpYOPXsb2bVtUw= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=dIo4HWAQ; dmarc=none; spf=none (imf04.hostedemail.com: domain of BATV+f852f126c6d693376302+7437+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+f852f126c6d693376302+7437+infradead.org+hch@bombadil.srs.infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1704271338; a=rsa-sha256; cv=none; b=KXmVPCtmlyEvhSYeXy/Jaj/gUu5tOjkFoeDBEMh/xeGbZ7wMMC4RwvQjaxipEmwQERrN8d ddeId5oreDpFjgjcDH/zEdTMzXCOF2bz9IweIeQPWkXEcXHDMv160tMU/ApA+TlkVy/aJX VLrvOr4wokSDcpTzMinyXcw1XGmsw+I= 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=vVoQtZKk55rO4xv81RRfDMeBVcwce9ZJZyjeyjkymuE=; b=dIo4HWAQ4jBdBUrCa8HgcaHmqb cnkCOPKDa8/RKeP35BaIUuT3ZPL7yRiw4vyi8g0fGYsgR2JntH3l0eicoCFrDarQjT2QQ27wTl08Y NyMqFtK71zSKPu0wGjw+rHT9YJ6D5ABzxd5tMvd6Ih/QQtAuK3fdV66LvqtmwloHqXdnCu4y5nSEr g9jBFHyBsE6quFf9IL5MLZmx+gbrPk0rZ43mKr1/QPTNZtwoKxSNCwyZT6ZVSTqekcEyUrvDaCM1M DfJ/mYJbRXVn37v0wCL6kmSB21j9LGDfJBC0H+7xg4O691TOzLBvZn/rLkgxdNaTfpjEuS+N6HxHW HTzBi+bA==; Received: from [89.144.222.185] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1rKwpJ-00A6jx-0n; Wed, 03 Jan 2024 08:42:13 +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 08/15] xfs: don't modify file and inode flags for shmem files Date: Wed, 3 Jan 2024 08:41:19 +0000 Message-Id: <20240103084126.513354-9-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240103084126.513354-1-hch@lst.de> References: <20240103084126.513354-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: 5FC7940016 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: ibbobe6s6jrbcz1paisx1u5xo43agfkn X-HE-Tag: 1704271338-988349 X-HE-Meta: U2FsdGVkX1+ELxGJ8GUXyWeLY+Bx6R+rR01DD01pgb0b3upMF65r5gg3/V8Aa4FNNyuO9YL/WEVI/pwf9S4wXq7ZBbKPV/yI+P9HR+cBiQ1yIDLJHmkWWFLxp/8O0otAACL5LrjFSMQJfEqg3qERLW39Ie5kTFx3uQNf8+h9jvhmVUkyiBPMFkA5GVrmC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dwXVLDIDqcBhL62S5sJ8XVS294ICdai2zTrJgTIyIGf2x1/XuMGledzgDAlTiFKSz9aVMmikWoouA/vaa3q8F2QmcFCNWvJqU8CWzCu 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 --- fs/xfs/scrub/xfile.c | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/fs/xfs/scrub/xfile.c b/fs/xfs/scrub/xfile.c index ec1be08937977a..e872f4f0263f59 100644 --- a/fs/xfs/scrub/xfile.c +++ b/fs/xfs/scrub/xfile.c @@ -74,22 +74,7 @@ xfile_create( 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);