From patchwork Wed Aug 5 16:14:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 11702497 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4CE2D913 for ; Wed, 5 Aug 2020 20:07:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3295122CA1 for ; Wed, 5 Aug 2020 20:07:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1596658073; bh=4ol8Q2ARGqWQEqcEcZ0uvFb9jFOBr6comhoz+z7h+4M=; h=From:To:Subject:Date:List-ID:From; b=zWZl3A78l1e6UKyPShh6QMfErJyeaWCNbrsjTtTYeJhwVuhEK4sneweYIdmzygex9 avrQSO1ucpJDD6jXuYK+5XWvo6Z88FHBktWRXElGvgdgU9RC9maBhwms67BlJ7gmCs i39FO+FgpHDdE7O1e/KGlPvvxob2R/hRrG08n/Vg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728659AbgHEUHg (ORCPT ); Wed, 5 Aug 2020 16:07:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:49784 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726772AbgHEQcu (ORCPT ); Wed, 5 Aug 2020 12:32:50 -0400 Received: from localhost.localdomain (c-68-36-133-222.hsd1.mi.comcast.net [68.36.133.222]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6A615233FB for ; Wed, 5 Aug 2020 16:16:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1596644214; bh=4ol8Q2ARGqWQEqcEcZ0uvFb9jFOBr6comhoz+z7h+4M=; h=From:To:Subject:Date:From; b=EH00xuLyf5OWDi4f9QV8qngU4moxzgADg1LE25xvBYBQURqPPrSteC7+ITHdmkjol L3u/pvTRqErioNB5ZB4YPkzZIwUeZtkdE/y/GvbroxXfekA7sb2PRs0d5m6S56XKAe G8dmpDDPsGHbNhYHlwuOmQzABDGsFhMYl5Zk4+WU= From: trondmy@kernel.org To: linux-nfs@vger.kernel.org Subject: [PATCH 1/3] NFS: Report the stateid + status in trace_nfs4_layoutreturn_on_close() Date: Wed, 5 Aug 2020 12:14:44 -0400 Message-Id: <20200805161446.383482-1-trondmy@kernel.org> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Trond Myklebust Ensure we correctly report the stateid and status in the layoutreturn on close tracepoint. Signed-off-by: Trond Myklebust --- fs/nfs/nfs4trace.h | 2 +- fs/nfs/pnfs.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/nfs/nfs4trace.h b/fs/nfs/nfs4trace.h index 543541173a3d..07ea8d847710 100644 --- a/fs/nfs/nfs4trace.h +++ b/fs/nfs/nfs4trace.h @@ -1993,7 +1993,7 @@ TRACE_EVENT(nfs4_layoutget, DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutcommit); DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutreturn); -DEFINE_NFS4_INODE_EVENT(nfs4_layoutreturn_on_close); +DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutreturn_on_close); TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_UNKNOWN); TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_NO_PNFS); diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index dd2e14f5875d..d8cdb94c6668 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c @@ -1549,12 +1549,12 @@ void pnfs_roc_release(struct nfs4_layoutreturn_args *args, default: arg_stateid = &args->stateid; } + trace_nfs4_layoutreturn_on_close(args->inode, &args->stateid, ret); pnfs_layoutreturn_free_lsegs(lo, arg_stateid, &args->range, res_stateid); if (ld_private && ld_private->ops && ld_private->ops->free) ld_private->ops->free(ld_private); pnfs_put_layout_hdr(lo); - trace_nfs4_layoutreturn_on_close(args->inode, 0); } bool pnfs_wait_on_layoutreturn(struct inode *ino, struct rpc_task *task) From patchwork Wed Aug 5 16:14:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 11701937 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E9B99913 for ; Wed, 5 Aug 2020 16:36:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D2ACA22CF7 for ; Wed, 5 Aug 2020 16:36:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1596645404; bh=yn16hTfeAN7v9zr3ZQIMfWk0+F1q90uR69Eqk8hWbIo=; h=From:To:Subject:Date:In-Reply-To:References:List-ID:From; b=UmLHKWxKzovtDp7K8Qp9u/DTw6Ya1KiDUSzz1B9bAqF50Zgir0f1Juo8Vz5J9qZoe u+58VjrtZ7rytFsUqG34ziTgiq5paOAd8TQM+NtkupTrBKUoHTNeCgT2mYJa69s8He JyFrbevrlbs4ul3il91LXvkl5kdvpVV0FkmboBHM= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725920AbgHEQgm (ORCPT ); Wed, 5 Aug 2020 12:36:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:49782 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726994AbgHEQeh (ORCPT ); Wed, 5 Aug 2020 12:34:37 -0400 Received: from localhost.localdomain (c-68-36-133-222.hsd1.mi.comcast.net [68.36.133.222]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E904C235F9 for ; Wed, 5 Aug 2020 16:16:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1596644215; bh=yn16hTfeAN7v9zr3ZQIMfWk0+F1q90uR69Eqk8hWbIo=; h=From:To:Subject:Date:In-Reply-To:References:From; b=LKcHVkyRv3qbEzbfKjV2bTWMBFUY0AgEvlQNKzof5DVs3Ed1o1bMM71pUKDmu+qFK 5I4VstC61g1uuKJrpOyB9oIgtNNyW7LYdnwThCc0Zwmm5HandHG6fQyaiaG4lG+hMt WPTl8gqtmDdfwxzM1Lhes+ykBP1acSoYs33/JmVw= From: trondmy@kernel.org To: linux-nfs@vger.kernel.org Subject: [PATCH 2/3] NFS: Add tracepoints for layouterror and layoutstats. Date: Wed, 5 Aug 2020 12:14:45 -0400 Message-Id: <20200805161446.383482-2-trondmy@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200805161446.383482-1-trondmy@kernel.org> References: <20200805161446.383482-1-trondmy@kernel.org> MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Trond Myklebust Allow tracing of the NFSv4.2 layouterror and layoutstats operations. Signed-off-by: Trond Myklebust --- fs/nfs/nfs42proc.c | 10 ++++++++-- fs/nfs/nfs4trace.h | 2 ++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/fs/nfs/nfs42proc.c b/fs/nfs/nfs42proc.c index e200522469af..142225f0af59 100644 --- a/fs/nfs/nfs42proc.c +++ b/fs/nfs/nfs42proc.c @@ -17,6 +17,7 @@ #include "nfs4session.h" #include "internal.h" #include "delegation.h" +#include "nfs4trace.h" #define NFSDBG_FACILITY NFSDBG_PROC static int nfs42_do_offload_cancel_async(struct file *dst, nfs4_stateid *std); @@ -714,7 +715,7 @@ nfs42_layoutstat_done(struct rpc_task *task, void *calldata) switch (task->tk_status) { case 0: - break; + return; case -NFS4ERR_BADHANDLE: case -ESTALE: pnfs_destroy_layout(NFS_I(inode)); @@ -760,6 +761,8 @@ nfs42_layoutstat_done(struct rpc_task *task, void *calldata) case -EOPNOTSUPP: NFS_SERVER(inode)->caps &= ~NFS_CAP_LAYOUTSTATS; } + + trace_nfs4_layoutstats(inode, &data->args.stateid, task->tk_status); } static void @@ -882,7 +885,7 @@ nfs42_layouterror_done(struct rpc_task *task, void *calldata) switch (task->tk_status) { case 0: - break; + return; case -NFS4ERR_BADHANDLE: case -ESTALE: pnfs_destroy_layout(NFS_I(inode)); @@ -926,6 +929,9 @@ nfs42_layouterror_done(struct rpc_task *task, void *calldata) case -EOPNOTSUPP: NFS_SERVER(inode)->caps &= ~NFS_CAP_LAYOUTERROR; } + + trace_nfs4_layouterror(inode, &data->args.errors[0].stateid, + task->tk_status); } static void diff --git a/fs/nfs/nfs4trace.h b/fs/nfs/nfs4trace.h index 07ea8d847710..61c33536dcf3 100644 --- a/fs/nfs/nfs4trace.h +++ b/fs/nfs/nfs4trace.h @@ -1994,6 +1994,8 @@ TRACE_EVENT(nfs4_layoutget, DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutcommit); DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutreturn); DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutreturn_on_close); +DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layouterror); +DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutstats); TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_UNKNOWN); TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_NO_PNFS); From patchwork Wed Aug 5 16:14:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 11701943 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0C38D138A for ; Wed, 5 Aug 2020 16:48:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EAF2C22CF7 for ; Wed, 5 Aug 2020 16:48:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1596646092; bh=4IXuXNxvGfeK4Lm/RyUj3pAht3o7OOXUoJtD6gkHrkc=; h=From:To:Subject:Date:In-Reply-To:References:List-ID:From; b=wbBXeG3aQLrjznbu0tFMn65O10eCMYv4UIol8Qy+pHJfXg5mZHeRSyKmogiDpug8z xDkDzdHATRy1YaURjwi6gTxzYGHzhoUH2qWDXK9/YvEJx2zPgxcYw2+6KjvutRd4GQ pUqNCH5kcjSZqtfzhEY2/VhhZXR3RGmX4e9ZHJlE= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728057AbgHEQsJ (ORCPT ); Wed, 5 Aug 2020 12:48:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:54492 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727826AbgHEQpU (ORCPT ); Wed, 5 Aug 2020 12:45:20 -0400 Received: from localhost.localdomain (c-68-36-133-222.hsd1.mi.comcast.net [68.36.133.222]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 61118235FC for ; Wed, 5 Aug 2020 16:16:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1596644215; bh=4IXuXNxvGfeK4Lm/RyUj3pAht3o7OOXUoJtD6gkHrkc=; h=From:To:Subject:Date:In-Reply-To:References:From; b=HpdiqxKXSklZxbJVINZe07HxsqUTBjokau1AkEO3otFqqRFe0+A7F/lCFj4T6T36o 3KhCWse+CXLU1hCiB0Tq5ykwX3CvoNBt4QgOAik411Zib6TlRKGvM8+edIx2jmOP5s XklDjChFG+occ5UxwCzNYhEfWdAEinW+FcW9LHu0= From: trondmy@kernel.org To: linux-nfs@vger.kernel.org Subject: [PATCH 3/3] NFS: Add layout segment info to pnfs read/write/commit tracepoints Date: Wed, 5 Aug 2020 12:14:46 -0400 Message-Id: <20200805161446.383482-3-trondmy@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200805161446.383482-2-trondmy@kernel.org> References: <20200805161446.383482-1-trondmy@kernel.org> <20200805161446.383482-2-trondmy@kernel.org> MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Trond Myklebust Allow the pnfs I/O tracepoints to trace which layout segment is being used. Signed-off-by: Trond Myklebust --- fs/nfs/nfs4trace.h | 39 +++++++++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/fs/nfs/nfs4trace.h b/fs/nfs/nfs4trace.h index 61c33536dcf3..072a35adb0e3 100644 --- a/fs/nfs/nfs4trace.h +++ b/fs/nfs/nfs4trace.h @@ -1745,6 +1745,8 @@ DECLARE_EVENT_CLASS(nfs4_read_event, __field(unsigned long, error) __field(int, stateid_seq) __field(u32, stateid_hash) + __field(int, layoutstateid_seq) + __field(u32, layoutstateid_hash) ), TP_fast_assign( @@ -1754,6 +1756,8 @@ DECLARE_EVENT_CLASS(nfs4_read_event, hdr->args.fh : &nfsi->fh; const struct nfs4_state *state = hdr->args.context->state; + const struct pnfs_layout_segment *lseg = hdr->lseg; + const struct pnfs_layout_hdr *lo = lseg->pls_layout; __entry->dev = inode->i_sb->s_dev; __entry->fileid = nfsi->fileid; @@ -1766,11 +1770,15 @@ DECLARE_EVENT_CLASS(nfs4_read_event, be32_to_cpu(state->stateid.seqid); __entry->stateid_hash = nfs_stateid_hash(&state->stateid); + __entry->layoutstateid_seq = lseg->pls_seq; + __entry->layoutstateid_hash = + nfs_stateid_hash(&lo->plh_stateid); ), TP_printk( "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " - "offset=%lld count=%u res=%u stateid=%d:0x%08x", + "offset=%lld count=%u res=%u stateid=%d:0x%08x " + "layoutstateid=%d:0x%08x", -__entry->error, show_nfsv4_errors(__entry->error), MAJOR(__entry->dev), MINOR(__entry->dev), @@ -1778,7 +1786,8 @@ DECLARE_EVENT_CLASS(nfs4_read_event, __entry->fhandle, (long long)__entry->offset, __entry->arg_count, __entry->res_count, - __entry->stateid_seq, __entry->stateid_hash + __entry->stateid_seq, __entry->stateid_hash, + __entry->layoutstateid_seq, __entry->layoutstateid_hash ) ); #define DEFINE_NFS4_READ_EVENT(name) \ @@ -1811,6 +1820,8 @@ DECLARE_EVENT_CLASS(nfs4_write_event, __field(unsigned long, error) __field(int, stateid_seq) __field(u32, stateid_hash) + __field(int, layoutstateid_seq) + __field(u32, layoutstateid_hash) ), TP_fast_assign( @@ -1820,6 +1831,8 @@ DECLARE_EVENT_CLASS(nfs4_write_event, hdr->args.fh : &nfsi->fh; const struct nfs4_state *state = hdr->args.context->state; + const struct pnfs_layout_segment *lseg = hdr->lseg; + const struct pnfs_layout_hdr *lo = lseg->pls_layout; __entry->dev = inode->i_sb->s_dev; __entry->fileid = nfsi->fileid; @@ -1832,11 +1845,15 @@ DECLARE_EVENT_CLASS(nfs4_write_event, be32_to_cpu(state->stateid.seqid); __entry->stateid_hash = nfs_stateid_hash(&state->stateid); + __entry->layoutstateid_seq = lseg->pls_seq; + __entry->layoutstateid_hash = + nfs_stateid_hash(&lo->plh_stateid); ), TP_printk( "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " - "offset=%lld count=%u res=%u stateid=%d:0x%08x", + "offset=%lld count=%u res=%u stateid=%d:0x%08x " + "layoutstateid=%d:0x%08x", -__entry->error, show_nfsv4_errors(__entry->error), MAJOR(__entry->dev), MINOR(__entry->dev), @@ -1844,7 +1861,8 @@ DECLARE_EVENT_CLASS(nfs4_write_event, __entry->fhandle, (long long)__entry->offset, __entry->arg_count, __entry->res_count, - __entry->stateid_seq, __entry->stateid_hash + __entry->stateid_seq, __entry->stateid_hash, + __entry->layoutstateid_seq, __entry->layoutstateid_hash ) ); @@ -1875,6 +1893,8 @@ DECLARE_EVENT_CLASS(nfs4_commit_event, __field(unsigned long, error) __field(loff_t, offset) __field(u32, count) + __field(int, layoutstateid_seq) + __field(u32, layoutstateid_hash) ), TP_fast_assign( @@ -1882,6 +1902,9 @@ DECLARE_EVENT_CLASS(nfs4_commit_event, const struct nfs_inode *nfsi = NFS_I(inode); const struct nfs_fh *fh = data->args.fh ? data->args.fh : &nfsi->fh; + const struct pnfs_layout_segment *lseg = data->lseg; + const struct pnfs_layout_hdr *lo = lseg ? + lseg->pls_layout : NULL; __entry->dev = inode->i_sb->s_dev; __entry->fileid = nfsi->fileid; @@ -1889,18 +1912,22 @@ DECLARE_EVENT_CLASS(nfs4_commit_event, __entry->offset = data->args.offset; __entry->count = data->args.count; __entry->error = error < 0 ? -error : 0; + __entry->layoutstateid_seq = lseg ? lseg->pls_seq : 0; + __entry->layoutstateid_hash = lo ? + nfs_stateid_hash(&lo->plh_stateid) : 0; ), TP_printk( "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " - "offset=%lld count=%u", + "offset=%lld count=%u layoutstateid=%d:0x%08x", -__entry->error, show_nfsv4_errors(__entry->error), MAJOR(__entry->dev), MINOR(__entry->dev), (unsigned long long)__entry->fileid, __entry->fhandle, (long long)__entry->offset, - __entry->count + __entry->count, + __entry->layoutstateid_seq, __entry->layoutstateid_hash ) ); #define DEFINE_NFS4_COMMIT_EVENT(name) \