Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2419844pxu; Mon, 14 Dec 2020 01:41:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJwiEjNe4Xs/oKjrm0TGON+lF4aVDBxDALIQ5UISxZ+yd+NdEqwPu89l/vVkmxOzOPawh6Ag X-Received: by 2002:a50:ee11:: with SMTP id g17mr24934525eds.259.1607938891421; Mon, 14 Dec 2020 01:41:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607938891; cv=none; d=google.com; s=arc-20160816; b=adLJaHOmmL8VSKxJ2Te6SYiE3KWwYOLx/ocvHPZ1bTGWMlYqfnL1lo37jKrLlVnSz6 /Q51ZkJGHanFUsEl6TxJkHPSt58T69JxOcf392jZduf1ACgJtkOwDeZ3JpPR9WNdV5Es JG/F1JT88j5r9+XAc1o29cKR+4BSuhjcVUc8TWi9hYOzKbOiM6RDjfAiuBLzgBuoKq/0 tp2b2Nk9PQ6xDmSBUzd6TRpYp3JhymRYcBSDmYKuP5klZb65a63Zfs3G+1pfVvHYru0i DeO+IDN05+iZTge5S+KZ2puEob6sP2SL8tlB46jkOVLlMWJBE1oxI0Kv+rZ7ZILMNZ73 BIaA== 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 :dkim-signature; bh=NXvCHpzC4yHknkYUeuKH4ChAz6pAIcFQihq+5IBCqGs=; b=1BNoJIp6IvC5B+vobsPqcoQebLuW8XN3fKy5NoVw+yhioY2LU0f9HR8NfyaPKpFVNW xf9d3mnaMEefl33XL41/Vzmx2ho4lr6NPgeZ8yq2NRt+fP2FznX4Om4Is6VLhnz8zboC en5zNUrnCJXOCB7NC5qsUGtNasQkt4WZdl8BhxoBQOZDiFyPkfLmV8auIQ0ulhAF5JUY 0PoKhzcjpfSPQI1Li95yDm/kVBOnqSedtz1InqssnETdm8qM5j3hqdtNyzN4Btrr1eZX P0J5RXziCVu4io6fG27KHoESaj3rS11GVbDcoolsDgk8CCZQuXMFxvOyYAAqErUljuub 0q6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sargun.me header.s=google header.b=Fddofxw8; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-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 c1si10030805edx.275.2020.12.14.01.41.08; Mon, 14 Dec 2020 01:41:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@sargun.me header.s=google header.b=Fddofxw8; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2438068AbgLNCyn (ORCPT + 99 others); Sun, 13 Dec 2020 21:54:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2438109AbgLNCyi (ORCPT ); Sun, 13 Dec 2020 21:54:38 -0500 Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8526FC0617B0 for ; Sun, 13 Dec 2020 18:53:15 -0800 (PST) Received: by mail-pf1-x444.google.com with SMTP id 11so11139110pfu.4 for ; Sun, 13 Dec 2020 18:53:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sargun.me; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=NXvCHpzC4yHknkYUeuKH4ChAz6pAIcFQihq+5IBCqGs=; b=Fddofxw8GEI7/ddW41jojqQlbr3awy3c+LUjmqsgXOgCU2mPSYisSbooN9UQ5+XovY ltcvS+KRyuLoQImh7pI1I2alBShPFBH8Nn6NEqRAeZ8ZKd0SZBD7cDvs3ECeNhHf2Fnk vI45LPU46Kzcz4bMBPws1Os8P04vvjvgIz9UI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=NXvCHpzC4yHknkYUeuKH4ChAz6pAIcFQihq+5IBCqGs=; b=R5+pMZeQGE4M1ysS6TVQhqpJen6S+u/dJHLyKYxW/zbpIfiYjc5uLKudVjSX96T+cZ o0Ge8fo41+xmwmjn+BTfViuQ01Vy2MLYgxDV1YQ+NnZDfYWUmxPJZup2CpYzWB2nDMIY ivqiZSjIgXI44rPChuDrKJRCqQvFrrE1jdzdOg+zEe8NhP0IlhrYHZz+Qe659ujEYhwr ymLYczTl6BiN1QDIph67qDybbJkptGq3idXW+RVgEOVMgLtDx+pICRr9hNvXm8TfeaJL Da5748+Ni6n176mC4O1yCM5LruN5WEUA8h8gq9uKvDIU5zU0VKMeE0b4wFidXNxO3pJi FKPA== X-Gm-Message-State: AOAM531RSyjEThvmiu/GNckRvJRoyFHR38fkrwYqNXQ/hpLxIQcP1fUK qkiJBmybR4ygBbr/L43Pksp3AQ== X-Received: by 2002:a63:4d12:: with SMTP id a18mr22071092pgb.17.1607914394956; Sun, 13 Dec 2020 18:53:14 -0800 (PST) Received: from ubuntu.netflix.com (203.20.25.136.in-addr.arpa. [136.25.20.203]) by smtp.gmail.com with ESMTPSA id h20sm17102713pgv.23.2020.12.13.18.53.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Dec 2020 18:53:14 -0800 (PST) From: Sargun Dhillon To: Trond Myklebust , Anna Schumaker , "J . Bruce Fields" Cc: Sargun Dhillon , David Howells , linux-nfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, mauricio@kinvolk.io, Alban Crequy , Christian Brauner Subject: [PATCH RESEND v5 2/2] NFSv4: Refactor to use user namespaces for nfs4idmap Date: Sun, 13 Dec 2020 18:53:05 -0800 Message-Id: <20201214025305.25984-3-sargun@sargun.me> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201214025305.25984-1-sargun@sargun.me> References: <20201214025305.25984-1-sargun@sargun.me> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org In several patches work has been done to enable NFSv4 to use user namespaces: 58002399da65: NFSv4: Convert the NFS client idmapper to use the container user namespace 3b7eb5e35d0f: NFS: When mounting, don't share filesystems between different user namespaces Unfortunately, the userspace APIs were only such that the userspace facing side of the filesystem (superblock s_user_ns) could be set to a non init user namespace. This furthers the fs_context related refactoring, and piggybacks on top of that logic, so the superblock user namespace, and the NFS user namespace are the same. Users can still use rpc.idmapd if they choose to, but there are complexities with user namespaces and request-key that have yet to be addresssed. Eventually, we will need to at least: * Separate out the keyring cache by namespace * Come up with an upcall mechanism that can be triggered inside of the container, or safely triggered outside, with the requisite context to do the right mapping. * Handle whatever refactoring needs to be done in net/sunrpc. Signed-off-by: Sargun Dhillon Tested-by: Alban Crequy --- fs/nfs/nfs4client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/nfs/nfs4client.c b/fs/nfs/nfs4client.c index be7915c861ce..86acffe7335c 100644 --- a/fs/nfs/nfs4client.c +++ b/fs/nfs/nfs4client.c @@ -1153,7 +1153,7 @@ struct nfs_server *nfs4_create_server(struct fs_context *fc) if (!server) return ERR_PTR(-ENOMEM); - server->cred = get_cred(current_cred()); + server->cred = get_cred(fc->cred); auth_probe = ctx->auth_info.flavor_len < 1; -- 2.25.1