From patchwork Thu Feb 6 00:29:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve French X-Patchwork-Id: 1234058 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-cifs-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=RSbD7cCx; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 48CfSt04zbz9sRm for ; Thu, 6 Feb 2020 11:29:34 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727170AbgBFA3d (ORCPT ); Wed, 5 Feb 2020 19:29:33 -0500 Received: from mail-io1-f42.google.com ([209.85.166.42]:37753 "EHLO mail-io1-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727149AbgBFA3c (ORCPT ); Wed, 5 Feb 2020 19:29:32 -0500 Received: by mail-io1-f42.google.com with SMTP id k24so4355872ioc.4 for ; Wed, 05 Feb 2020 16:29:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to:cc; bh=+CS6v5iToZXy4zWYyZFwCzTNvX8Kj+/mbyX5yoD4gWc=; b=RSbD7cCx4FYcz/REShLh8e7ILySaMHLSaBNvkOXRJEg+jRPLYI/5xQrgexhZSwYtDD 9ta9zkUqtYoBHbEDWuuX1LllzYIJLBeJ2GZvnXpdSUX8hsOB9nURfVCGCZ0chce/23i8 U+n+cGD83fGC7m+l4HT0yrQqkeWieSWKqx7ub1cFi56H6/69aFH0bQxeVwlZxKNexlHK Zx6//f7Hbp6tAQS7ICfESveZb2ONXnArQb+/PT3hEns5xKI/F167vogIfrM0E3D0krp8 RdqkOBzYx6qYeMNjuyW+MZgW98UZqN5oZ6oJr6SptWtdq0kTAe2k1Vot+e6PN0NU+88t w00A== 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:cc; bh=+CS6v5iToZXy4zWYyZFwCzTNvX8Kj+/mbyX5yoD4gWc=; b=gv1S9sEo/z/Z4nZgK3k8VRzZwEQi8t3a4Wcazqf3l1m9LzK0G9xW51UAPmY6PYL8M+ QEjDUbiYsby/NC2l6k84Cg3cG6W2rOVkLWdEF4WocbZ2s0M8YYT5tu3x+J5mM2HKiuuf ih+LjKjT4lk/js89vlsGJeYZojnJlpovp0Z3+/ZCYkt/eQ4JWRn+OtK2+Q2ZxkA8wDFL lgGCCxPBeQdIS0OWtlyCrJrElQDwePKeFkoJ2IFI+v0DwPqD5zkvJ5rrrNyVS48g4pzi 01HCK+7QkzohY9qGYE39SZpu4yX70D0JAZxPeIGFa/f7rLAPc0WqPn8eAdErKwzkmFCL CEFg== X-Gm-Message-State: APjAAAX/6b6JeEdT50G6ejq0msKFF37M0OoTO1WgV/3rwq2iTpwJw7/y 3mVNQa5dlP01tM8SnL4RRe1TjkTS4aXKRUDMXIl+koBRg7A= X-Google-Smtp-Source: APXvYqwA2+P/hWTV+IOVp/wp6Byf2oFvvPwI4dzRWA1ksOYQY3kqdcer6qHMlMod59Y9HKPwzjIW4/mHtzpmNp5ABdY= X-Received: by 2002:a02:c951:: with SMTP id u17mr32239627jao.27.1580948971851; Wed, 05 Feb 2020 16:29:31 -0800 (PST) MIME-Version: 1.0 From: Steve French Date: Wed, 5 Feb 2020 18:29:21 -0600 Message-ID: Subject: [CIFS][PATCH] Add dynamic trace points for flush and fsync To: CIFS Cc: Oleg Kravtsov Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org Makes it easier to debug errors on writeback that happen later, and are being returned on flush or fsync For example: writetest-17829 [002] .... 13583.407859: cifs_flush_err: ino=90 rc=-28 From f2bf09e97b47c7b13e8a918f560f6082e9bc8f8a Mon Sep 17 00:00:00 2001 From: Steve French Date: Wed, 5 Feb 2020 18:22:37 -0600 Subject: [PATCH] cifs: Add tracepoints for errors on flush or fsync Makes it easier to debug errors on writeback that happen later, and are being returned on flush or fsync For example: writetest-17829 [002] .... 13583.407859: cifs_flush_err: ino=90 rc=-28 Signed-off-by: Steve French --- fs/cifs/file.c | 7 +++++-- fs/cifs/trace.h | 27 +++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 79e6f4f55b9b..99ea7b2a06a5 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -2632,8 +2632,10 @@ int cifs_fsync(struct file *file, loff_t start, loff_t end, int datasync) struct cifs_sb_info *cifs_sb = CIFS_FILE_SB(file); rc = file_write_and_wait_range(file, start, end); - if (rc) + if (rc) { + trace_cifs_fsync_err(file_inode(file)->i_ino, rc); return rc; + } xid = get_xid(); @@ -2666,7 +2668,8 @@ int cifs_flush(struct file *file, fl_owner_t id) rc = filemap_write_and_wait(inode->i_mapping); cifs_dbg(FYI, "Flush inode %p file %p rc %d\n", inode, file, rc); - + if (rc) + trace_cifs_flush_err(inode->i_ino, rc); return rc; } diff --git a/fs/cifs/trace.h b/fs/cifs/trace.h index e7e350b13d6a..4cb0d5f7ce45 100644 --- a/fs/cifs/trace.h +++ b/fs/cifs/trace.h @@ -547,6 +547,33 @@ DEFINE_EVENT(smb3_exit_err_class, smb3_##name, \ DEFINE_SMB3_EXIT_ERR_EVENT(exit_err); + +DECLARE_EVENT_CLASS(smb3_sync_err_class, + TP_PROTO(unsigned long ino, + int rc), + TP_ARGS(ino, rc), + TP_STRUCT__entry( + __field(unsigned long, ino) + __field(int, rc) + ), + TP_fast_assign( + __entry->ino = ino; + __entry->rc = rc; + ), + TP_printk("\tino=%lu rc=%d", + __entry->ino, __entry->rc) +) + +#define DEFINE_SMB3_SYNC_ERR_EVENT(name) \ +DEFINE_EVENT(smb3_sync_err_class, cifs_##name, \ + TP_PROTO(unsigned long ino, \ + int rc), \ + TP_ARGS(ino, rc)) + +DEFINE_SMB3_SYNC_ERR_EVENT(fsync_err); +DEFINE_SMB3_SYNC_ERR_EVENT(flush_err); + + DECLARE_EVENT_CLASS(smb3_enter_exit_class, TP_PROTO(unsigned int xid, const char *func_name), -- 2.20.1