Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp4048059ybv; Mon, 10 Feb 2020 11:16:27 -0800 (PST) X-Google-Smtp-Source: APXvYqwzBKftHEYSwhEdp84v4hTo0BGdn9vMarBUQrk+b2mE/u0Q54Ir/grDzfzL/VobHJMYgica X-Received: by 2002:aca:c70b:: with SMTP id x11mr381368oif.29.1581362187054; Mon, 10 Feb 2020 11:16:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581362187; cv=none; d=google.com; s=arc-20160816; b=y3kjBnkfyYmIvMypAgIH9zDXh8hiAAc09g2BKmkGvu6CUsZF2LElqcz34/JFA8je+L TyOotZwlXDnfpTwRmZrUL5MxQElSn7Fd+1mSIbbYK5uQ1ibCghhG/dZOQfhTFSpPZ+y7 0wbd/pdXxH7RveO96GmUInR+2AhTVIq0OPg534FkCMCoQave2ruhrIWJj2DtI5+/E4Or 3GSYXUChjB5+YlE7TGipDMbwJmHIfvmmwjzhx+oNZuYNk6otF2F4PThKEhNICpH3bGHO 1YEUslAkQ+moytbykHyoK5j3tdY/MpRHcCSUD9J+drZxtmlj0b8nmNBCBr1L7zfVOGHC SmIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=DHtLO0P0Zh+VIrDFcyw7AYu4iOARJCtRd5zyI+nBa7U=; b=uFrY648bu3XzpJkDVZkOUjXYjdERMyIZbqI7DwHLjC+EOTAKTyFH4cvhQZ4chJXA36 uEwe9O8InDPPXwa9dmnNxMHLLVmwSVxuszb+cdMBXgA2TPsrVDRX+3wiiDOkKWzGDYex B3lubkX/hrZDiCapNTEGyjQxC0XEBwJX/V4a7JpS5j1KtQuJDl8h9IMukx7bOgtczXBZ nez09ai660dWtzTmI6Dc976ZhAgoR2ujdPjoNgy+6MyK6hyRR7QkUwkIgMEPhzkVxDiW agnlmbnd2FhTXJ6dlmI9Iuu6WuzerSp6BqNqjOMbQzY1iXB1VlHckQ3CP4IqC0T+Uuaj Iiug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=sL1kiPZb; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b18si615703otp.17.2020.02.10.11.16.14; Mon, 10 Feb 2020 11:16:27 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=sL1kiPZb; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727555AbgBJTQI (ORCPT + 99 others); Mon, 10 Feb 2020 14:16:08 -0500 Received: from mail-yw1-f66.google.com ([209.85.161.66]:37197 "EHLO mail-yw1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727029AbgBJTQI (ORCPT ); Mon, 10 Feb 2020 14:16:08 -0500 Received: by mail-yw1-f66.google.com with SMTP id l5so3952827ywd.4 for ; Mon, 10 Feb 2020 11:16:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=DHtLO0P0Zh+VIrDFcyw7AYu4iOARJCtRd5zyI+nBa7U=; b=sL1kiPZbuQUD7GMMkSObcRQKjOtJUpRQMlgY2bTY5LAj22TX+Z6wooONERmedkCWIU uf4Gu7H6+zLVxgbRuNXOE753J3bdoTp67sGzPRY/UZSmhbMCpTqD5kKObOfc4wYi7vCj ZCVMLQZ/1h8bC9C6m9i3XClxUPyELkrf+YspgmiQ1+k9ozNdtGRj3H4rHS8uhs0V8wP7 jIirKPm1BABM9a5YjcwUu5Jnqlkn/0wf0/kQ2YwQXDBamQnRUf7OTgEpDpcNAfJXSpy+ R+TVLbrQrZlsVTKXoJtgVYt/VXKRHuHouTmaLANEfHngfNYOmPwDQZHEuvfG3U0B0vrG 08TA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DHtLO0P0Zh+VIrDFcyw7AYu4iOARJCtRd5zyI+nBa7U=; b=WQQwMADrUEFciIVL+YaPXgxgj/l+fJ9ljB5KOW2uZl2QNfHQ2jKCSRfpDIWz+HtvUy GDC8IATQIOg0p5j2Qg2ktdlzHYpmUn0YG2/XxUUm5NzQqWIWOIk2T79x8iOJWzFAtplz nc8nytpnl9GGL4MF15tdIHdb5D8Iaashhqnt6L02dhMWHL59G4sE9yOTqTuOUkI0/eLo bBsWyBrlvBkH6oQU4fsl8j7dMXW/nBQNM/bhFBPvtLWDmAAYUWaKEzJ+aGv7r1vg2Lva aDMEGqyzPzFwFxfRDluMS3lVMTjbDUT1NuSkOSZ7DuhbOjKSGv+eLgMe6dVNFywGByt1 o/mw== X-Gm-Message-State: APjAAAWpCLDb0+mBl1byi1gywYQq6UwWFHDRWiq+YoUVrZ0+1MgLPR2S gNO0mKUnpvLONRnJ5wlzPvwHQQkA3g== X-Received: by 2002:a81:a642:: with SMTP id d63mr2367225ywh.202.1581362166768; Mon, 10 Feb 2020 11:16:06 -0800 (PST) Received: from localhost.localdomain (c-68-40-189-247.hsd1.mi.comcast.net. [68.40.189.247]) by smtp.gmail.com with ESMTPSA id o4sm660222ywd.5.2020.02.10.11.16.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Feb 2020 11:16:06 -0800 (PST) From: Trond Myklebust X-Google-Original-From: Trond Myklebust To: linux-nfs@vger.kernel.org Subject: [PATCH 2/8] SUNRPC: Add a flag to avoid reference counts on credentials Date: Mon, 10 Feb 2020 14:13:39 -0500 Message-Id: <20200210191345.557460-3-trond.myklebust@hammerspace.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200210191345.557460-2-trond.myklebust@hammerspace.com> References: <20200210191345.557460-1-trond.myklebust@hammerspace.com> <20200210191345.557460-2-trond.myklebust@hammerspace.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Add a flag to signal to the RPC layer that the credential is already pinned for the duration of the RPC call. Signed-off-by: Trond Myklebust --- include/linux/sunrpc/sched.h | 1 + net/sunrpc/clnt.c | 5 +++-- net/sunrpc/sched.c | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h index a6ef35184ef1..df696efdd675 100644 --- a/include/linux/sunrpc/sched.h +++ b/include/linux/sunrpc/sched.h @@ -132,6 +132,7 @@ struct rpc_task_setup { #define RPC_TASK_TIMEOUT 0x1000 /* fail with ETIMEDOUT on timeout */ #define RPC_TASK_NOCONNECT 0x2000 /* return ENOTCONN if not connected */ #define RPC_TASK_NO_RETRANS_TIMEOUT 0x4000 /* wait forever for a reply */ +#define RPC_TASK_CRED_NOREF 0x8000 /* No refcount on the credential */ #define RPC_IS_ASYNC(t) ((t)->tk_flags & RPC_TASK_ASYNC) #define RPC_IS_SWAPPER(t) ((t)->tk_flags & RPC_TASK_SWAPPER) diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index 7324b21f923e..2345e563c2f4 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c @@ -1099,8 +1099,9 @@ rpc_task_set_rpc_message(struct rpc_task *task, const struct rpc_message *msg) task->tk_msg.rpc_proc = msg->rpc_proc; task->tk_msg.rpc_argp = msg->rpc_argp; task->tk_msg.rpc_resp = msg->rpc_resp; - if (msg->rpc_cred != NULL) - task->tk_msg.rpc_cred = get_cred(msg->rpc_cred); + task->tk_msg.rpc_cred = msg->rpc_cred; + if (!(task->tk_flags & RPC_TASK_CRED_NOREF)) + get_cred(task->tk_msg.rpc_cred); } } diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c index 55e900255b0c..6eff14119a88 100644 --- a/net/sunrpc/sched.c +++ b/net/sunrpc/sched.c @@ -1162,7 +1162,8 @@ static void rpc_release_resources_task(struct rpc_task *task) { xprt_release(task); if (task->tk_msg.rpc_cred) { - put_cred(task->tk_msg.rpc_cred); + if (!(task->tk_flags & RPC_TASK_CRED_NOREF)) + put_cred(task->tk_msg.rpc_cred); task->tk_msg.rpc_cred = NULL; } rpc_task_release_client(task); -- 2.24.1