Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp208230pxb; Thu, 21 Jan 2021 05:25:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJzwMQkVaxiAzo22T69z8XHtwfFThVxcR85OFLhftf3h1hj4bD3vzwE/y7zva0zsD8Zz7/wh X-Received: by 2002:a05:6402:35c2:: with SMTP id z2mr10851543edc.34.1611235549816; Thu, 21 Jan 2021 05:25:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611235549; cv=none; d=google.com; s=arc-20160816; b=kN9g4tQDL8Os+VnkNbdtF6NWKHJMlVJYl/FFZyqIi3qZYvUKGFAnLCET/5lkh7SVZR IE/GkrrQIc57km4hqUcLxGKn9vaDXbe5Snn//prpVwX6ykxxcCr4zmjNZ3+N/lx8wjqf 6NJj8jhfn/ADLUcO8PnO0cxL6QpyuW72XyXFYC+gh3KHZflOoHU3Zn+ZREYS46kXanan F9PoKRnWiaAKzBdkqOyMlszBfmiFzBS4TCOZC/0Vc8XYyqtm+jNfD0FyAuAsshK91a0N MjwFg7IbxBLz+eFDPzD9p9sBHuUvc6/CTroudRaF5b5QV4UXF7TJb794J1h8DAmU0OQv 8zkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=u33crw0jAK62MB7KvPjm0gC/DA2KxKilLzsXSfbFEP8=; b=YnFHD2664mRGIWhKjv3XOaCasDbTmu1NhbhbuUN92u/k+9ZYNxNIpTkdOR9nfyHUS4 lmUs9U77BbAjSmeg9a6VAQYB+YKaDUER+Dh1ghyrPqWfppUrpVP499gFSmJjmFq3nJ1a XTtEn3jqlVhlRzF1Ep3oB9LE2oSICPnX8ARpcKf/DB3WZ6HQ+zKrmGSD+uQqdk9S8pj6 BpIRDxxY+b7yqbsOFSzj4kBrnSYOACD3tzc0j4vueqeJh/z7S1pvNSa7HZzKZowgSs/t WRuKVDyqcjAmkQjuZKNCjSQFLzwjRE+qjtS0DKk+k75vTAMrItgfWxIa4p014jWquJzJ 6/aA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f26si2144991edq.200.2021.01.21.05.25.26; Thu, 21 Jan 2021 05:25:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731824AbhAUNZN (ORCPT + 99 others); Thu, 21 Jan 2021 08:25:13 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:54169 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731978AbhAUNWX (ORCPT ); Thu, 21 Jan 2021 08:22:23 -0500 Received: from ip5f5af0a0.dynamic.kabel-deutschland.de ([95.90.240.160] helo=wittgenstein.fritz.box) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1l2Zu0-0005g7-MY; Thu, 21 Jan 2021 13:21:33 +0000 From: Christian Brauner To: Alexander Viro , Christoph Hellwig , linux-fsdevel@vger.kernel.org Cc: John Johansen , James Morris , Mimi Zohar , Dmitry Kasatkin , Stephen Smalley , Casey Schaufler , Arnd Bergmann , Andreas Dilger , OGAWA Hirofumi , Geoffrey Thomas , Mrunal Patel , Josh Triplett , Andy Lutomirski , Theodore Tso , Alban Crequy , Tycho Andersen , David Howells , James Bottomley , Seth Forshee , =?UTF-8?q?St=C3=A9phane=20Graber?= , Linus Torvalds , Aleksa Sarai , Lennart Poettering , "Eric W. Biederman" , smbarber@chromium.org, Phil Estes , Serge Hallyn , Kees Cook , Todd Kjos , Paul Moore , Jonathan Corbet , containers@lists.linux-foundation.org, linux-security-module@vger.kernel.org, linux-api@vger.kernel.org, linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org, linux-integrity@vger.kernel.org, selinux@vger.kernel.org, Christian Brauner Subject: [PATCH v6 18/40] utimes: handle idmapped mounts Date: Thu, 21 Jan 2021 14:19:37 +0100 Message-Id: <20210121131959.646623-19-christian.brauner@ubuntu.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210121131959.646623-1-christian.brauner@ubuntu.com> References: <20210121131959.646623-1-christian.brauner@ubuntu.com> MIME-Version: 1.0 X-Patch-Hashes: v=1; h=sha256; i=44kXqCfVtOQgFKzT2JXoGuiPGIT5dbn7iuHoFJrc8vE=; m=fnbUZ5UGVKFS/BL4Fs22j3jnis8STw4BWvoQB147YuE=; p=Y3rOll02aLsQtLHlyfzEpxjepW4qLLQsjQl3nf5dF2c=; g=22ce77554a328434b5730a0cbcd583e22f436b33 X-Patch-Sig: m=pgp; i=christian.brauner@ubuntu.com; s=0x0x91C61BC06578DCA2; b=iHUEABYKAB0WIQRAhzRXHqcMeLMyaSiRxhvAZXjcogUCYAl9pQAKCRCRxhvAZXjcol2SAP9yEAx 7MI/hV77hhWE3fYi6udD+YR8EgkUUwvvTtU/SoQEAkuTOeKn37pvI5Mk/rSgKEgXpkWccNbXSv3GV rc22MQo= Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Enable the vfs_utimes() helper to handle idmapped mounts by passing down the mount's user namespace. If the initial user namespace is passed nothing changes so non-idmapped mounts will see identical behavior as before. Link: https://lore.kernel.org/r/20210112220124.837960-26-christian.brauner@ubuntu.com Cc: Christoph Hellwig Cc: David Howells Cc: Al Viro Cc: linux-fsdevel@vger.kernel.org Reviewed-by: Christoph Hellwig Signed-off-by: Christian Brauner --- /* v2 */ unchanged /* v3 */ unchanged /* v4 */ - Serge Hallyn : - Use "mnt_userns" to refer to a vfsmount's userns everywhere to make terminology consistent. /* v5 */ unchanged base-commit: 7c53f6b671f4aba70ff15e1b05148b10d58c2837 /* v6 */ base-commit: 19c329f6808995b142b3966301f217c831e7cf31 - Christoph Hellwig : - Don't use unnecessary local variable just call mnt_user_ns() directly. --- fs/utimes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/utimes.c b/fs/utimes.c index 4572b91ddb91..39f356017635 100644 --- a/fs/utimes.c +++ b/fs/utimes.c @@ -62,7 +62,7 @@ int vfs_utimes(const struct path *path, struct timespec64 *times) } retry_deleg: inode_lock(inode); - error = notify_change(&init_user_ns, path->dentry, &newattrs, + error = notify_change(mnt_user_ns(path->mnt), path->dentry, &newattrs, &delegated_inode); inode_unlock(inode); if (delegated_inode) { -- 2.30.0