Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2616828pxb; Sun, 17 Oct 2021 20:38:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz+gtR9CG8h9rH9sgU322Nctbo+E/qVYA4bOJbtU7bWWYgoAdvr2jDH30mwBqLSkkdZ8RxY X-Received: by 2002:a17:902:788d:b0:13f:7484:ef54 with SMTP id q13-20020a170902788d00b0013f7484ef54mr24975052pll.61.1634528282111; Sun, 17 Oct 2021 20:38:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634528282; cv=none; d=google.com; s=arc-20160816; b=luvUE45Qu0e1Higa8nP+do7twyP6X64qnvcF+f+vc35QSecrZT19q4Lfyewz37FDxe iiGywutrK7/7kRkyDXNgcmxI7ZSRFrxxAW/cTizWEG45gUxX0Xkdw2ZivRMcWB4yR+Xj j+BXqEgKPCVs85q0VHAr8GEjEb+ga157WOcOTqjj+xmMZqj9kwPEDnTSC5xM6JzJ9gCM n7cCkuy2lu/shCJmfhrJgrcclfK3Lc+v1B5cOezF+hQAk3GvEcSudSMUVEL356mOfrk0 EqKb2MS/3+eHAdOVNDKxHCxO3auMN2Fm3R7h5Va7VgaCeAaODKlafapI00quUY4NckN0 TOLw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=o+3nn2ZcHu4uIuHSJoJnFRCFzFrjBAMUq/0hqexA92A=; b=ejQQ0YbylD/U3FStMBNAezKGFnTbhYmAkI17ODdIJctOnOztV0UtyR3XO/VPISSOPk h5xbjT8/RnAPuuRkvmy5Q4serMNHoSEcZF/mNsec/1tzQD+ki9auB9hZxCmy1rWljQU8 eBzg7BuK8NBFSlyJLnodF4ULhsP5DZ7XuRaq/n8pfHjO1N44RDUnkQcdPv4ZU8RZhLZQ vln6jiQFa2H2S8JQJEJ9wX+uUFwDYOuwBGMukNFW4IakG7c7u0vXrN90ReyXX9/rOOCA ZVSg3MoK47CpIrINlxa6/hdtfDDynZDR901lvMgGSmh2mwVE9ze9Y3swxmEKyWVlxGGz OjbA== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l4si19509392plh.175.2021.10.17.20.37.49; Sun, 17 Oct 2021 20:38:02 -0700 (PDT) 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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244691AbhJPWE5 (ORCPT + 99 others); Sat, 16 Oct 2021 18:04:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:36048 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244675AbhJPWEy (ORCPT ); Sat, 16 Oct 2021 18:04:54 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9580060EE9; Sat, 16 Oct 2021 22:02:45 +0000 (UTC) From: Chuck Lever To: trondmy@hammerspace.com Cc: linux-nfs@vger.kernel.org Subject: [PATCH v4 4/7] SUNRPC: Don't dereference xprt->snd_task if it's a cookie Date: Sat, 16 Oct 2021 18:02:44 -0400 Message-Id: <163442176448.1585.14151942803213662102.stgit@morisot.1015granger.net> X-Mailer: git-send-email 2.33.0 In-Reply-To: <163442096873.1585.8967342784030733636.stgit@morisot.1015granger.net> References: <163442096873.1585.8967342784030733636.stgit@morisot.1015granger.net> User-Agent: StGit/1.3 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" X-Developer-Signature: v=1; a=openpgp-sha256; l=2181; h=from:subject:message-id; bh=Kw4yNjULbSjcpbOVAfTWvgi1gPr+frxbyoW4hgZ0ecc=; b=owEBbQKS/ZANAwAIATNqszNvZn+XAcsmYgBha0wEAjFubBrKAcg8Wh/6K/4gdDjr0WbgD+isj+5M l2PWRkqJAjMEAAEIAB0WIQQosuWwEobfJDzyPv4zarMzb2Z/lwUCYWtMBAAKCRAzarMzb2Z/l0mYD/ 4wRYk6fXpfZnK+wNWNPHEOO5ct2Rdp19K10/VF0/2ZAx7WmxWSTPG1k+qxA1lTaQVaGSSahU9Zd5DJ VOwmFBGQ57/lnB1mOz5pXIEzgJgPadasYV1Of9boHM+XEtid1Cn8+Wr2JjfLVZRvSCrUki9qvEAJO1 ac5uM5fSWSPU9eupmDBEATKjKNhNmvUlmIkc0uE17bnQthFfoavz+36laSBWuAxPlUEOYoxU967vZk XhjmWsJGZ4reW/UOgUc/+iHvUtHSLuF+WXV7le8F4jDF03fHuwIFA76TL3xvGMMTdrF8LN3nYD/f25 8BTJQmQyshhNX2whU/DiAvm6eFf/aEqppJx7vvC4G73KmNmmoQsN49wK7rma8U49MMKIu2g6ONQ7vA /8vlHVPd/Zuh86r4a0qA0F72iptViH1/B5D/THp6Fv8zRTwhOX5S03xC0cuF/MO08brv9AmuPLQlt+ GPyOrWGYCE2l1GN4J/D/uLw59vZYc8isrgHBgc/7rh/6jhqLCpq28MO69ljgl6iPkyb27H/U/L2P7h OIQk36dVc61EV/7jjZIn8YhMVqCP/KYkmfliHydE/O8MH70lHZU0AHONCC5WIQNl5dhAEgJPmu7PNN MExioHjC/vwNHNt1KmKOD1rzHFnqHPTjONR6l82V07iCsaEVIAy5NThZ87Pw== X-Developer-Key: i=chuck.lever@oracle.com; a=openpgp; fpr=28B2E5B01286DF243CF23EFE336AB3336F667F97 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Fixes: e26d9972720e ("SUNRPC: Clean up scheduling of autoclose") Signed-off-by: Chuck Lever --- include/trace/events/sunrpc.h | 9 ++++----- include/trace/events/sunrpc_base.h | 9 +++++++++ 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/include/trace/events/sunrpc.h b/include/trace/events/sunrpc.h index 9caf4533366e..83c2a1cb2e3a 100644 --- a/include/trace/events/sunrpc.h +++ b/include/trace/events/sunrpc.h @@ -932,7 +932,8 @@ TRACE_EVENT(rpc_socket_nospace, { BIT(XPRT_REMOVE), "REMOVE" }, \ { BIT(XPRT_CONGESTED), "CONGESTED" }, \ { BIT(XPRT_CWND_WAIT), "CWND_WAIT" }, \ - { BIT(XPRT_WRITE_SPACE), "WRITE_SPACE" }) + { BIT(XPRT_WRITE_SPACE), "WRITE_SPACE" }, \ + { BIT(XPRT_SND_IS_COOKIE), "SND_IS_COOKIE" }) DECLARE_EVENT_CLASS(rpc_xprt_lifetime_class, TP_PROTO( @@ -1118,8 +1119,7 @@ DECLARE_EVENT_CLASS(xprt_writelock_event, TP_fast_assign( SUNRPC_TRACE_TASK_ASSIGN(task); - __entry->snd_task_id = xprt->snd_task ? - xprt->snd_task->tk_pid : -1; + SUNRPC_TRACE_SNDTASK_ASSIGN(xprt); ), TP_printk(SUNRPC_TRACE_TASK_SPECIFIER @@ -1157,8 +1157,7 @@ DECLARE_EVENT_CLASS(xprt_cong_event, TP_fast_assign( SUNRPC_TRACE_TASK_ASSIGN(task); - __entry->snd_task_id = xprt->snd_task ? - xprt->snd_task->tk_pid : -1; + SUNRPC_TRACE_SNDTASK_ASSIGN(xprt); __entry->cong = xprt->cong; __entry->cwnd = xprt->cwnd; __entry->wait = test_bit(XPRT_CWND_WAIT, &xprt->state); diff --git a/include/trace/events/sunrpc_base.h b/include/trace/events/sunrpc_base.h index 2cbed4a9a63a..abdffe4f53d6 100644 --- a/include/trace/events/sunrpc_base.h +++ b/include/trace/events/sunrpc_base.h @@ -25,6 +25,15 @@ } \ } while (0); +#define SUNRPC_TRACE_SNDTASK_ASSIGN(x) \ + do { \ + if ((x)->snd_task && \ + !test_bit(XPRT_SND_IS_COOKIE, &(x)->state)) \ + __entry->snd_task_id = (x)->snd_task->tk_pid; \ + else \ + __entry->snd_task_id = SUNRPC_TRACE_PID_SPECIAL; \ + } while(0); + #define SUNRPC_TRACE_PID_SPECIFIER "%08x" #define SUNRPC_TRACE_CLID_SPECIFIER "%08x" #define SUNRPC_TRACE_TASK_SPECIFIER \