From patchwork Thu Jun 16 03:49:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve French X-Patchwork-Id: 1644124 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=cHKqmSJX; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-cifs-owner@vger.kernel.org; receiver=) Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by bilbo.ozlabs.org (Postfix) with ESMTP id 4LNp841CYYz9sFw for ; Thu, 16 Jun 2022 13:49:24 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346612AbiFPDtV (ORCPT ); Wed, 15 Jun 2022 23:49:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350832AbiFPDtU (ORCPT ); Wed, 15 Jun 2022 23:49:20 -0400 Received: from mail-vk1-xa2f.google.com (mail-vk1-xa2f.google.com [IPv6:2607:f8b0:4864:20::a2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BCDC84552B for ; Wed, 15 Jun 2022 20:49:18 -0700 (PDT) Received: by mail-vk1-xa2f.google.com with SMTP id x190so118336vkc.9 for ; Wed, 15 Jun 2022 20:49:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:date:message-id:subject:to; bh=VAiVbI8s/KsUYIkE9//lPGymx+h7NW6JIVMINIo8pQU=; b=cHKqmSJXqiOoBvYk6hipNKHCnvDUB907pcylaOa2dLEfCFuPk/cxTUDdvLOW6qR555 1UydbfbcXzuPpbd13rfLrZCLwm6pvyb5a8KP+SShE2YqWx1CWsf5wPP4DI92HpbSdIBe jovGhKFea4MtFNQdFwXMGKAntFnZ8a8PByX+N27fQkhJwNVii3qmo4TZJm9p7qkeKs9a ekINZIZcuHf1dsAgwd5NFFpZXUQWWEAWzQzPBb9hzVBqjs15Q9HGG34DUZp3S8Gm0C5B EyCiVTNG4YeF8xW7dJr9nDL7Bwtyscq2vDxC3RSUIJ1GrMGPTs0cYISXcm/MJKmZVgz6 CRtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=VAiVbI8s/KsUYIkE9//lPGymx+h7NW6JIVMINIo8pQU=; b=VfFe02aofLuL8u1okuqUASGQIvmSWhNZ0f5xlaVOF0xg++f6gDKAboD2rP6nA17Ciw aWLkYzeLc6MoESNj4yPYZmSwlv5pYumBXwnyOMNQ2msCJZcIUF8+AeoLsFfxiS0YayM4 iT/GW4MvftxOWgE/J39F0/olM1/gF4oYczRD0VfB1ehYwgm1gSBiUyTTHOK1m87q+1G1 aPNqsJuN7RkpLNDfRqfHWz7NYvveqKtUdXLQQXR5QE3XJ876lUZpxNUL2mk4S8/Kt4Uu 7RgpzjkjtPlshc5Akd9pXOju/+0mPVs+LNSMq3SgHIqStCYX7h4Rei87IgzkW9M31QWl UNcw== X-Gm-Message-State: AJIora+ZckB9wBW75P1eOYeBjGdII6IbiwFV64sFnri4Tz2JbtcPVD1Z yw92Ji6AzXCUrwxspTKPY1dhnlffg2JOqTkELsBgG40S2MI= X-Google-Smtp-Source: AGRyM1uEuDCH8zTR2x9AeomwAkWR585xM9gzrWur6un6h5MUj2mB035/9sBf5GaynHSYr/s8BSyLiMUQoDSsSTvHp8s= X-Received: by 2002:ac5:cb4f:0:b0:368:d0d7:7617 with SMTP id s15-20020ac5cb4f000000b00368d0d77617mr1355439vkl.38.1655351357585; Wed, 15 Jun 2022 20:49:17 -0700 (PDT) MIME-Version: 1.0 From: Steve French Date: Wed, 15 Jun 2022 22:49:05 -0500 Message-ID: Subject: [PATCH][SMB3] add dynamic trace point smb3_set_eof To: CIFS X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org In order to debug problems with file size being reported incorrectly temporarily (in this case xfstest generic/584 intermittent failure) we need to add trace point for the non-compounded code path where we set the file size (SMB2_set_eof). The new trace point is: "smb3_set_eof" Here is sample output from the tracepoint: TASK-PID CPU# ||||| TIMESTAMP FUNCTION | | | ||||| | | xfs_io-75403 [002] ..... 95219.189835: smb3_set_eof: xid=221 sid=0xeef1cbd2 tid=0x27079ee6 fid=0x52edb58c offset=0x100000 aio-dio-append--75418 [010] ..... 95219.242402: smb3_set_eof: xid=226 sid=0xeef1cbd2 tid=0x27079ee6 fid=0xae89852d offset=0x0 From 7c5e7bc4022cf06742ac0eb9ed0b583d3d7c9b26 Mon Sep 17 00:00:00 2001 From: Steve French Date: Wed, 15 Jun 2022 22:40:23 -0500 Subject: [PATCH] smb3: add trace point for SMB2_set_eof In order to debug problems with file size being reported incorrectly temporarily (in this case xfstest generic/584 intermittent failure) we need to add trace point for the non-compounded code path where we set the file size (SMB2_set_eof). The new trace point is: "smb3_set_eof" Here is sample output from the tracepoint: TASK-PID CPU# ||||| TIMESTAMP FUNCTION | | | ||||| | | xfs_io-75403 [002] ..... 95219.189835: smb3_set_eof: xid=221 sid=0xeef1cbd2 tid=0x27079ee6 fid=0x52edb58c offset=0x100000 aio-dio-append--75418 [010] ..... 95219.242402: smb3_set_eof: xid=226 sid=0xeef1cbd2 tid=0x27079ee6 fid=0xae89852d offset=0x0 Signed-off-by: Steve French --- fs/cifs/smb2pdu.c | 2 ++ fs/cifs/trace.h | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c index eaf975f1ad89..b515140bad8d 100644 --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c @@ -5154,6 +5154,8 @@ SMB2_set_eof(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid, data = &info; size = sizeof(struct smb2_file_eof_info); + trace_smb3_set_eof(xid, persistent_fid, tcon->tid, tcon->ses->Suid, le64_to_cpu(*eof)); + return send_set_info(xid, tcon, persistent_fid, volatile_fid, pid, FILE_END_OF_FILE_INFORMATION, SMB2_O_INFO_FILE, 0, 1, &data, &size); diff --git a/fs/cifs/trace.h b/fs/cifs/trace.h index 2be5e0c8564d..6b88dc2e364f 100644 --- a/fs/cifs/trace.h +++ b/fs/cifs/trace.h @@ -121,6 +121,44 @@ DEFINE_SMB3_RW_DONE_EVENT(query_dir_done); DEFINE_SMB3_RW_DONE_EVENT(zero_done); DEFINE_SMB3_RW_DONE_EVENT(falloc_done); +/* For logging successful set EOF (truncate) */ +DECLARE_EVENT_CLASS(smb3_eof_class, + TP_PROTO(unsigned int xid, + __u64 fid, + __u32 tid, + __u64 sesid, + __u64 offset), + TP_ARGS(xid, fid, tid, sesid, offset), + TP_STRUCT__entry( + __field(unsigned int, xid) + __field(__u64, fid) + __field(__u32, tid) + __field(__u64, sesid) + __field(__u64, offset) + ), + TP_fast_assign( + __entry->xid = xid; + __entry->fid = fid; + __entry->tid = tid; + __entry->sesid = sesid; + __entry->offset = offset; + ), + TP_printk("xid=%u sid=0x%llx tid=0x%x fid=0x%llx offset=0x%llx", + __entry->xid, __entry->sesid, __entry->tid, __entry->fid, + __entry->offset) +) + +#define DEFINE_SMB3_EOF_EVENT(name) \ +DEFINE_EVENT(smb3_eof_class, smb3_##name, \ + TP_PROTO(unsigned int xid, \ + __u64 fid, \ + __u32 tid, \ + __u64 sesid, \ + __u64 offset), \ + TP_ARGS(xid, fid, tid, sesid, offset)) + +DEFINE_SMB3_EOF_EVENT(set_eof); + /* * For handle based calls other than read and write, and get/set info */ -- 2.34.1