Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp229907pxb; Thu, 12 Nov 2020 02:12:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJx58ALLQMJmUXXR/aBotm0wvQS0wbX/mAX8LhAeKETku1pvNGGtFzWXkHp1a2xvq9eKWDvO X-Received: by 2002:a17:906:7797:: with SMTP id s23mr28520499ejm.312.1605175950679; Thu, 12 Nov 2020 02:12:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605175950; cv=none; d=google.com; s=arc-20160816; b=gM1Kl+dj3TcnwcOBFaw05aO6a4OW+XoW0Z7BmwWvo6UyCudD2iCrAFXH47XwuHKmC6 LcZHF5PWqZoCM+yEEuHO1Q+yzlg81wrB3S15+0bWvbUr1avlRfYmN8ck7qJLhu9AE+aD yPolpqtLzUV1X353ayEplQlaLjbvOC44TP0L1TIEB7hometqMIr7x+xBi9v+z17mti3h jhNglRD8f44B0RwDkGgKqQL5Y/yWTfMm/+A7mQMvKIHNE0Sr4Qv+5kwyqqcgVT6i52k8 91AiCqnGAFKOBIWahB11KitVMTW9/5dgbrWwQdIAOXpR7LihUrahLePlfJoq5lW+cICo Ll2A== 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=mN6XtDH5GCVzhWM0GbCs/8VRij6kerhevnCXOC53c/L+oxxZ792ynHzgKtmJojokCp ZPaoIIvQCq4osUowMQI7AAqS35+/CflRAuT/fL1QcrozeRX2Ki8O/usQbHmCMehPVyGs /nC+S2ULEzLCNKMWJjKjyk0KuclPHGlK1CiKDV8x0L2brhoeU79jGMSQoMPKcfVfl1Dq knHC1OLRiE0bHSHLUy0gzWtRrBiWOeXcGlGMEZUeYr1pBcI0TZWYGDzC8d3RlmwanI70 Q4rWJ1tp+6Xc/TkNz0nUnX9zqHOQMwBWd+Naz73J0RaqeBKnEicQRnAexWmXKytu8bfX HqJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sargun.me header.s=google header.b=DsVxq8Dz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 be27si3595806edb.518.2020.11.12.02.12.02; Thu, 12 Nov 2020 02:12:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-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=DsVxq8Dz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727912AbgKLKK1 (ORCPT + 99 others); Thu, 12 Nov 2020 05:10:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727880AbgKLKKW (ORCPT ); Thu, 12 Nov 2020 05:10:22 -0500 Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00514C0613D4 for ; Thu, 12 Nov 2020 02:10:21 -0800 (PST) Received: by mail-pg1-x543.google.com with SMTP id f18so3756014pgi.8 for ; Thu, 12 Nov 2020 02:10:21 -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=DsVxq8DzpPg4HEWezGB4gg/3D+K7pKGkupttoZLwON2YQQ9cUUGk/y0TqeHNiTaAP3 UuJfU8bXy6ps54ZMEfVGNG5KyDTlmYNHrdrT0XsAaJLRIDzz0E1jfltR8Rzc6A3kDHuj tlgV4dNLIW8ssTszCeZjDc+3CPzyAFSbRg/gE= 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=YQ15fqEAF+iTNQibViBfk9PBO8xr+i4gR5WnscBB7SjBZelfIss05Su5UHiBjMnMWP fLkpNGASYDZFEh1oG1CTJ4FfCVcA9sVDhf1skvsb4cye4IVdEsfpoevhYELPK4HfuG0g DkZZA/7IMKs41gFwIQM5oxmFpKpkyssVrgKC0e7pPRRcN1GlyrcZtwFIcKjmP9obTlE4 yaJt0YNAzTyeqRIkzRO/h53qryHGAbQmlacpwgp/07vH4D9dGtZkVXhbgv6SJBJ7Suv+ vDv1riAfaR1keaIbqDORRF2ivEMEi3v2tluRjknI46IMYOulje9pJI19bVlcfUMGR9Tu nAXg== X-Gm-Message-State: AOAM533jTaN7K2V1oTUwXyQ5l3iaCoT0oyRL0P0/uujMXzesIDiIfHTj RGlTYnIFEoPWEduiHhI9+U8ULQ== X-Received: by 2002:a65:6a54:: with SMTP id o20mr24145240pgu.38.1605175821486; Thu, 12 Nov 2020 02:10:21 -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 n1sm5577060pfu.211.2020.11.12.02.10.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Nov 2020 02:10:20 -0800 (PST) From: Sargun Dhillon To: "J . Bruce Fields" , Chuck Lever , Trond Myklebust , Anna Schumaker , David Howells , Scott Mayhew Cc: mauricio@kinvolk.io, Alban Crequy , Sargun Dhillon , linux-nfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Kyle Anderson Subject: [PATCH v5 2/2] NFSv4: Refactor to use user namespaces for nfs4idmap Date: Thu, 12 Nov 2020 02:09:52 -0800 Message-Id: <20201112100952.3514-3-sargun@sargun.me> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201112100952.3514-1-sargun@sargun.me> References: <20201112100952.3514-1-sargun@sargun.me> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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