Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp2486270rdg; Mon, 16 Oct 2023 06:09:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGBLH3LB6tAISipINWX4MyBt3iuSpNiim9ZxWYGPQCGrr/wrSZIkcWQvA1nhNAk0j77osL1 X-Received: by 2002:a17:90b:352:b0:27d:61:cd21 with SMTP id fh18-20020a17090b035200b0027d0061cd21mr14696739pjb.29.1697461791484; Mon, 16 Oct 2023 06:09:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697461791; cv=none; d=google.com; s=arc-20160816; b=dxWMsN2H5mOU6NkXyKeOYqvYjL2H+fagKqy1vHr3c3W3j+waRlK50FL25phb4idqqG /Resf+/FbUxtPZGkT+1YBB8wjuPrY+gS/WUyhELQH1SYQN71yQdNXxPyK3Ds3E7r+y9K PsDef4VHhADEdeejDgZQkP1xfS3CfviVNCUUm3eoeURBp3vOw6UM86mNdbVP1Q+ohObE 3j+s1yHr+y5ycQZnIw6i8aDosZixNnpTuB+gvXqlvhprh7Sun6P39Jy86nOkkf7uRtdy PUiPzo8xKoA0vWF+fwKr+KYb2IwUwsH1xFoyT2Ylbvv16FT+5JwMBmHPJQ0LWOneIoa6 Eutw== 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=QZJtC6raSt+fVWBYkd5+HyWTihwYxT8DSuKXm1Opy00=; fh=evS3aUrU/I5oCeVcohdQw8o65qAkYJ3kfRZuF+2OVfc=; b=lInyEazE5bc8+JseW0oHRtrPvMViMR1ORQ+NXy7jSyf2eC6C7dnwzUKyrLDBzfwFqf Z6bniY9x7jhXHvvPKb4yRxa4SW4uj75liVX2HGr4WiBJQbjD0FAoj7F9WooNhz5ES4JC ZkNzTS0tJGOrIJATm1gPCzys3UAhUP5T7yPxH1i308FymDXZmMtQkb9i9Ba1BfoQ2dCK 9tnBzJQgChuEOBgKYLFaBjcIXq9QpqUuiWqYQvBq2Hr949mHWdMc31IbJNsrGjAhAZWc meZwD3WWG6CNjg3wnH6u+HYs/7oD7suksQVSHfRIMKB5eSMq0Qk0pw0o09rgGwgkCpci l5zA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id g20-20020a631114000000b00563d74b6347si10404574pgl.863.2023.10.16.06.09.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 06:09:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 55CEE80765F4; Mon, 16 Oct 2023 06:09:48 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233485AbjJPNJd (ORCPT + 99 others); Mon, 16 Oct 2023 09:09:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233491AbjJPNJ2 (ORCPT ); Mon, 16 Oct 2023 09:09:28 -0400 Received: from xavier.telenet-ops.be (xavier.telenet-ops.be [IPv6:2a02:1800:120:4::f00:14]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 439B1F0 for ; Mon, 16 Oct 2023 06:09:26 -0700 (PDT) Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed40:ce84:d8c0:f79a:fa0]) by xavier.telenet-ops.be with bizsmtp id yd9L2A00k0pDX7N01d9Meh; Mon, 16 Oct 2023 15:09:24 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtp (Exim 4.95) (envelope-from ) id 1qsNLR-006jYu-Do; Mon, 16 Oct 2023 15:09:20 +0200 Received: from geert by rox.of.borg with local (Exim 4.95) (envelope-from ) id 1qsNLU-00A9nW-R3; Mon, 16 Oct 2023 15:09:20 +0200 From: Geert Uytterhoeven To: Trond Myklebust , Anna Schumaker , Chuck Lever , Jeff Layton , Neil Brown , Olga Kornievskaia , Dai Ngo , Tom Talpey Cc: linux-nfs@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven , kernel test robot Subject: [PATCH -next v3 1/2] sunrpc: Wrap read accesses to rpc_task.tk_pid Date: Mon, 16 Oct 2023 15:09:18 +0200 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Mon, 16 Oct 2023 06:09:48 -0700 (PDT) The tk_pid member in the rpc_task structure exists conditionally on debug or tracing being enabled. Introduce and use a wapper to read the value of this member, so users outside tracing no longer have to care about these conditions. Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202310121759.0CF34DcN-lkp@intel.com/ Signed-off-by: Geert Uytterhoeven --- v3: - New. --- fs/nfs/filelayout/filelayout.c | 12 ++++++------ fs/nfs/flexfilelayout/flexfilelayout.c | 9 +++------ include/linux/sunrpc/sched.h | 10 ++++++++++ net/sunrpc/clnt.c | 2 +- net/sunrpc/debugfs.c | 2 +- 5 files changed, 21 insertions(+), 14 deletions(-) diff --git a/fs/nfs/filelayout/filelayout.c b/fs/nfs/filelayout/filelayout.c index ce8f8934bca517c0..5af545f49c54db4f 100644 --- a/fs/nfs/filelayout/filelayout.c +++ b/fs/nfs/filelayout/filelayout.c @@ -93,8 +93,7 @@ static void filelayout_reset_write(struct nfs_pgio_header *hdr) if (!test_and_set_bit(NFS_IOHDR_REDO, &hdr->flags)) { dprintk("%s Reset task %5u for i/o through MDS " "(req %s/%llu, %u bytes @ offset %llu)\n", __func__, - hdr->task.tk_pid, - hdr->inode->i_sb->s_id, + rpc_tk_pid(task), hdr->inode->i_sb->s_id, (unsigned long long)NFS_FILEID(hdr->inode), hdr->args.count, (unsigned long long)hdr->args.offset); @@ -110,8 +109,7 @@ static void filelayout_reset_read(struct nfs_pgio_header *hdr) if (!test_and_set_bit(NFS_IOHDR_REDO, &hdr->flags)) { dprintk("%s Reset task %5u for i/o through MDS " "(req %s/%llu, %u bytes @ offset %llu)\n", __func__, - hdr->task.tk_pid, - hdr->inode->i_sb->s_id, + rpc_tk_pid(task), hdr->inode->i_sb->s_id, (unsigned long long)NFS_FILEID(hdr->inode), hdr->args.count, (unsigned long long)hdr->args.offset); @@ -274,7 +272,8 @@ static void filelayout_read_prepare(struct rpc_task *task, void *data) return; } if (filelayout_reset_to_mds(hdr->lseg)) { - dprintk("%s task %u reset io to MDS\n", __func__, task->tk_pid); + dprintk("%s task %u reset io to MDS\n", __func__, + rpc_tk_pid(task)); filelayout_reset_read(hdr); rpc_exit(task, 0); return; @@ -372,7 +371,8 @@ static void filelayout_write_prepare(struct rpc_task *task, void *data) return; } if (filelayout_reset_to_mds(hdr->lseg)) { - dprintk("%s task %u reset io to MDS\n", __func__, task->tk_pid); + dprintk("%s task %u reset io to MDS\n", __func__, + rpc_tk_pid(task)); filelayout_reset_write(hdr); rpc_exit(task, 0); return; diff --git a/fs/nfs/flexfilelayout/flexfilelayout.c b/fs/nfs/flexfilelayout/flexfilelayout.c index a1dc338649062de3..3dd17f675d433f4d 100644 --- a/fs/nfs/flexfilelayout/flexfilelayout.c +++ b/fs/nfs/flexfilelayout/flexfilelayout.c @@ -1017,8 +1017,7 @@ static void ff_layout_reset_write(struct nfs_pgio_header *hdr, bool retry_pnfs) if (retry_pnfs) { dprintk("%s Reset task %5u for i/o through pNFS " "(req %s/%llu, %u bytes @ offset %llu)\n", __func__, - hdr->task.tk_pid, - hdr->inode->i_sb->s_id, + rpc_tk_pid(task), hdr->inode->i_sb->s_id, (unsigned long long)NFS_FILEID(hdr->inode), hdr->args.count, (unsigned long long)hdr->args.offset); @@ -1030,8 +1029,7 @@ static void ff_layout_reset_write(struct nfs_pgio_header *hdr, bool retry_pnfs) if (!test_and_set_bit(NFS_IOHDR_REDO, &hdr->flags)) { dprintk("%s Reset task %5u for i/o through MDS " "(req %s/%llu, %u bytes @ offset %llu)\n", __func__, - hdr->task.tk_pid, - hdr->inode->i_sb->s_id, + rpc_tk_pid(task), hdr->inode->i_sb->s_id, (unsigned long long)NFS_FILEID(hdr->inode), hdr->args.count, (unsigned long long)hdr->args.offset); @@ -1066,8 +1064,7 @@ static void ff_layout_reset_read(struct nfs_pgio_header *hdr) if (!test_and_set_bit(NFS_IOHDR_REDO, &hdr->flags)) { dprintk("%s Reset task %5u for i/o through MDS " "(req %s/%llu, %u bytes @ offset %llu)\n", __func__, - hdr->task.tk_pid, - hdr->inode->i_sb->s_id, + rpc_tk_pid(task), hdr->inode->i_sb->s_id, (unsigned long long)NFS_FILEID(hdr->inode), hdr->args.count, (unsigned long long)hdr->args.offset); diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h index 8ada7dc802d30507..0f39e60d28ed0132 100644 --- a/include/linux/sunrpc/sched.h +++ b/include/linux/sunrpc/sched.h @@ -270,6 +270,11 @@ void rpc_prepare_task(struct rpc_task *task); gfp_t rpc_task_gfp_mask(void); #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) || IS_ENABLED(CONFIG_TRACEPOINTS) +static inline unsigned short rpc_tk_pid(const struct rpc_task *task) +{ + return task->tk_pid; +} + static inline const char * rpc_qname(const struct rpc_wait_queue *q) { return ((q && q->name) ? q->name : "unknown"); @@ -281,6 +286,11 @@ static inline void rpc_assign_waitqueue_name(struct rpc_wait_queue *q, q->name = name; } #else +static inline unsigned short rpc_tk_pid(const struct rpc_task *task) +{ + return 0; +} + static inline void rpc_assign_waitqueue_name(struct rpc_wait_queue *q, const char *name) { diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index 9c210273d06b7f51..2f37e4143789b0cc 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c @@ -3320,7 +3320,7 @@ static void rpc_show_task(const struct rpc_clnt *clnt, rpc_waitq = rpc_qname(task->tk_waitqueue); printk(KERN_INFO "%5u %04x %6d %8p %8p %8ld %8p %sv%u %s a:%ps q:%s\n", - task->tk_pid, task->tk_flags, task->tk_status, + rpc_tk_pid(task), task->tk_flags, task->tk_status, clnt, task->tk_rqstp, rpc_task_timeout(task), task->tk_ops, clnt->cl_program->name, clnt->cl_vers, rpc_proc_name(task), task->tk_action, rpc_waitq); diff --git a/net/sunrpc/debugfs.c b/net/sunrpc/debugfs.c index a176d5a0b0ee9a2c..8896518dd6f3ce0e 100644 --- a/net/sunrpc/debugfs.c +++ b/net/sunrpc/debugfs.c @@ -31,7 +31,7 @@ tasks_show(struct seq_file *f, void *v) xid = be32_to_cpu(task->tk_rqstp->rq_xid); seq_printf(f, "%5u %04x %6d 0x%x 0x%x %8ld %ps %sv%u %s a:%ps q:%s\n", - task->tk_pid, task->tk_flags, task->tk_status, + rpc_tk_pid(task), task->tk_flags, task->tk_status, clnt->cl_clid, xid, rpc_task_timeout(task), task->tk_ops, clnt->cl_program->name, clnt->cl_vers, rpc_proc_name(task), task->tk_action, rpc_waitq); -- 2.34.1