From patchwork Wed Mar 13 06:43:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve French X-Patchwork-Id: 10850683 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3C53017E6 for ; Wed, 13 Mar 2019 06:43:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 215F429963 for ; Wed, 13 Mar 2019 06:43:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1FDEE29995; Wed, 13 Mar 2019 06:43:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 89163299E6 for ; Wed, 13 Mar 2019 06:43:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727089AbfCMGne (ORCPT ); Wed, 13 Mar 2019 02:43:34 -0400 Received: from mail-pf1-f180.google.com ([209.85.210.180]:36367 "EHLO mail-pf1-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727080AbfCMGnd (ORCPT ); Wed, 13 Mar 2019 02:43:33 -0400 Received: by mail-pf1-f180.google.com with SMTP id n22so700647pfa.3 for ; Tue, 12 Mar 2019 23:43:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=h2Ln+QIBR47s8dWdmAzdo3QGPkGCjYrY/uYfg10Z20s=; b=dqyay50GqOnECifvVhsm7AqB+Ankv76M6NOck1tPRcwgL3JNrlnbmyjcFnChMrfXsA TbDOxBf5xZ3S/osXNLLnR2UXoHPTfpx17PLRJSmM8zuuydYYRqikQ+yF04TB+FeVRD5g 3/hBYLrlb/L6nDS4sr03AOqs6cCfGH+XOSwI0kq8/PcPJ++Qpz4bXGL2VKPKJlfd35iu gK9MbY/0mhA56A8/2EluNB5hOBuPaHJpdSj2A1q8GS4OvlsSAlCxD3BEJ8c7CoG0gzgk Spc/e7Xm81izkU+o5NqkQN7M2279gDb4hnJkBhE/kEj7Oc6e8Shg0XNiYCcl0k+UMsfb F4JA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=h2Ln+QIBR47s8dWdmAzdo3QGPkGCjYrY/uYfg10Z20s=; b=jFSIlmliRC8MYkkHIQVZRhPTL06qCG9Nb3RUTJsEzkIe/YJGpPMwZUcKSPYLYigmwU bC92YQDgCnKP8ttvu1y5lVvJhQ3LNxZfq9t1yphDQG6vg5sicpI60PfZEX6izb0Da5xK 9UPgxdRO8hu/cXw1Mue2SZy58rCT9Vn+RXUMWRSnDHKl0trUicZUw1rQZmCMCwuBsr2P dKiQc266opqWkRL9sumAjcKpwdvzwiXLXqRDph1ijmBrO3GNGi7Vd+VF8eLaexm984YH bPQ972BtwwlVPgLitlojKsNpMxqRT3W3rpdYj1Qx7wldiO/nozd7fdlgbDe/B33BgcD9 SWbA== X-Gm-Message-State: APjAAAXKMYU3+PbRAv9ME0Np1mRKeDj5FweihbjWRqTStnyxImmKUswt VSdLmB8rO5vYWbBXDQ4lp1yd3mJJHV+ifPWBsCE= X-Google-Smtp-Source: APXvYqxaRb4Mw/BSTaXSLChfyxv4sSit61QcH6RNxpMj2bKWtLliQL+8caBfyJ3lyB0gJ2kpUa4g6EINBGoWbpWG0Qs= X-Received: by 2002:a17:902:b618:: with SMTP id b24mr42092232pls.73.1552459412531; Tue, 12 Mar 2019 23:43:32 -0700 (PDT) MIME-Version: 1.0 From: Steve French Date: Wed, 13 Mar 2019 01:43:21 -0500 Message-ID: Subject: [PATCH] add dynamic tracepoints for two simple falloc and zero range To: ronnie sahlberg , CIFS Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Sample output (trace-cmd record -e *smb3*falloc* -e *smb3*zero*): # TASK-PID CPU# |||| TIMESTAMP FUNCTION # | | | |||| | | fallocate-25699 [002] .... 453345.398491: smb3_falloc_enter: xid=8 sid=0xa342bb96 tid=0xd2a49757 fid=0x93514326 offset=0x0 len=0x200000 fallocate-25699 [002] .... 453345.398494: smb3_falloc_err: xid=8 sid=0xa342bb96 tid=0xd2a49757 fid=0x93514326 offset=0x0 len=0x200000 rc=-95 fallocate-25738 [006] .... 453408.813356: smb3_zero_enter: xid=12 sid=0xa342bb96 tid=0xd2a49757 fid=0x9fe7e532 offset=0x2710 len=0x64 fallocate-25738 [006] .... 453408.813359: smb3_zero_err: xid=12 sid=0xa342bb96 tid=0xd2a49757 fid=0x9fe7e532 offset=0x2710 len=0x64 rc=-95 From f5052b9141346c22cdc83e5b6718648fc5470e58 Mon Sep 17 00:00:00 2001 From: Steve French Date: Wed, 13 Mar 2019 01:41:49 -0500 Subject: [PATCH] smb3: add dynamic tracepoints for simple fallocate and zero range Can be helpful in debugging various xfstests that are currently skipped or failing due to missing features in our current implementation of fallocate. Signed-off-by: Steve French --- fs/cifs/smb2ops.c | 32 ++++++++++++++++++++++++++++++++ fs/cifs/trace.h | 6 ++++++ 2 files changed, 38 insertions(+) diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c index bd3d2288161c..823a58550dfd 100644 --- a/fs/cifs/smb2ops.c +++ b/fs/cifs/smb2ops.c @@ -2571,10 +2571,16 @@ static long smb3_zero_range(struct file *file, struct cifs_tcon *tcon, inode = d_inode(cfile->dentry); cifsi = CIFS_I(inode); + trace_smb3_zero_enter(xid, cfile->fid.persistent_fid, tcon->tid, + ses->Suid, offset, len); + + /* if file not oplocked can't be sure whether asking to extend size */ if (!CIFS_CACHE_READ(cifsi)) if (keep_size == false) { rc = -EOPNOTSUPP; + trace_smb3_zero_err(xid, cfile->fid.persistent_fid, + tcon->tid, ses->Suid, offset, len, rc); free_xid(xid); return rc; } @@ -2585,6 +2591,8 @@ static long smb3_zero_range(struct file *file, struct cifs_tcon *tcon, */ if (!(cifsi->cifsAttrs & FILE_ATTRIBUTE_SPARSE_FILE)) { rc = -EOPNOTSUPP; + trace_smb3_zero_err(xid, cfile->fid.persistent_fid, tcon->tid, + ses->Suid, offset, len, rc); free_xid(xid); return rc; } @@ -2644,6 +2652,12 @@ static long smb3_zero_range(struct file *file, struct cifs_tcon *tcon, free_rsp_buf(resp_buftype[0], rsp_iov[0].iov_base); free_rsp_buf(resp_buftype[1], rsp_iov[1].iov_base); free_xid(xid); + if (rc) + trace_smb3_zero_err(xid, cfile->fid.persistent_fid, tcon->tid, + ses->Suid, offset, len, rc); + else + trace_smb3_zero_done(xid, cfile->fid.persistent_fid, tcon->tid, + ses->Suid, offset, len); return rc; } @@ -2698,9 +2712,13 @@ static long smb3_simple_falloc(struct file *file, struct cifs_tcon *tcon, inode = d_inode(cfile->dentry); cifsi = CIFS_I(inode); + trace_smb3_falloc_enter(xid, cfile->fid.persistent_fid, tcon->tid, + tcon->ses->Suid, off, len); /* if file not oplocked can't be sure whether asking to extend size */ if (!CIFS_CACHE_READ(cifsi)) if (keep_size == false) { + trace_smb3_falloc_err(xid, cfile->fid.persistent_fid, + tcon->tid, tcon->ses->Suid, off, len, rc); free_xid(xid); return rc; } @@ -2720,6 +2738,12 @@ static long smb3_simple_falloc(struct file *file, struct cifs_tcon *tcon, /* BB: in future add else clause to extend file */ else rc = -EOPNOTSUPP; + if (rc) + trace_smb3_falloc_err(xid, cfile->fid.persistent_fid, + tcon->tid, tcon->ses->Suid, off, len, rc); + else + trace_smb3_falloc_done(xid, cfile->fid.persistent_fid, + tcon->tid, tcon->ses->Suid, off, len); free_xid(xid); return rc; } @@ -2735,6 +2759,8 @@ static long smb3_simple_falloc(struct file *file, struct cifs_tcon *tcon, */ if ((off > 8192) || (off + len + 8192 < i_size_read(inode))) { rc = -EOPNOTSUPP; + trace_smb3_falloc_err(xid, cfile->fid.persistent_fid, + tcon->tid, tcon->ses->Suid, off, len, rc); free_xid(xid); return rc; } @@ -2743,6 +2769,12 @@ static long smb3_simple_falloc(struct file *file, struct cifs_tcon *tcon, } /* BB: else ... in future add code to extend file and set sparse */ + if (rc) + trace_smb3_falloc_err(xid, cfile->fid.persistent_fid, tcon->tid, + tcon->ses->Suid, off, len, rc); + else + trace_smb3_falloc_done(xid, cfile->fid.persistent_fid, tcon->tid, + tcon->ses->Suid, off, len); free_xid(xid); return rc; diff --git a/fs/cifs/trace.h b/fs/cifs/trace.h index 30bf51c7e8fe..fa226de48ef3 100644 --- a/fs/cifs/trace.h +++ b/fs/cifs/trace.h @@ -59,6 +59,8 @@ DEFINE_EVENT(smb3_rw_err_class, smb3_##name, \ DEFINE_SMB3_RW_ERR_EVENT(write_err); DEFINE_SMB3_RW_ERR_EVENT(read_err); DEFINE_SMB3_RW_ERR_EVENT(query_dir_err); +DEFINE_SMB3_RW_ERR_EVENT(zero_err); +DEFINE_SMB3_RW_ERR_EVENT(falloc_err); /* For logging successful read or write */ @@ -104,9 +106,13 @@ DEFINE_EVENT(smb3_rw_done_class, smb3_##name, \ DEFINE_SMB3_RW_DONE_EVENT(write_enter); DEFINE_SMB3_RW_DONE_EVENT(read_enter); DEFINE_SMB3_RW_DONE_EVENT(query_dir_enter); +DEFINE_SMB3_RW_DONE_EVENT(zero_enter); +DEFINE_SMB3_RW_DONE_EVENT(falloc_enter); DEFINE_SMB3_RW_DONE_EVENT(write_done); DEFINE_SMB3_RW_DONE_EVENT(read_done); DEFINE_SMB3_RW_DONE_EVENT(query_dir_done); +DEFINE_SMB3_RW_DONE_EVENT(zero_done); +DEFINE_SMB3_RW_DONE_EVENT(falloc_done); /* * For handle based calls other than read and write, and get/set info -- 2.17.1