From patchwork Mon Jan 6 20:25:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 11320019 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 0AA131871 for ; Mon, 6 Jan 2020 20:27:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DD1AB20715 for ; Mon, 6 Jan 2020 20:27:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="khgcauH4" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726699AbgAFU12 (ORCPT ); Mon, 6 Jan 2020 15:27:28 -0500 Received: from mail-yw1-f68.google.com ([209.85.161.68]:45022 "EHLO mail-yw1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726657AbgAFU11 (ORCPT ); Mon, 6 Jan 2020 15:27:27 -0500 Received: by mail-yw1-f68.google.com with SMTP id t141so22415252ywc.11 for ; Mon, 06 Jan 2020 12:27:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qaen0ufwEJUB0Fs5mUM2TOjyjCuqbGSEbjqXbGFQrT4=; b=khgcauH4hu8vaTBoO0tgG3F5OHDPz30KOocgVg03VxlohkhsItLOerA/PtpwBj1gAH FxziM0FvF8CsgBvlXzt/gwPMRkvOLsXvwgPvTwSPE/dfgIo+/6pkU1RyZAKZiAORQhNc hjuD1WitQr80QAHqYrcqjYhLz0Hw4Qtv3AuT8DKlpcu8dP/H2mKzLJd6H4uEWzZce0Yz saQCcqz+ODXnKSoT5G+Z9EghT84UD/un65FyjNQzMDY4v6hJHF1XfueAQUYQUt3+Iyvm vMe4gMXX0uUnipEpq6HXegE8yHm9M8+9TZT+REjuUycPVt7dl0FWAK7vjog7eQ/1ebE5 TsoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qaen0ufwEJUB0Fs5mUM2TOjyjCuqbGSEbjqXbGFQrT4=; b=uMXjDxKo2HoXNAB8B69xBIAmVjmepP8Ymq2VwvzeeUv6g8vNoBOi2+E4hP/RyegrxO /pVoGho6lGW++3UUiyPDCKWmcAehRNEbQD1sEdXdkoA8LmBtiiHydWXkXsvdE85kELkI 8RpRtfe1bjIetJxUCN5Lv49G4EDzWepiCFQJ/fF5J3xaCtblrncnUVaO02S/kAgQtVPW Cuzk1zx5vhrV5kt50MmUg4G57aBOcfQGF2JmawGCiMk+0pZdI5gUC+xnuUH9ApOWlzFE CwLIHCF9gKLAwAHyfx3Mgg+yxCRGEt81SSpNpE9ezBwUKnVBQRbWO/10woFxNU9qgZ70 Nk4w== X-Gm-Message-State: APjAAAVqR8EcxHYfCTQqyCeKml11yHFRaQ/NyR/RBWvWycg0n4+1qxUa UG1sO2FAhKggyNkX0oTiZQ== X-Google-Smtp-Source: APXvYqxCAlHFIpJOG3wAz44pe2kLI4FcWCrFy8wlvY26zUk4K0+9oBDnaDee6aSsOnuO0zrh4UQFUQ== X-Received: by 2002:a81:6785:: with SMTP id b127mr82129080ywc.56.1578342446484; Mon, 06 Jan 2020 12:27:26 -0800 (PST) Received: from localhost.localdomain (c-68-40-189-247.hsd1.mi.comcast.net. [68.40.189.247]) by smtp.gmail.com with ESMTPSA id l200sm28723579ywl.106.2020.01.06.12.27.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jan 2020 12:27:25 -0800 (PST) From: Trond Myklebust X-Google-Original-From: Trond Myklebust To: Anna Schumaker Cc: linux-nfs@vger.kernel.org Subject: [PATCH 01/15] NFS: Revalidate the file size on a fatal write error Date: Mon, 6 Jan 2020 15:25:00 -0500 Message-Id: <20200106202514.785483-2-trond.myklebust@hammerspace.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200106202514.785483-1-trond.myklebust@hammerspace.com> References: <20200106202514.785483-1-trond.myklebust@hammerspace.com> MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org If we suffer a fatal error upon writing a file, which causes us to need to revalidate the entire mapping, then we should also revalidate the file size. Fixes: d2ceb7e57086 ("NFS: Don't use page_file_mapping after removing the page") Signed-off-by: Trond Myklebust --- fs/nfs/write.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/fs/nfs/write.c b/fs/nfs/write.c index 52cab65f91cf..f5170bc839aa 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c @@ -243,7 +243,15 @@ static void nfs_grow_file(struct page *page, unsigned int offset, unsigned int c /* A writeback failed: mark the page as bad, and invalidate the page cache */ static void nfs_set_pageerror(struct address_space *mapping) { + struct inode *inode = mapping->host; + nfs_zap_mapping(mapping->host, mapping); + /* Force file size revalidation */ + spin_lock(&inode->i_lock); + NFS_I(inode)->cache_validity |= NFS_INO_REVAL_FORCED | + NFS_INO_REVAL_PAGECACHE | + NFS_INO_INVALID_SIZE; + spin_unlock(&inode->i_lock); } static void nfs_mapping_set_error(struct page *page, int error) From patchwork Mon Jan 6 20:25:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 11320021 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 B659814DB for ; Mon, 6 Jan 2020 20:27:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 957302146E for ; Mon, 6 Jan 2020 20:27:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="r9GEmoT7" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726701AbgAFU13 (ORCPT ); Mon, 6 Jan 2020 15:27:29 -0500 Received: from mail-yb1-f193.google.com ([209.85.219.193]:42433 "EHLO mail-yb1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726657AbgAFU12 (ORCPT ); Mon, 6 Jan 2020 15:27:28 -0500 Received: by mail-yb1-f193.google.com with SMTP id z10so15278949ybr.9 for ; Mon, 06 Jan 2020 12:27:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mQqren3SabSmNoA5QVuXoLb4xDGESav0uq95Aq1SI5Y=; b=r9GEmoT7tgUwMjzx/w8elfinDcUY3SUpd09+xR80lql6t8xXFo95a/2xOpZjIQ7+Bm N8wuibZRjNBi/8oCHadlKQkNjb+cjUnisMaIKzgVXp9PE1Mfrns8s6vjlqJ8ZjnMQWjt swfJCvxObdfKfv3zz0f3vRBMyrRP0HBxfEZzNupnu+aiVewGTRZD0+mllJjmO1h/NOJX KqPGlwEpodVOpx3KE5yPTMXR4I6cVw6EDBExnAZ7i8k9UVi4ivgEVALV8zJ9DG06xPB4 BOikBqfuYj0He60Mk6Tbv6vQzkuvjKAr2Z4SY5AsBOOPYbtb8D/16VvSEjobebs/yWrP 4bVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mQqren3SabSmNoA5QVuXoLb4xDGESav0uq95Aq1SI5Y=; b=omJUBxCf13hqWCV2pmq1sgZLm68eL76bEHMJbeyYFZTISeO8Lc9BW+hGKFVg3QPE14 ep6pcXFazYQXli1uv1ooAmKtvcRfrPnUSwJDbvgtXi80IKIiUPfzvlkV9qR5R/DNZpyT LD332gW458dcnMbP+eIXOs4iSRhCB0ForvyVKzY2DxFtce1jPVBSR6xDdRTrZ5LYVO2Q PY0CCLLki67zXWoPmTIvNQhIuBteUfAuVl6p6jMzA+9xsi5EKivDpnrl8meTuKO96dnp HkPiDlm0GexIiZ33lHvlXF+tANALsYMkwhUismiTQlWvdCiSgWefHhOPKpzT9hM3SqLt G4hA== X-Gm-Message-State: APjAAAUPxr/IX+MKe7cIEIwflErjFesNqofoWm8iTvLhXyZGlOD9x8hE Wi5owE5i/JtNN/MqgyPd8Q== X-Google-Smtp-Source: APXvYqxfoGm157gE4uAB0UzWUbOwocpYtZGmZlhR1FTcm+0lydgVezAphoFhUBKe6Ng5jjogSMcewg== X-Received: by 2002:a25:447:: with SMTP id 68mr70281713ybe.432.1578342447766; Mon, 06 Jan 2020 12:27:27 -0800 (PST) Received: from localhost.localdomain (c-68-40-189-247.hsd1.mi.comcast.net. [68.40.189.247]) by smtp.gmail.com with ESMTPSA id l200sm28723579ywl.106.2020.01.06.12.27.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jan 2020 12:27:27 -0800 (PST) From: Trond Myklebust X-Google-Original-From: Trond Myklebust To: Anna Schumaker Cc: linux-nfs@vger.kernel.org Subject: [PATCH 02/15] NFS: Revalidate the file mapping on all fatal writeback errors Date: Mon, 6 Jan 2020 15:25:01 -0500 Message-Id: <20200106202514.785483-3-trond.myklebust@hammerspace.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200106202514.785483-2-trond.myklebust@hammerspace.com> References: <20200106202514.785483-1-trond.myklebust@hammerspace.com> <20200106202514.785483-2-trond.myklebust@hammerspace.com> MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org If a write or commit failed, and the mapping sees a fatal error, we need to revalidate the contents of that mapping. Fixes: 06c9fdf3b9f1 ("NFS: On fatal writeback errors, we need to call nfs_inode_remove_request()") Signed-off-by: Trond Myklebust --- fs/nfs/write.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/fs/nfs/write.c b/fs/nfs/write.c index f5170bc839aa..83e6f691368c 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c @@ -256,8 +256,11 @@ static void nfs_set_pageerror(struct address_space *mapping) static void nfs_mapping_set_error(struct page *page, int error) { + struct address_space *mapping = page_file_mapping(page); + SetPageError(page); - mapping_set_error(page_file_mapping(page), error); + mapping_set_error(mapping, error); + nfs_set_pageerror(mapping); } /* @@ -600,7 +603,6 @@ nfs_lock_and_join_requests(struct page *page) static void nfs_write_error(struct nfs_page *req, int error) { - nfs_set_pageerror(page_file_mapping(req->wb_page)); nfs_mapping_set_error(req->wb_page, error); nfs_inode_remove_request(req); nfs_end_page_writeback(req); @@ -1006,7 +1008,6 @@ static void nfs_write_completion(struct nfs_pgio_header *hdr) nfs_list_remove_request(req); if (test_bit(NFS_IOHDR_ERROR, &hdr->flags) && (hdr->good_bytes < bytes)) { - nfs_set_pageerror(page_file_mapping(req->wb_page)); nfs_mapping_set_error(req->wb_page, hdr->error); goto remove_req; } From patchwork Mon Jan 6 20:25:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 11320023 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 AD4911871 for ; Mon, 6 Jan 2020 20:27:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 81A672146E for ; Mon, 6 Jan 2020 20:27:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="m5XZc0jg" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726719AbgAFU1b (ORCPT ); Mon, 6 Jan 2020 15:27:31 -0500 Received: from mail-yb1-f196.google.com ([209.85.219.196]:45898 "EHLO mail-yb1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726657AbgAFU1a (ORCPT ); Mon, 6 Jan 2020 15:27:30 -0500 Received: by mail-yb1-f196.google.com with SMTP id y67so12949050yba.12 for ; Mon, 06 Jan 2020 12:27:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=i+snDxw5LWzA/yVXLyueqvl0AS6uUMQiDPvu/gPn61E=; b=m5XZc0jgXttb9Zq5uPrLDFjQcPzkZAapWveMcO20vFNhbisa1WlWibiuwJh0j0+GTp un+4VO2p2YczHHbHKwiwAAurfIEBdtDXLpRMy/Rb6MaAeNdtmP9WpMMx3J0BM2Bpdfw8 9MJBxHvLJTfZhSnpbSOtYKnMHI4kXt+WhlHhyKmYghdCGjI3RHNSxRU3H7o/J00FqSWO hod1x4KlvNjrtD32E1Eujc8H4uA1DGJfZeGd6u8Wr8EKHyxOFLVFJwd5pnfoL94NJEkc BhYzIERY+NbuYobqy7vgFB5NTfcj8EdL9Dm7I66dXeS9Xc2nVtYzgnim2DHMdb39Ooi8 iHgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=i+snDxw5LWzA/yVXLyueqvl0AS6uUMQiDPvu/gPn61E=; b=j7uYZCGevnJHsKU9mNhSc37rlLQ0dh/sydQPoCrwhp2BcnBYInhWQhSpxyi7v9uM/i f5tjU2lhM0DCFC49Z99nEJdEODruY/SGBTcYQ7YKzPzjKUBYlONPt6tgYSVPetu6j5Cr Ymh9+/3LF1nlrW5XSK+Viv6xneDbgNI+0jfDucFwJrtLNfER6NLgEOs4stgR0Smb3lVw fF3buLoNnqtAA0OUNgwMbLrOmu3tjm/G6cyvsb9+F9vJPWVgMMItS0lMaiNsiMkFNZf4 ENVEHRuDgp7jY8q1C25Xj7Xo46Rk7KD4oJx7z0VNeJbTO/pPwH42vILTnZHrqbR3S7lI 8dsQ== X-Gm-Message-State: APjAAAUqudk7PFgJ8uFsR7nemD+qXlcjcx++GcmzDoMS6WVrXwiEwlIF UNutMj/QMY3OJ1hj5nLHLDGM7F+xbQ== X-Google-Smtp-Source: APXvYqySg5rwx+VwZSiH1zu4p1kXXTBTP2eAUfIbu5cKGZ+eP6uDN/wp2921n3uTNN3SKH/Ophd7bg== X-Received: by 2002:a25:2d55:: with SMTP id s21mr75247556ybe.521.1578342449248; Mon, 06 Jan 2020 12:27:29 -0800 (PST) Received: from localhost.localdomain (c-68-40-189-247.hsd1.mi.comcast.net. [68.40.189.247]) by smtp.gmail.com with ESMTPSA id l200sm28723579ywl.106.2020.01.06.12.27.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jan 2020 12:27:28 -0800 (PST) From: Trond Myklebust X-Google-Original-From: Trond Myklebust To: Anna Schumaker Cc: linux-nfs@vger.kernel.org Subject: [PATCH 03/15] SUNRPC: Remove broken gss_mech_list_pseudoflavors() Date: Mon, 6 Jan 2020 15:25:02 -0500 Message-Id: <20200106202514.785483-4-trond.myklebust@hammerspace.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200106202514.785483-3-trond.myklebust@hammerspace.com> References: <20200106202514.785483-1-trond.myklebust@hammerspace.com> <20200106202514.785483-2-trond.myklebust@hammerspace.com> <20200106202514.785483-3-trond.myklebust@hammerspace.com> MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Remove gss_mech_list_pseudoflavors() and its callers. This is part of an unused API, and could leak an RCU reference if it were ever called. Signed-off-by: Trond Myklebust --- include/linux/sunrpc/auth.h | 2 -- include/linux/sunrpc/gss_api.h | 3 -- net/sunrpc/auth.c | 49 --------------------------- net/sunrpc/auth_gss/auth_gss.c | 1 - net/sunrpc/auth_gss/gss_mech_switch.c | 29 ---------------- 5 files changed, 84 deletions(-) diff --git a/include/linux/sunrpc/auth.h b/include/linux/sunrpc/auth.h index e9ec742796e7..4f6b28487f28 100644 --- a/include/linux/sunrpc/auth.h +++ b/include/linux/sunrpc/auth.h @@ -113,7 +113,6 @@ struct rpc_authops { int (*hash_cred)(struct auth_cred *, unsigned int); struct rpc_cred * (*lookup_cred)(struct rpc_auth *, struct auth_cred *, int); struct rpc_cred * (*crcreate)(struct rpc_auth*, struct auth_cred *, int, gfp_t); - int (*list_pseudoflavors)(rpc_authflavor_t *, int); rpc_authflavor_t (*info2flavor)(struct rpcsec_gss_info *); int (*flavor2info)(rpc_authflavor_t, struct rpcsec_gss_info *); @@ -158,7 +157,6 @@ rpc_authflavor_t rpcauth_get_pseudoflavor(rpc_authflavor_t, struct rpcsec_gss_info *); int rpcauth_get_gssinfo(rpc_authflavor_t, struct rpcsec_gss_info *); -int rpcauth_list_flavors(rpc_authflavor_t *, int); struct rpc_cred * rpcauth_lookup_credcache(struct rpc_auth *, struct auth_cred *, int, gfp_t); void rpcauth_init_cred(struct rpc_cred *, const struct auth_cred *, struct rpc_auth *, const struct rpc_credops *); struct rpc_cred * rpcauth_lookupcred(struct rpc_auth *, int); diff --git a/include/linux/sunrpc/gss_api.h b/include/linux/sunrpc/gss_api.h index bd691e08be3b..4c4cb087f3e8 100644 --- a/include/linux/sunrpc/gss_api.h +++ b/include/linux/sunrpc/gss_api.h @@ -150,9 +150,6 @@ struct gss_api_mech *gss_mech_get_by_name(const char *); /* Similar, but get by pseudoflavor. */ struct gss_api_mech *gss_mech_get_by_pseudoflavor(u32); -/* Fill in an array with a list of supported pseudoflavors */ -int gss_mech_list_pseudoflavors(rpc_authflavor_t *, int); - struct gss_api_mech * gss_mech_get(struct gss_api_mech *); /* For every successful gss_mech_get or gss_mech_get_by_* call there must be a diff --git a/net/sunrpc/auth.c b/net/sunrpc/auth.c index cdb05b48de44..5748ad0ba1bd 100644 --- a/net/sunrpc/auth.c +++ b/net/sunrpc/auth.c @@ -221,55 +221,6 @@ rpcauth_get_gssinfo(rpc_authflavor_t pseudoflavor, struct rpcsec_gss_info *info) } EXPORT_SYMBOL_GPL(rpcauth_get_gssinfo); -/** - * rpcauth_list_flavors - discover registered flavors and pseudoflavors - * @array: array to fill in - * @size: size of "array" - * - * Returns the number of array items filled in, or a negative errno. - * - * The returned array is not sorted by any policy. Callers should not - * rely on the order of the items in the returned array. - */ -int -rpcauth_list_flavors(rpc_authflavor_t *array, int size) -{ - const struct rpc_authops *ops; - rpc_authflavor_t flavor, pseudos[4]; - int i, len, result = 0; - - rcu_read_lock(); - for (flavor = 0; flavor < RPC_AUTH_MAXFLAVOR; flavor++) { - ops = rcu_dereference(auth_flavors[flavor]); - if (result >= size) { - result = -ENOMEM; - break; - } - - if (ops == NULL) - continue; - if (ops->list_pseudoflavors == NULL) { - array[result++] = ops->au_flavor; - continue; - } - len = ops->list_pseudoflavors(pseudos, ARRAY_SIZE(pseudos)); - if (len < 0) { - result = len; - break; - } - for (i = 0; i < len; i++) { - if (result >= size) { - result = -ENOMEM; - break; - } - array[result++] = pseudos[i]; - } - } - rcu_read_unlock(); - return result; -} -EXPORT_SYMBOL_GPL(rpcauth_list_flavors); - struct rpc_auth * rpcauth_create(const struct rpc_auth_create_args *args, struct rpc_clnt *clnt) { diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c index d75fddca44c9..24ca861815b1 100644 --- a/net/sunrpc/auth_gss/auth_gss.c +++ b/net/sunrpc/auth_gss/auth_gss.c @@ -2118,7 +2118,6 @@ static const struct rpc_authops authgss_ops = { .hash_cred = gss_hash_cred, .lookup_cred = gss_lookup_cred, .crcreate = gss_create_cred, - .list_pseudoflavors = gss_mech_list_pseudoflavors, .info2flavor = gss_mech_info2flavor, .flavor2info = gss_mech_flavor2info, }; diff --git a/net/sunrpc/auth_gss/gss_mech_switch.c b/net/sunrpc/auth_gss/gss_mech_switch.c index 30b7de6f3d76..22d4be8e38c8 100644 --- a/net/sunrpc/auth_gss/gss_mech_switch.c +++ b/net/sunrpc/auth_gss/gss_mech_switch.c @@ -219,35 +219,6 @@ gss_mech_get_by_pseudoflavor(u32 pseudoflavor) return gm; } -/** - * gss_mech_list_pseudoflavors - Discover registered GSS pseudoflavors - * @array_ptr: array to fill in - * @size: size of "array" - * - * Returns the number of array items filled in, or a negative errno. - * - * The returned array is not sorted by any policy. Callers should not - * rely on the order of the items in the returned array. - */ -int gss_mech_list_pseudoflavors(rpc_authflavor_t *array_ptr, int size) -{ - struct gss_api_mech *pos = NULL; - int j, i = 0; - - rcu_read_lock(); - list_for_each_entry_rcu(pos, ®istered_mechs, gm_list) { - for (j = 0; j < pos->gm_pf_num; j++) { - if (i >= size) { - spin_unlock(®istered_mechs_lock); - return -ENOMEM; - } - array_ptr[i++] = pos->gm_pfs[j].pseudoflavor; - } - } - rcu_read_unlock(); - return i; -} - /** * gss_svc_to_pseudoflavor - map a GSS service number to a pseudoflavor * @gm: GSS mechanism handle From patchwork Mon Jan 6 20:25:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 11320025 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 ABD3614DB for ; Mon, 6 Jan 2020 20:27:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8AC152146E for ; Mon, 6 Jan 2020 20:27:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="M6WuI1aQ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726657AbgAFU1b (ORCPT ); Mon, 6 Jan 2020 15:27:31 -0500 Received: from mail-yw1-f67.google.com ([209.85.161.67]:35964 "EHLO mail-yw1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726713AbgAFU1b (ORCPT ); Mon, 6 Jan 2020 15:27:31 -0500 Received: by mail-yw1-f67.google.com with SMTP id n184so22431728ywc.3 for ; Mon, 06 Jan 2020 12:27:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=eDDBm34n3ZIRRXM4ToxivPkQNAwdYtMrj60iL6y69S0=; b=M6WuI1aQ649EJNkM5KvG3uul1wvoRWZm5wBqoNJ1qr2f2kiYpMkoHGY9xlM8/rlBpQ MyvKZ1qtNtGz/76NOd5mgkMc2Vqt9UdvSCktdEnDTgoRJv6jJmNT+H+6P5T8VtaKfHX9 CL+tAiagKyf8qdnX/5I1FkMZ90MNvuwS/m4LgJcbbKBzhNi3oy8+Z11QEvIysaavPcKw TJqh3Bln6M9jd8aenphT4nZKBDznNxN+t6pOB7uCsCdN00o7iiVOUp87dCFFJnhnbFvW Z9XP97xQgxlGQ4nGHxa6t/M8X3YPo20VNgn4A/EWZd+ne7m+maQMsw73f+9MrBIBE8cV eP5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=eDDBm34n3ZIRRXM4ToxivPkQNAwdYtMrj60iL6y69S0=; b=Y4Jk12mBHtLtfcEpx3fpxoW2PSDgM30hckFEehAIdLlr+j2yusEw48wcwxS1HeosU/ chpJZx5vN2lbLXzv6+NDvd77wagPKE/D92ibi5cUiEoahOcUbyFL72zqvAc/nbaaJezW yvmjmm4I/0Iw9CqoAAFxSW+44UGW78esv2kRonJqh11fjEYvgEaWPFLgZH9+07NEUbUw DsRoBwDfdd1c0EfGdS/HmxlhGGpocNOOXzRvH18Wt9vezu9bdjv5IaER7sg/7XY6Mmlm q1U2bze/xI2KkNCjFlcvaxGKkOGZ9buuckQEbNa+1c5Vn771itz5HuwL+uhxBnr6jK8Y G33A== X-Gm-Message-State: APjAAAXuvYHQqq3BUe+HXdOPaBL1qshb0PSt+JO7X4sYgpSprGQ2I1kL 0NCMEQU4yxmavZf+z01p+1rEwq54Tg== X-Google-Smtp-Source: APXvYqxppsa59SpQ+kJKXH45KBSFzjjVHr2DPe2XlvztaSVydNav6ExJ361HKv286KMjdO++lB5tHQ== X-Received: by 2002:a0d:f481:: with SMTP id d123mr73316872ywf.411.1578342450238; Mon, 06 Jan 2020 12:27:30 -0800 (PST) Received: from localhost.localdomain (c-68-40-189-247.hsd1.mi.comcast.net. [68.40.189.247]) by smtp.gmail.com with ESMTPSA id l200sm28723579ywl.106.2020.01.06.12.27.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jan 2020 12:27:29 -0800 (PST) From: Trond Myklebust X-Google-Original-From: Trond Myklebust To: Anna Schumaker Cc: linux-nfs@vger.kernel.org Subject: [PATCH 04/15] NFS: Fix up fsync() when the server rebooted Date: Mon, 6 Jan 2020 15:25:03 -0500 Message-Id: <20200106202514.785483-5-trond.myklebust@hammerspace.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200106202514.785483-4-trond.myklebust@hammerspace.com> References: <20200106202514.785483-1-trond.myklebust@hammerspace.com> <20200106202514.785483-2-trond.myklebust@hammerspace.com> <20200106202514.785483-3-trond.myklebust@hammerspace.com> <20200106202514.785483-4-trond.myklebust@hammerspace.com> MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Don't clear the NFS_CONTEXT_RESEND_WRITES flag until after calling nfs_commit_inode(). Otherwise, if nfs_commit_inode() returns an error, we end up with dirty pages in the page cache, but no tag to tell us that those pages need resending. Signed-off-by: Trond Myklebust --- fs/nfs/file.c | 37 ++++++++++++++++--------------------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/fs/nfs/file.c b/fs/nfs/file.c index 8eb731d9be3e..95a3445c8926 100644 --- a/fs/nfs/file.c +++ b/fs/nfs/file.c @@ -204,44 +204,39 @@ EXPORT_SYMBOL_GPL(nfs_file_mmap); static int nfs_file_fsync_commit(struct file *file, int datasync) { - struct nfs_open_context *ctx = nfs_file_open_context(file); struct inode *inode = file_inode(file); - int do_resend, status; - int ret = 0; + int ret; dprintk("NFS: fsync file(%pD2) datasync %d\n", file, datasync); nfs_inc_stats(inode, NFSIOS_VFSFSYNC); - do_resend = test_and_clear_bit(NFS_CONTEXT_RESEND_WRITES, &ctx->flags); - status = nfs_commit_inode(inode, FLUSH_SYNC); - if (status == 0) - status = file_check_and_advance_wb_err(file); - if (status < 0) { - ret = status; - goto out; - } - do_resend |= test_bit(NFS_CONTEXT_RESEND_WRITES, &ctx->flags); - if (do_resend) - ret = -EAGAIN; -out: - return ret; + ret = nfs_commit_inode(inode, FLUSH_SYNC); + if (ret < 0) + return ret; + return file_check_and_advance_wb_err(file); } int nfs_file_fsync(struct file *file, loff_t start, loff_t end, int datasync) { - int ret; + struct nfs_open_context *ctx = nfs_file_open_context(file); struct inode *inode = file_inode(file); + int ret; trace_nfs_fsync_enter(inode); - do { + for (;;) { ret = file_write_and_wait_range(file, start, end); if (ret != 0) break; ret = nfs_file_fsync_commit(file, datasync); - if (!ret) - ret = pnfs_sync_inode(inode, !!datasync); + if (ret != 0) + break; + ret = pnfs_sync_inode(inode, !!datasync); + if (ret != 0) + break; + if (!test_and_clear_bit(NFS_CONTEXT_RESEND_WRITES, &ctx->flags)) + break; /* * If nfs_file_fsync_commit detected a server reboot, then * resend all dirty pages that might have been covered by @@ -249,7 +244,7 @@ nfs_file_fsync(struct file *file, loff_t start, loff_t end, int datasync) */ start = 0; end = LLONG_MAX; - } while (ret == -EAGAIN); + } trace_nfs_fsync_exit(inode, ret); return ret; From patchwork Mon Jan 6 20:25:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 11320027 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 5029B1871 for ; Mon, 6 Jan 2020 20:27:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2E9E52146E for ; Mon, 6 Jan 2020 20:27:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="b0wX35ND" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726723AbgAFU1d (ORCPT ); Mon, 6 Jan 2020 15:27:33 -0500 Received: from mail-yb1-f193.google.com ([209.85.219.193]:38823 "EHLO mail-yb1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726713AbgAFU1d (ORCPT ); Mon, 6 Jan 2020 15:27:33 -0500 Received: by mail-yb1-f193.google.com with SMTP id c13so2083428ybq.5 for ; Mon, 06 Jan 2020 12:27:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=sZ1CS3jvxnAntYIsRzrlvpOZ3JnbABxA2F2/pGzDRXA=; b=b0wX35NDFRrnLKhoS4xIzynJLWPFqZ1+XhtOVRNYBO3s9u9MS+4I6YkglOC3u23VWi Jm+22MP53wiYKee4n3M//k4RotBWnRdO6qJlVhAKl2dYL+HikSj5H/f5Ts8ir682jvUV i2yrBx3EOPFf7U5EBIw6OAYSEvNnTkOujkvI4HbIBXFQID24d+irqVxdFn9wGCSsR74N RNPdB/ohOmIep/4LiihPXzTnG8FUatodln0Kry9IevAbzOV5qZPVLAAjfP+Cs9NY6hAu O1/UOXKw7QOkbWWfDs9KFvsUxvnmUaCyOVoj/ZKFRBFadbAIts1QX+j+WWOly3NTNvkZ DGMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=sZ1CS3jvxnAntYIsRzrlvpOZ3JnbABxA2F2/pGzDRXA=; b=SxlmtDVwXpOMdxmAHoRPi4uJBq9z0pd4FK4gjS6Dxe581lgPuwhVNEt7/jkGieFfIs 7r9dXLPDMGfEO9P1PmMPSl0/B3Or3A5H1SUdHCp7Mjvj6PRE4w0YTINYi11LfRZFnwE2 8I3Hc/6kKEBSHgkFqGcngIdMyUm5ROAZ/cgih4kHbUxd0ND5aYFDGR5MHWnz22Ya8Py6 UM1pJCD/XfrmifYAwYrgjl9VcbuFjlXEDBDPHL4aivaoPwnIvYvOZ/cheseh7xURYKYs QeH7253I9jgawgsuhH4S8frHoE1XapZG+KuRpacRDhzBIt9ozuauoHuw2Buwixv6nFuX 70vw== X-Gm-Message-State: APjAAAVbXEYwr9roBK2YxMTSqdLa5RQ8/q6+rj/I9id9tdqVaBRQCAou l+rwbruIQw4iDE2xeqNl1g== X-Google-Smtp-Source: APXvYqzBM9vkw03m28viVW+FBqpZVNPXd1JUNxmmbKnitkdHpDyFsPDmcRcbqOGuKkrz4URKHAzUuQ== X-Received: by 2002:a25:d03:: with SMTP id 3mr23848193ybn.368.1578342451576; Mon, 06 Jan 2020 12:27:31 -0800 (PST) Received: from localhost.localdomain (c-68-40-189-247.hsd1.mi.comcast.net. [68.40.189.247]) by smtp.gmail.com with ESMTPSA id l200sm28723579ywl.106.2020.01.06.12.27.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jan 2020 12:27:31 -0800 (PST) From: Trond Myklebust X-Google-Original-From: Trond Myklebust To: Anna Schumaker Cc: linux-nfs@vger.kernel.org Subject: [PATCH 05/15] NFS/pnfs: Fix pnfs_generic_prepare_to_resend_writes() Date: Mon, 6 Jan 2020 15:25:04 -0500 Message-Id: <20200106202514.785483-6-trond.myklebust@hammerspace.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200106202514.785483-5-trond.myklebust@hammerspace.com> References: <20200106202514.785483-1-trond.myklebust@hammerspace.com> <20200106202514.785483-2-trond.myklebust@hammerspace.com> <20200106202514.785483-3-trond.myklebust@hammerspace.com> <20200106202514.785483-4-trond.myklebust@hammerspace.com> <20200106202514.785483-5-trond.myklebust@hammerspace.com> MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Instead of making assumptions about the commit verifier contents, change the commit code to ensure we always check that the verifier was set by the XDR code. Fixes: f54bcf2ecee9 ("pnfs: Prepare for flexfiles by pulling out common code") Signed-off-by: Trond Myklebust --- fs/nfs/direct.c | 4 ++-- fs/nfs/nfs3xdr.c | 5 ++++- fs/nfs/nfs4xdr.c | 5 ++++- fs/nfs/pnfs_nfs.c | 7 +++---- fs/nfs/write.c | 4 +++- 5 files changed, 16 insertions(+), 9 deletions(-) diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c index 040a50fd9bf3..29f00da8a0b7 100644 --- a/fs/nfs/direct.c +++ b/fs/nfs/direct.c @@ -245,10 +245,10 @@ static int nfs_direct_cmp_commit_data_verf(struct nfs_direct_req *dreq, data->ds_commit_index); /* verifier not set so always fail */ - if (verfp->committed < 0) + if (verfp->committed < 0 || data->res.verf->committed <= NFS_UNSTABLE) return 1; - return nfs_direct_cmp_verf(verfp, &data->verf); + return nfs_direct_cmp_verf(verfp, data->res.verf); } /** diff --git a/fs/nfs/nfs3xdr.c b/fs/nfs/nfs3xdr.c index 927eb680f161..69971f6c840d 100644 --- a/fs/nfs/nfs3xdr.c +++ b/fs/nfs/nfs3xdr.c @@ -2334,6 +2334,7 @@ static int nfs3_xdr_dec_commit3res(struct rpc_rqst *req, void *data) { struct nfs_commitres *result = data; + struct nfs_writeverf *verf = result->verf; enum nfs_stat status; int error; @@ -2346,7 +2347,9 @@ static int nfs3_xdr_dec_commit3res(struct rpc_rqst *req, result->op_status = status; if (status != NFS3_OK) goto out_status; - error = decode_writeverf3(xdr, &result->verf->verifier); + error = decode_writeverf3(xdr, &verf->verifier); + if (!error) + verf->committed = NFS_FILE_SYNC; out: return error; out_status: diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index 936c57779ff4..d0feef17db50 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c @@ -4313,11 +4313,14 @@ static int decode_write_verifier(struct xdr_stream *xdr, struct nfs_write_verifi static int decode_commit(struct xdr_stream *xdr, struct nfs_commitres *res) { + struct nfs_writeverf *verf = res->verf; int status; status = decode_op_hdr(xdr, OP_COMMIT); if (!status) - status = decode_write_verifier(xdr, &res->verf->verifier); + status = decode_write_verifier(xdr, &verf->verifier); + if (!status) + verf->committed = NFS_FILE_SYNC; return status; } diff --git a/fs/nfs/pnfs_nfs.c b/fs/nfs/pnfs_nfs.c index 82af4809b869..8b37e7f8e789 100644 --- a/fs/nfs/pnfs_nfs.c +++ b/fs/nfs/pnfs_nfs.c @@ -31,12 +31,11 @@ EXPORT_SYMBOL_GPL(pnfs_generic_rw_release); /* Fake up some data that will cause nfs_commit_release to retry the writes. */ void pnfs_generic_prepare_to_resend_writes(struct nfs_commit_data *data) { - struct nfs_page *first = nfs_list_entry(data->pages.next); + struct nfs_writeverf *verf = data->res.verf; data->task.tk_status = 0; - memcpy(&data->verf.verifier, &first->wb_verf, - sizeof(data->verf.verifier)); - data->verf.verifier.data[0]++; /* ensure verifier mismatch */ + memset(&verf->verifier, 0, sizeof(verf->verifier)); + verf->committed = NFS_UNSTABLE; } EXPORT_SYMBOL_GPL(pnfs_generic_prepare_to_resend_writes); diff --git a/fs/nfs/write.c b/fs/nfs/write.c index 83e6f691368c..ab3d4611f0aa 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c @@ -1838,6 +1838,7 @@ static void nfs_commit_done(struct rpc_task *task, void *calldata) static void nfs_commit_release_pages(struct nfs_commit_data *data) { + const struct nfs_writeverf *verf = data->res.verf; struct nfs_page *req; int status = data->task.tk_status; struct nfs_commit_info cinfo; @@ -1865,7 +1866,8 @@ static void nfs_commit_release_pages(struct nfs_commit_data *data) /* Okay, COMMIT succeeded, apparently. Check the verifier * returned by the server against all stored verfs. */ - if (!nfs_write_verifier_cmp(&req->wb_verf, &data->verf.verifier)) { + if (verf->committed > NFS_UNSTABLE && + !nfs_write_verifier_cmp(&req->wb_verf, &verf->verifier)) { /* We have a match */ if (req->wb_page) nfs_inode_remove_request(req); From patchwork Mon Jan 6 20:25:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 11320029 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 667571871 for ; Mon, 6 Jan 2020 20:27:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 39BE42146E for ; Mon, 6 Jan 2020 20:27:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MwSqQ/Cr" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726731AbgAFU1e (ORCPT ); Mon, 6 Jan 2020 15:27:34 -0500 Received: from mail-yw1-f68.google.com ([209.85.161.68]:35967 "EHLO mail-yw1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726721AbgAFU1e (ORCPT ); Mon, 6 Jan 2020 15:27:34 -0500 Received: by mail-yw1-f68.google.com with SMTP id n184so22431784ywc.3 for ; Mon, 06 Jan 2020 12:27:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=t2HVIvvAWl6CAUdqZd8MDCS0BbExZ4DPY8F7IMA1x3o=; b=MwSqQ/CrBb+trAat9+nWTg1q4A00q+T3ehos7+tffEyOJ6g5FU+thBbvGAzR/jt0RD fG1fk7IuFKotd0WrxSS15jsIlxZsyaV/6fi8hiL/uP+G1gdB8CV1KM8XNHM3JgtoBFOl z9zMJM2aw+ouCxKpUwDeTiDf1MiTOE5fbpcqn4K+fM6MYLpL8zSzRD+FNOo41Q7HMBcH 8yvploi0+V90QDL6dgiRvrJtAbkdJLFe0qTlDu5KIER/lq7B1/wkQW1jle1EZbSLcUd1 BvOW9mZtON9oBfWZwdVOYJ/1dJqUVz0nhYowikcRrFdk1818W8Nv7GEay37psDqr5lHp dAQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=t2HVIvvAWl6CAUdqZd8MDCS0BbExZ4DPY8F7IMA1x3o=; b=jU3EQytp0mxQTLwiMJ0eeiazn8fzIMQNNEmjOjH7OVEX8cWvi9OkxZ/gTvO0ZJMeuZ fbjrim3gyeiezXgeu7k1+2rT/qZ8sFmqOqgqqqxHE18FxHTBtVBq0eYF1As9GClPGf5P wGU/+9n/cBalL9I8i0/pByBLeVPCt1gULl/D16DUqV2FmsTcaVugld7IWhO1ox1UlVi/ eWKnLDaICK+DcvtqAuDnHbB9N0LDQnm8/3h/BGwJi/1rbxqT1oxYdgE97EqSxwwlRida 1mD2k+bCoxI0zT5LW5rRYAZytsZYuMAiF2XX3FPy7od258xaJbnhzzdR0RMfHTYTuwaO p2nQ== X-Gm-Message-State: APjAAAVMUkgRbokTFpjM5vbf47A1w1Ci6w7bth5Of/0kzo1aPpC14Kz+ K8DOqgoQwmPrx4OfUr/EtQ== X-Google-Smtp-Source: APXvYqz8lCXBlsUPVPu4cduNDbGaKgKbqV+JyqUJsm77ubljlyXQjIQfxZDxriqmS9nvN3+HHueA4w== X-Received: by 2002:a81:a0c3:: with SMTP id x186mr75848883ywg.344.1578342452874; Mon, 06 Jan 2020 12:27:32 -0800 (PST) Received: from localhost.localdomain (c-68-40-189-247.hsd1.mi.comcast.net. [68.40.189.247]) by smtp.gmail.com with ESMTPSA id l200sm28723579ywl.106.2020.01.06.12.27.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jan 2020 12:27:32 -0800 (PST) From: Trond Myklebust X-Google-Original-From: Trond Myklebust To: Anna Schumaker Cc: linux-nfs@vger.kernel.org Subject: [PATCH 06/15] NFSv4: Improve read/write/commit tracing Date: Mon, 6 Jan 2020 15:25:05 -0500 Message-Id: <20200106202514.785483-7-trond.myklebust@hammerspace.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200106202514.785483-6-trond.myklebust@hammerspace.com> References: <20200106202514.785483-1-trond.myklebust@hammerspace.com> <20200106202514.785483-2-trond.myklebust@hammerspace.com> <20200106202514.785483-3-trond.myklebust@hammerspace.com> <20200106202514.785483-4-trond.myklebust@hammerspace.com> <20200106202514.785483-5-trond.myklebust@hammerspace.com> <20200106202514.785483-6-trond.myklebust@hammerspace.com> MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Ensure we always return the number of bytes read/written. Also display the pnfs filehandle if it is in use. Signed-off-by: Trond Myklebust --- fs/nfs/nfs4trace.h | 52 ++++++++++++++++++++++++++++++---------------- 1 file changed, 34 insertions(+), 18 deletions(-) diff --git a/fs/nfs/nfs4trace.h b/fs/nfs/nfs4trace.h index e60b6fbd5ada..a3155b7f8063 100644 --- a/fs/nfs/nfs4trace.h +++ b/fs/nfs/nfs4trace.h @@ -1694,7 +1694,8 @@ DECLARE_EVENT_CLASS(nfs4_read_event, __field(u32, fhandle) __field(u64, fileid) __field(loff_t, offset) - __field(size_t, count) + __field(u32, arg_count) + __field(u32, res_count) __field(unsigned long, error) __field(int, stateid_seq) __field(u32, stateid_hash) @@ -1702,13 +1703,18 @@ DECLARE_EVENT_CLASS(nfs4_read_event, TP_fast_assign( const struct inode *inode = hdr->inode; + const struct nfs_inode *nfsi = NFS_I(inode); + const struct nfs_fh *fh = hdr->args.fh ? + hdr->args.fh : &nfsi->fh; const struct nfs4_state *state = hdr->args.context->state; + __entry->dev = inode->i_sb->s_dev; - __entry->fileid = NFS_FILEID(inode); - __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode)); + __entry->fileid = nfsi->fileid; + __entry->fhandle = nfs_fhandle_hash(fh); __entry->offset = hdr->args.offset; - __entry->count = hdr->args.count; + __entry->arg_count = hdr->args.count; + __entry->res_count = hdr->res.count; __entry->error = error < 0 ? -error : 0; __entry->stateid_seq = be32_to_cpu(state->stateid.seqid); @@ -1718,14 +1724,14 @@ DECLARE_EVENT_CLASS(nfs4_read_event, TP_printk( "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " - "offset=%lld count=%zu stateid=%d:0x%08x", + "offset=%lld count=%u res=%u stateid=%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->arg_count, __entry->res_count, __entry->stateid_seq, __entry->stateid_hash ) ); @@ -1754,7 +1760,8 @@ DECLARE_EVENT_CLASS(nfs4_write_event, __field(u32, fhandle) __field(u64, fileid) __field(loff_t, offset) - __field(size_t, count) + __field(u32, arg_count) + __field(u32, res_count) __field(unsigned long, error) __field(int, stateid_seq) __field(u32, stateid_hash) @@ -1762,13 +1769,18 @@ DECLARE_EVENT_CLASS(nfs4_write_event, TP_fast_assign( const struct inode *inode = hdr->inode; + const struct nfs_inode *nfsi = NFS_I(inode); + const struct nfs_fh *fh = hdr->args.fh ? + hdr->args.fh : &nfsi->fh; const struct nfs4_state *state = hdr->args.context->state; + __entry->dev = inode->i_sb->s_dev; - __entry->fileid = NFS_FILEID(inode); - __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode)); + __entry->fileid = nfsi->fileid; + __entry->fhandle = nfs_fhandle_hash(fh); __entry->offset = hdr->args.offset; - __entry->count = hdr->args.count; + __entry->arg_count = hdr->args.count; + __entry->res_count = hdr->res.count; __entry->error = error < 0 ? -error : 0; __entry->stateid_seq = be32_to_cpu(state->stateid.seqid); @@ -1778,14 +1790,14 @@ DECLARE_EVENT_CLASS(nfs4_write_event, TP_printk( "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " - "offset=%lld count=%zu stateid=%d:0x%08x", + "offset=%lld count=%u res=%u stateid=%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->arg_count, __entry->res_count, __entry->stateid_seq, __entry->stateid_hash ) ); @@ -1814,24 +1826,28 @@ DECLARE_EVENT_CLASS(nfs4_commit_event, __field(dev_t, dev) __field(u32, fhandle) __field(u64, fileid) - __field(loff_t, offset) - __field(size_t, count) __field(unsigned long, error) + __field(loff_t, offset) + __field(u32, count) ), TP_fast_assign( const struct inode *inode = data->inode; + const struct nfs_inode *nfsi = NFS_I(inode); + const struct nfs_fh *fh = data->args.fh ? + data->args.fh : &nfsi->fh; + __entry->dev = inode->i_sb->s_dev; - __entry->fileid = NFS_FILEID(inode); - __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode)); + __entry->fileid = nfsi->fileid; + __entry->fhandle = nfs_fhandle_hash(fh); __entry->offset = data->args.offset; __entry->count = data->args.count; - __entry->error = error; + __entry->error = error < 0 ? -error : 0; ), TP_printk( "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " - "offset=%lld count=%zu", + "offset=%lld count=%u", -__entry->error, show_nfsv4_errors(__entry->error), MAJOR(__entry->dev), MINOR(__entry->dev), From patchwork Mon Jan 6 20:25:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 11320031 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 67B6314DB for ; Mon, 6 Jan 2020 20:27:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3BE592146E for ; Mon, 6 Jan 2020 20:27:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="N0Gp5hR1" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726742AbgAFU1f (ORCPT ); Mon, 6 Jan 2020 15:27:35 -0500 Received: from mail-yb1-f193.google.com ([209.85.219.193]:43469 "EHLO mail-yb1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726713AbgAFU1f (ORCPT ); Mon, 6 Jan 2020 15:27:35 -0500 Received: by mail-yb1-f193.google.com with SMTP id v24so22617490ybd.10 for ; Mon, 06 Jan 2020 12:27:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=yOYjnXKvMR2Gy515cExSrZS0OY98LvNhpkak+KdJAw0=; b=N0Gp5hR1Wv6AXz7wdP8djzpg0N2mQPxcaBRfFyHS3agUpDdTM5sYPMEcR4fyX3zqSv DFRXymtijMJr5IraBKZTziYCW32+pogvoG2oF5Q8avvI0A030E+6ZTrkL0y3k3rKuBeF dbV7fbMs7xVsdsVqIcE73fbNLiWJ7HYHnG8eJKWgD2xVmCgUtaMoz8eacBTqfv0ELW0N GqvW0z46ERFI4kEp23F5pyZF+ustIXiP8tThbPRy4p70SBk/JveBwLMRpNcUwdp1eAq8 5myuLXd+7OAz2j2RCET4mbvR9JTvwhBDZ7Sx0vWzLcrT1elEammlNuNZbQXROPUhoh6Y wYSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yOYjnXKvMR2Gy515cExSrZS0OY98LvNhpkak+KdJAw0=; b=TkW4rBN4XyHYC8SYoVssrjwPt1+30mVDDiWkR/XQLoP4b03t5BS85MDDQtPGHAczDN Egsust9hD92qPG7DIomp0oKrij76P8MXxaQNacEUaQim6s9RDjE3Ao+qx5EQdKWZZzNZ Od8nCZk2ew2l7O/QMeLPRwD3L8xZ6wTLj+H5cpNWDmwHLGGDweJ9/eASX67dpjRwSz+V N4kgmI8AeHFVECYXWSmYYGvWwCd3jGF8JfzWqf9QMetAH5PCVJ5wcC/57qypH9LnI8UO vMn0iKEWgCkvqamlCDE1iN2SSzwIBktgXSPxp1/mXFTFo+Yjtuxcw5NDyQDAydn1luL8 2PNg== X-Gm-Message-State: APjAAAVnsHGgAejholCJI8B3TVky85/ZzhSa6YfZGTXAemXdjjH/gT05 kqCz4DKnsoZys3b72Zfyxg== X-Google-Smtp-Source: APXvYqz4fDBtJP53AcnaT0eNwBaqRSko2noZR5679CFAaYN9QVX78VAtn+oFQlIEq58QA2bqtPRO3w== X-Received: by 2002:a25:18c4:: with SMTP id 187mr51959184yby.468.1578342454030; Mon, 06 Jan 2020 12:27:34 -0800 (PST) Received: from localhost.localdomain (c-68-40-189-247.hsd1.mi.comcast.net. [68.40.189.247]) by smtp.gmail.com with ESMTPSA id l200sm28723579ywl.106.2020.01.06.12.27.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jan 2020 12:27:33 -0800 (PST) From: Trond Myklebust X-Google-Original-From: Trond Myklebust To: Anna Schumaker Cc: linux-nfs@vger.kernel.org Subject: [PATCH 07/15] NFS: Fix fix of show_nfs_errors Date: Mon, 6 Jan 2020 15:25:06 -0500 Message-Id: <20200106202514.785483-8-trond.myklebust@hammerspace.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200106202514.785483-7-trond.myklebust@hammerspace.com> References: <20200106202514.785483-1-trond.myklebust@hammerspace.com> <20200106202514.785483-2-trond.myklebust@hammerspace.com> <20200106202514.785483-3-trond.myklebust@hammerspace.com> <20200106202514.785483-4-trond.myklebust@hammerspace.com> <20200106202514.785483-5-trond.myklebust@hammerspace.com> <20200106202514.785483-6-trond.myklebust@hammerspace.com> <20200106202514.785483-7-trond.myklebust@hammerspace.com> MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Casting a negative value to an unsigned long is not the same as converting it to its absolute value. Fixes: 96650e2effa2 ("NFS: Fix show_nfs_errors macros again") Signed-off-by: Trond Myklebust --- fs/nfs/nfs4trace.h | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/fs/nfs/nfs4trace.h b/fs/nfs/nfs4trace.h index a3155b7f8063..a291877c0c32 100644 --- a/fs/nfs/nfs4trace.h +++ b/fs/nfs/nfs4trace.h @@ -352,7 +352,7 @@ DECLARE_EVENT_CLASS(nfs4_clientid_event, ), TP_fast_assign( - __entry->error = error; + __entry->error = error < 0 ? -error : 0; __assign_str(dstaddr, clp->cl_hostname); ), @@ -432,7 +432,8 @@ TRACE_EVENT(nfs4_sequence_done, __entry->target_highest_slotid = res->sr_target_highest_slotid; __entry->status_flags = res->sr_status_flags; - __entry->error = res->sr_status; + __entry->error = res->sr_status < 0 ? + -res->sr_status : 0; ), TP_printk( "error=%ld (%s) session=0x%08x slot_nr=%u seq_nr=%u " @@ -640,7 +641,7 @@ TRACE_EVENT(nfs4_state_mgr_failed, ), TP_fast_assign( - __entry->error = status; + __entry->error = status < 0 ? -status : 0; __entry->state = clp->cl_state; __assign_str(hostname, clp->cl_hostname); __assign_str(section, section); @@ -659,7 +660,7 @@ TRACE_EVENT(nfs4_xdr_status, TP_PROTO( const struct xdr_stream *xdr, u32 op, - int error + u32 error ), TP_ARGS(xdr, op, error), @@ -849,7 +850,7 @@ TRACE_EVENT(nfs4_close, __entry->fileid = NFS_FILEID(inode); __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode)); __entry->fmode = (__force unsigned int)state->state; - __entry->error = error; + __entry->error = error < 0 ? -error : 0; __entry->stateid_seq = be32_to_cpu(args->stateid.seqid); __entry->stateid_hash = @@ -914,7 +915,7 @@ DECLARE_EVENT_CLASS(nfs4_lock_event, TP_fast_assign( const struct inode *inode = state->inode; - __entry->error = error; + __entry->error = error < 0 ? -error : 0; __entry->cmd = cmd; __entry->type = request->fl_type; __entry->start = request->fl_start; @@ -986,7 +987,7 @@ TRACE_EVENT(nfs4_set_lock, TP_fast_assign( const struct inode *inode = state->inode; - __entry->error = error; + __entry->error = error < 0 ? -error : 0; __entry->cmd = cmd; __entry->type = request->fl_type; __entry->start = request->fl_start; @@ -1164,7 +1165,7 @@ TRACE_EVENT(nfs4_delegreturn_exit, TP_fast_assign( __entry->dev = res->server->s_dev; __entry->fhandle = nfs_fhandle_hash(args->fhandle); - __entry->error = error; + __entry->error = error < 0 ? -error : 0; __entry->stateid_seq = be32_to_cpu(args->stateid->seqid); __entry->stateid_hash = @@ -1204,7 +1205,7 @@ DECLARE_EVENT_CLASS(nfs4_test_stateid_event, TP_fast_assign( const struct inode *inode = state->inode; - __entry->error = error; + __entry->error = error < 0 ? -error : 0; __entry->dev = inode->i_sb->s_dev; __entry->fileid = NFS_FILEID(inode); __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode)); @@ -1306,7 +1307,7 @@ TRACE_EVENT(nfs4_lookupp, TP_fast_assign( __entry->dev = inode->i_sb->s_dev; __entry->ino = NFS_FILEID(inode); - __entry->error = error; + __entry->error = error < 0 ? -error : 0; ), TP_printk( @@ -1342,7 +1343,7 @@ TRACE_EVENT(nfs4_rename, __entry->dev = olddir->i_sb->s_dev; __entry->olddir = NFS_FILEID(olddir); __entry->newdir = NFS_FILEID(newdir); - __entry->error = error; + __entry->error = error < 0 ? -error : 0; __assign_str(oldname, oldname->name); __assign_str(newname, newname->name); ), @@ -1433,7 +1434,7 @@ DECLARE_EVENT_CLASS(nfs4_inode_stateid_event, __entry->dev = inode->i_sb->s_dev; __entry->fileid = NFS_FILEID(inode); __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode)); - __entry->error = error; + __entry->error = error < 0 ? -error : 0; __entry->stateid_seq = be32_to_cpu(stateid->seqid); __entry->stateid_hash = @@ -1489,7 +1490,7 @@ DECLARE_EVENT_CLASS(nfs4_getattr_event, __entry->valid = fattr->valid; __entry->fhandle = nfs_fhandle_hash(fhandle); __entry->fileid = (fattr->valid & NFS_ATTR_FATTR_FILEID) ? fattr->fileid : 0; - __entry->error = error; + __entry->error = error < 0 ? -error : 0; ), TP_printk( @@ -1536,7 +1537,7 @@ DECLARE_EVENT_CLASS(nfs4_inode_callback_event, ), TP_fast_assign( - __entry->error = error; + __entry->error = error < 0 ? -error : 0; __entry->fhandle = nfs_fhandle_hash(fhandle); if (!IS_ERR_OR_NULL(inode)) { __entry->fileid = NFS_FILEID(inode); @@ -1593,7 +1594,7 @@ DECLARE_EVENT_CLASS(nfs4_inode_stateid_callback_event, ), TP_fast_assign( - __entry->error = error; + __entry->error = error < 0 ? -error : 0; __entry->fhandle = nfs_fhandle_hash(fhandle); if (!IS_ERR_OR_NULL(inode)) { __entry->fileid = NFS_FILEID(inode); @@ -1912,7 +1913,7 @@ TRACE_EVENT(nfs4_layoutget, __entry->iomode = args->iomode; __entry->offset = args->offset; __entry->count = args->length; - __entry->error = error; + __entry->error = error < 0 ? -error : 0; __entry->stateid_seq = be32_to_cpu(state->stateid.seqid); __entry->stateid_hash = From patchwork Mon Jan 6 20:25:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 11320033 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 96B8F14DB for ; Mon, 6 Jan 2020 20:27:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 754AF2146E for ; Mon, 6 Jan 2020 20:27:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="t6me65tS" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726713AbgAFU1h (ORCPT ); Mon, 6 Jan 2020 15:27:37 -0500 Received: from mail-yb1-f193.google.com ([209.85.219.193]:39441 "EHLO mail-yb1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726735AbgAFU1g (ORCPT ); Mon, 6 Jan 2020 15:27:36 -0500 Received: by mail-yb1-f193.google.com with SMTP id b12so286048ybg.6 for ; Mon, 06 Jan 2020 12:27:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=XwK2+X71Ax+UMgRwJ/UWo/h1i3e43wnDp+/h+mUQKxk=; b=t6me65tSkZQw+v1jxJW6CaE/AUP2b22EdESpejENumKdwQuPDRxTSzGzNyBfau1RdK op2UvEvlp6l52R6k+CTljhifWvvQh88Fdrz5mVv+xLhvTZkF9PpXypovcOdLgLOAMHxY Bd3uryeggEvcfrCYWDj10u+tWticRkV7gZH1DO/9X4dzn/qATVwtcG+CE9m8/UAdCMfZ 6P/I5FccNw5eASp9uTS9vonKvGrMJTvnJ5K40j8FZBUO2tmOnZkI6bo+F3cFLBg50ZYv XpsK4cSz8OU5lDILEvYhxWqgaYkKUy5OUcPQVBDZtbMJRONRIY3qs4c8QRhw8/qxPotN VzPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=XwK2+X71Ax+UMgRwJ/UWo/h1i3e43wnDp+/h+mUQKxk=; b=QZ7RRNKcJOVanMbty66IV4QwQm9obWtjnDpf5nyiec1/LhDcjYiSSmahOQHo7MVdS0 Qv2F4Y6OQ4SZSlCVCa7k8uFJffp7v1XVEBy4/ImM55P3oHk7+pS03wQZZWjpN5Wjco20 pD0zySBTU+DkHk6wQtLzg6mSBDjSrX8m/djusMbFWVM8yQMKcFiCLgeszIr1VMI73ZVd FG6Vm6vrzB0W/eNm49Xd6zp6bhHkULBSPOJn7upmwtc6R6p0sE02w6pvnpbx6w4iUutj kGifGFtkft2gEqqyAG3sbaJbjWMEPio5yLtEKxs/uq1pyfkHwHcxK+bOPsJhS7ZW2e2C 7eOQ== X-Gm-Message-State: APjAAAXAABq4WfgNIYx4DQg7iuvYctp3doCa2CQuJvpQk373i1gLY+GQ bamHYuLVE4s+470XNH54LA== X-Google-Smtp-Source: APXvYqzPJHFBO7EVT1d3jkyW3ebV9iI3+XIpfwIz7Ryw6NYP+mzkLdvtzwVjM8C04LLQf0G428P1tQ== X-Received: by 2002:a25:6cd6:: with SMTP id h205mr41352448ybc.301.1578342455187; Mon, 06 Jan 2020 12:27:35 -0800 (PST) Received: from localhost.localdomain (c-68-40-189-247.hsd1.mi.comcast.net. [68.40.189.247]) by smtp.gmail.com with ESMTPSA id l200sm28723579ywl.106.2020.01.06.12.27.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jan 2020 12:27:34 -0800 (PST) From: Trond Myklebust X-Google-Original-From: Trond Myklebust To: Anna Schumaker Cc: linux-nfs@vger.kernel.org Subject: [PATCH 08/15] pNFS/flexfiles: Record resend attempts on I/O failure Date: Mon, 6 Jan 2020 15:25:07 -0500 Message-Id: <20200106202514.785483-9-trond.myklebust@hammerspace.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200106202514.785483-8-trond.myklebust@hammerspace.com> References: <20200106202514.785483-1-trond.myklebust@hammerspace.com> <20200106202514.785483-2-trond.myklebust@hammerspace.com> <20200106202514.785483-3-trond.myklebust@hammerspace.com> <20200106202514.785483-4-trond.myklebust@hammerspace.com> <20200106202514.785483-5-trond.myklebust@hammerspace.com> <20200106202514.785483-6-trond.myklebust@hammerspace.com> <20200106202514.785483-7-trond.myklebust@hammerspace.com> <20200106202514.785483-8-trond.myklebust@hammerspace.com> MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org If the attempt to do pNFS fails, then record what action we take to recover (resend, reset to pnfs or reset to mds). Signed-off-by: Trond Myklebust --- fs/nfs/flexfilelayout/flexfilelayout.c | 6 +++--- fs/nfs/nfs4trace.h | 8 +++++++- fs/nfs/pnfs.h | 8 ++++---- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/fs/nfs/flexfilelayout/flexfilelayout.c b/fs/nfs/flexfilelayout/flexfilelayout.c index 5657b7f2611f..3163b78b1d2c 100644 --- a/fs/nfs/flexfilelayout/flexfilelayout.c +++ b/fs/nfs/flexfilelayout/flexfilelayout.c @@ -1321,7 +1321,6 @@ static int ff_layout_read_done_cb(struct rpc_task *task, int new_idx = hdr->pgio_mirror_idx; int err; - trace_nfs4_pnfs_read(hdr, task->tk_status); if (task->tk_status < 0) ff_layout_io_track_ds_error(hdr->lseg, hdr->pgio_mirror_idx, hdr->args.offset, hdr->args.count, @@ -1331,6 +1330,7 @@ static int ff_layout_read_done_cb(struct rpc_task *task, hdr->ds_clp, hdr->lseg, hdr->pgio_mirror_idx); + trace_nfs4_pnfs_read(hdr, err); clear_bit(NFS_IOHDR_RESEND_PNFS, &hdr->flags); clear_bit(NFS_IOHDR_RESEND_MDS, &hdr->flags); switch (err) { @@ -1494,7 +1494,6 @@ static int ff_layout_write_done_cb(struct rpc_task *task, loff_t end_offs = 0; int err; - trace_nfs4_pnfs_write(hdr, task->tk_status); if (task->tk_status < 0) ff_layout_io_track_ds_error(hdr->lseg, hdr->pgio_mirror_idx, hdr->args.offset, hdr->args.count, @@ -1504,6 +1503,7 @@ static int ff_layout_write_done_cb(struct rpc_task *task, hdr->ds_clp, hdr->lseg, hdr->pgio_mirror_idx); + trace_nfs4_pnfs_write(hdr, err); clear_bit(NFS_IOHDR_RESEND_PNFS, &hdr->flags); clear_bit(NFS_IOHDR_RESEND_MDS, &hdr->flags); switch (err) { @@ -1537,7 +1537,6 @@ static int ff_layout_commit_done_cb(struct rpc_task *task, { int err; - trace_nfs4_pnfs_commit_ds(data, task->tk_status); if (task->tk_status < 0) ff_layout_io_track_ds_error(data->lseg, data->ds_commit_index, data->args.offset, data->args.count, @@ -1546,6 +1545,7 @@ static int ff_layout_commit_done_cb(struct rpc_task *task, err = ff_layout_async_handle_error(task, NULL, data->ds_clp, data->lseg, data->ds_commit_index); + trace_nfs4_pnfs_commit_ds(data, err); switch (err) { case -NFS4ERR_RESET_TO_PNFS: pnfs_generic_prepare_to_resend_writes(data); diff --git a/fs/nfs/nfs4trace.h b/fs/nfs/nfs4trace.h index a291877c0c32..a467f49989f2 100644 --- a/fs/nfs/nfs4trace.h +++ b/fs/nfs/nfs4trace.h @@ -155,6 +155,9 @@ TRACE_DEFINE_ENUM(NFS4ERR_WRONG_CRED); TRACE_DEFINE_ENUM(NFS4ERR_WRONG_TYPE); TRACE_DEFINE_ENUM(NFS4ERR_XDEV); +TRACE_DEFINE_ENUM(NFS4ERR_RESET_TO_MDS); +TRACE_DEFINE_ENUM(NFS4ERR_RESET_TO_PNFS); + #define show_nfsv4_errors(error) \ __print_symbolic(error, \ { NFS4_OK, "OK" }, \ @@ -305,7 +308,10 @@ TRACE_DEFINE_ENUM(NFS4ERR_XDEV); { NFS4ERR_WRONGSEC, "WRONGSEC" }, \ { NFS4ERR_WRONG_CRED, "WRONG_CRED" }, \ { NFS4ERR_WRONG_TYPE, "WRONG_TYPE" }, \ - { NFS4ERR_XDEV, "XDEV" }) + { NFS4ERR_XDEV, "XDEV" }, \ + /* ***** Internal to Linux NFS client ***** */ \ + { NFS4ERR_RESET_TO_MDS, "RESET_TO_MDS" }, \ + { NFS4ERR_RESET_TO_PNFS, "RESET_TO_PNFS" }) #define show_open_flags(flags) \ __print_flags(flags, "|", \ diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h index f8a38065c7e4..0fafdadc9c8d 100644 --- a/fs/nfs/pnfs.h +++ b/fs/nfs/pnfs.h @@ -79,6 +79,10 @@ enum pnfs_try_status { PNFS_TRY_AGAIN = 2, }; +/* error codes for internal use */ +#define NFS4ERR_RESET_TO_MDS 12001 +#define NFS4ERR_RESET_TO_PNFS 12002 + #ifdef CONFIG_NFS_V4_1 #define LAYOUT_NFSV4_1_MODULE_PREFIX "nfs-layouttype4" @@ -91,10 +95,6 @@ enum pnfs_try_status { #define NFS4_DEF_DS_RETRANS 5 #define PNFS_DEVICE_RETRY_TIMEOUT (120*HZ) -/* error codes for internal use */ -#define NFS4ERR_RESET_TO_MDS 12001 -#define NFS4ERR_RESET_TO_PNFS 12002 - enum { NFS_LAYOUT_RO_FAILED = 0, /* get ro layout failed stop trying */ NFS_LAYOUT_RW_FAILED, /* get rw layout failed stop trying */ From patchwork Mon Jan 6 20:25:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 11320035 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 F17EC14DB for ; Mon, 6 Jan 2020 20:27:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C684620715 for ; Mon, 6 Jan 2020 20:27:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="aegktrfz" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726751AbgAFU1i (ORCPT ); Mon, 6 Jan 2020 15:27:38 -0500 Received: from mail-yb1-f196.google.com ([209.85.219.196]:35137 "EHLO mail-yb1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726735AbgAFU1h (ORCPT ); Mon, 6 Jan 2020 15:27:37 -0500 Received: by mail-yb1-f196.google.com with SMTP id a124so22628914ybg.2 for ; Mon, 06 Jan 2020 12:27:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wcZPSAaV+lXbnJO92q7MX1Hbs9Frrjeym3R6iqB+2CM=; b=aegktrfzz6S5Ccmwm8mjYyoc9Jy/oulwL22GZW2xvH1G5b2coKD3UdBndYOt41SJZD Kct8XtBmQX2m9j4Uk00SIqF1BchJYbs0YwfwEt04adR7g1ctHBKZpa55VC4N8AvEDHaQ U54ZUaYo68YRTJ7JtxNTFfCnk2GjEwxmj9xDVilmIdoTjKekeCMJM/0xB2YET6wKaZlp UH3ckVDagg56oPnCCjHCrtcFtqD4KJahXy9gDqOIloOo+I90ZfpJmsgSo3i5PBZe0+W2 2B/c9yYwJwYVKcs3u1MD9vtGlP7DL18Pz2P/63u+j12+Y5cP9mSJ5ebAkJ73yGwIn0LH 1b8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wcZPSAaV+lXbnJO92q7MX1Hbs9Frrjeym3R6iqB+2CM=; b=hvgyzgFFSizFekUrtFVBQbROT/f332JDqo0xtXmiJNdYx/CVWS6k2ElXEV9RpWhz9h pEc9okT3TJwT6NNCSMAYByfMp7IVKYHVxpXn2gSJLU+4FZc4Vvhrw/o/JVuH5MZCyL1m 3ElGPc0fsxN6J2dXJ52IidLCOiZAYqnRZPdKdfOPv1NLjS0RKSat+VnFRY3TT6tsyPsJ G/MeXN9HmD6no6jhhEOB88fupCvUQWDhDGejH08Rvt40NBj1Z9InT5FG7mEKsrXqOHuc PXBbsGb+Li7EHoBfDf4b2ABNd37wvbMk5pXVIyI9cid/7S9iLEGurRXbn5r64FqNUS8p rh/w== X-Gm-Message-State: APjAAAXIgDKg4Ryzvn0ckg99cih8RpmTa8X5gsZtDJSMdvCKJvSrmfZW Tb0dhkiKp0JnRmEmBMv54Q== X-Google-Smtp-Source: APXvYqxUMN3NJ2q7WWGqoQTJIMbUNkDa/Dvqx/e3/MluhE/YWYJkF7itTaXyhyQubQnZ9OkZ4wq0lQ== X-Received: by 2002:a25:7ac2:: with SMTP id v185mr44063169ybc.331.1578342456408; Mon, 06 Jan 2020 12:27:36 -0800 (PST) Received: from localhost.localdomain (c-68-40-189-247.hsd1.mi.comcast.net. [68.40.189.247]) by smtp.gmail.com with ESMTPSA id l200sm28723579ywl.106.2020.01.06.12.27.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jan 2020 12:27:36 -0800 (PST) From: Trond Myklebust X-Google-Original-From: Trond Myklebust To: Anna Schumaker Cc: linux-nfs@vger.kernel.org Subject: [PATCH 09/15] NFS: Clean up generic file read tracepoints Date: Mon, 6 Jan 2020 15:25:08 -0500 Message-Id: <20200106202514.785483-10-trond.myklebust@hammerspace.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200106202514.785483-9-trond.myklebust@hammerspace.com> References: <20200106202514.785483-1-trond.myklebust@hammerspace.com> <20200106202514.785483-2-trond.myklebust@hammerspace.com> <20200106202514.785483-3-trond.myklebust@hammerspace.com> <20200106202514.785483-4-trond.myklebust@hammerspace.com> <20200106202514.785483-5-trond.myklebust@hammerspace.com> <20200106202514.785483-6-trond.myklebust@hammerspace.com> <20200106202514.785483-7-trond.myklebust@hammerspace.com> <20200106202514.785483-8-trond.myklebust@hammerspace.com> <20200106202514.785483-9-trond.myklebust@hammerspace.com> MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Clean up the generic file read tracepoints so they do pass the full structures as arguments. Also ensure we report the number of bytes actually read. Signed-off-by: Trond Myklebust --- fs/nfs/nfstrace.h | 56 ++++++++++++++++++++++++++++------------------- fs/nfs/read.c | 5 ++--- 2 files changed, 35 insertions(+), 26 deletions(-) diff --git a/fs/nfs/nfstrace.h b/fs/nfs/nfstrace.h index f64a33d2a1d1..f0e869d21368 100644 --- a/fs/nfs/nfstrace.h +++ b/fs/nfs/nfstrace.h @@ -820,75 +820,85 @@ TRACE_EVENT(nfs_sillyrename_unlink, TRACE_EVENT(nfs_initiate_read, TP_PROTO( - const struct inode *inode, - loff_t offset, unsigned long count + const struct nfs_pgio_header *hdr ), - TP_ARGS(inode, offset, count), + TP_ARGS(hdr), TP_STRUCT__entry( - __field(loff_t, offset) - __field(unsigned long, count) __field(dev_t, dev) __field(u32, fhandle) __field(u64, fileid) + __field(loff_t, offset) + __field(u32, count) ), TP_fast_assign( + const struct inode *inode = hdr->inode; const struct nfs_inode *nfsi = NFS_I(inode); + const struct nfs_fh *fh = hdr->args.fh ? + hdr->args.fh : &nfsi->fh; - __entry->offset = offset; - __entry->count = count; + __entry->offset = hdr->args.offset; + __entry->count = hdr->args.count; __entry->dev = inode->i_sb->s_dev; __entry->fileid = nfsi->fileid; - __entry->fhandle = nfs_fhandle_hash(&nfsi->fh); + __entry->fhandle = nfs_fhandle_hash(fh); ), TP_printk( "fileid=%02x:%02x:%llu fhandle=0x%08x " - "offset=%lld count=%lu", + "offset=%lld count=%u", MAJOR(__entry->dev), MINOR(__entry->dev), (unsigned long long)__entry->fileid, __entry->fhandle, - __entry->offset, __entry->count + (long long)__entry->offset, __entry->count ) ); TRACE_EVENT(nfs_readpage_done, TP_PROTO( - const struct inode *inode, - int status, loff_t offset, bool eof + const struct rpc_task *task, + const struct nfs_pgio_header *hdr ), - TP_ARGS(inode, status, offset, eof), + TP_ARGS(task, hdr), TP_STRUCT__entry( - __field(int, status) - __field(loff_t, offset) - __field(bool, eof) __field(dev_t, dev) __field(u32, fhandle) __field(u64, fileid) + __field(loff_t, offset) + __field(u32, arg_count) + __field(u32, res_count) + __field(bool, eof) + __field(int, status) ), TP_fast_assign( + const struct inode *inode = hdr->inode; const struct nfs_inode *nfsi = NFS_I(inode); - - __entry->status = status; - __entry->offset = offset; - __entry->eof = eof; + const struct nfs_fh *fh = hdr->args.fh ? + hdr->args.fh : &nfsi->fh; + + __entry->status = task->tk_status; + __entry->offset = hdr->args.offset; + __entry->arg_count = hdr->args.count; + __entry->res_count = hdr->res.count; + __entry->eof = hdr->res.eof; __entry->dev = inode->i_sb->s_dev; __entry->fileid = nfsi->fileid; - __entry->fhandle = nfs_fhandle_hash(&nfsi->fh); + __entry->fhandle = nfs_fhandle_hash(fh); ), TP_printk( "fileid=%02x:%02x:%llu fhandle=0x%08x " - "offset=%lld status=%d%s", + "offset=%lld count=%u res=%u status=%d%s", MAJOR(__entry->dev), MINOR(__entry->dev), (unsigned long long)__entry->fileid, __entry->fhandle, - __entry->offset, __entry->status, + (long long)__entry->offset, __entry->arg_count, + __entry->res_count, __entry->status, __entry->eof ? " eof" : "" ) ); diff --git a/fs/nfs/read.c b/fs/nfs/read.c index cfe0b586eadd..12deb3bdb2a0 100644 --- a/fs/nfs/read.c +++ b/fs/nfs/read.c @@ -214,7 +214,7 @@ static void nfs_initiate_read(struct nfs_pgio_header *hdr, task_setup_data->flags |= swap_flags; rpc_ops->read_setup(hdr, msg); - trace_nfs_initiate_read(inode, hdr->io_start, hdr->good_bytes); + trace_nfs_initiate_read(hdr); } static void @@ -247,8 +247,7 @@ static int nfs_readpage_done(struct rpc_task *task, return status; nfs_add_stats(inode, NFSIOS_SERVERREADBYTES, hdr->res.count); - trace_nfs_readpage_done(inode, task->tk_status, - hdr->args.offset, hdr->res.eof); + trace_nfs_readpage_done(task, hdr); if (task->tk_status == -ESTALE) { set_bit(NFS_INO_STALE, &NFS_I(inode)->flags); From patchwork Mon Jan 6 20:25:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 11320037 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 1C96F14DB for ; Mon, 6 Jan 2020 20:27:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E5C3C2146E for ; Mon, 6 Jan 2020 20:27:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="NhjQvWof" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726757AbgAFU1j (ORCPT ); Mon, 6 Jan 2020 15:27:39 -0500 Received: from mail-yb1-f194.google.com ([209.85.219.194]:37765 "EHLO mail-yb1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726735AbgAFU1j (ORCPT ); Mon, 6 Jan 2020 15:27:39 -0500 Received: by mail-yb1-f194.google.com with SMTP id x14so22618955ybr.4 for ; Mon, 06 Jan 2020 12:27:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=GI3T8qAguBQKMH8wg8hmwDj1iiJSqLnO7N2CvBnLEYg=; b=NhjQvWofVh1Fz5lMzdn6H/ZU0X9YXmYGg9XwAokqk7eYXICRSBDHLcw6CNtfV8Cdqr zhM/zDogDKgfgVnJ3kUb5FSsrNDJnJgP37L6uFIKiai4/DKCHokr6UZZq5S5J5DB9inK FPqJmSpqZI62+BxIcI3x1+LpRzctlY7y0fPei8qgHB08weuP6Ywi1TcOm6gK0YAvmDx5 0KCytwNIoXr1X10tNpqxOu+NA3mkT5kqqJgz7Tlk7Mb8N2V/N8/tVGytnJpXQDqnDFfj NJsm6wNRs+Aew2Qy0NEoM0xDBbjzgqBRzXrgHtufIzwvRYrOdCXYUE8paFOGSNuTR88d 118w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=GI3T8qAguBQKMH8wg8hmwDj1iiJSqLnO7N2CvBnLEYg=; b=SNbeAXr3JOnN/lS5vqMJ+ohIT3byKCZPL1mzncdNdXQtNopS/0r5KfUFbThglE+OUW Lwsq5Fipn8aBEX/i7zy6XjIWTO4+eCATUIccdUtesExyIIqJkgw53PJrdf6VG1oVwb4c yOCuYKdwDuuPugn4rMJ/RtmeEgUB5Z9EFNwb/cb6uICe3bLBKdVACp6bNNNVmCDx/sqS sxWbWk9C1BDkYODovgvIYmd3X0h2SCwR50WyboCeA1H93sHm3ZItxztzCcWMpla8Qjpf 8Hx4edw3u9sUCMYcMNb3mniBCjaYops8HlEcPuFZFGtlKXSeBdHtaM2dcJ1Zscf8CgCA a95g== X-Gm-Message-State: APjAAAUHknd2jItEEJ90ZLPQ5OPHGO+JBgYeEnz9Cd2Xb7b/f5mm0vCD dWESOx37Psn9vyEf9xgL7A== X-Google-Smtp-Source: APXvYqzr0Tfp3MM/5GG2jLDDbs1qoPkxEegl9zVDsKLPKjYv1JsoynFLpB9VLgt8y+nD3CQsx0hhKw== X-Received: by 2002:a5b:14b:: with SMTP id c11mr75817849ybp.14.1578342457993; Mon, 06 Jan 2020 12:27:37 -0800 (PST) Received: from localhost.localdomain (c-68-40-189-247.hsd1.mi.comcast.net. [68.40.189.247]) by smtp.gmail.com with ESMTPSA id l200sm28723579ywl.106.2020.01.06.12.27.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jan 2020 12:27:37 -0800 (PST) From: Trond Myklebust X-Google-Original-From: Trond Myklebust To: Anna Schumaker Cc: linux-nfs@vger.kernel.org Subject: [PATCH 10/15] NFS: Clean up generic writeback tracepoints Date: Mon, 6 Jan 2020 15:25:09 -0500 Message-Id: <20200106202514.785483-11-trond.myklebust@hammerspace.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200106202514.785483-10-trond.myklebust@hammerspace.com> References: <20200106202514.785483-1-trond.myklebust@hammerspace.com> <20200106202514.785483-2-trond.myklebust@hammerspace.com> <20200106202514.785483-3-trond.myklebust@hammerspace.com> <20200106202514.785483-4-trond.myklebust@hammerspace.com> <20200106202514.785483-5-trond.myklebust@hammerspace.com> <20200106202514.785483-6-trond.myklebust@hammerspace.com> <20200106202514.785483-7-trond.myklebust@hammerspace.com> <20200106202514.785483-8-trond.myklebust@hammerspace.com> <20200106202514.785483-9-trond.myklebust@hammerspace.com> <20200106202514.785483-10-trond.myklebust@hammerspace.com> MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Clean up the generic writeback tracepoints so they do pass the full structures as arguments. Also ensure we report the number of bytes actually written. Signed-off-by: Trond Myklebust --- fs/nfs/nfstrace.h | 73 ++++++++++++++++++++++++++--------------------- fs/nfs/write.c | 6 ++-- 2 files changed, 43 insertions(+), 36 deletions(-) diff --git a/fs/nfs/nfstrace.h b/fs/nfs/nfstrace.h index f0e869d21368..3d8d36fe7b6f 100644 --- a/fs/nfs/nfstrace.h +++ b/fs/nfs/nfstrace.h @@ -915,87 +915,96 @@ TRACE_DEFINE_ENUM(NFS_FILE_SYNC); TRACE_EVENT(nfs_initiate_write, TP_PROTO( - const struct inode *inode, - loff_t offset, unsigned long count, - enum nfs3_stable_how stable + const struct nfs_pgio_header *hdr ), - TP_ARGS(inode, offset, count, stable), + TP_ARGS(hdr), TP_STRUCT__entry( - __field(loff_t, offset) - __field(unsigned long, count) - __field(enum nfs3_stable_how, stable) __field(dev_t, dev) __field(u32, fhandle) __field(u64, fileid) + __field(loff_t, offset) + __field(u32, count) + __field(enum nfs3_stable_how, stable) ), TP_fast_assign( + const struct inode *inode = hdr->inode; const struct nfs_inode *nfsi = NFS_I(inode); + const struct nfs_fh *fh = hdr->args.fh ? + hdr->args.fh : &nfsi->fh; - __entry->offset = offset; - __entry->count = count; - __entry->stable = stable; + __entry->offset = hdr->args.offset; + __entry->count = hdr->args.count; + __entry->stable = hdr->args.stable; __entry->dev = inode->i_sb->s_dev; __entry->fileid = nfsi->fileid; - __entry->fhandle = nfs_fhandle_hash(&nfsi->fh); + __entry->fhandle = nfs_fhandle_hash(fh); ), TP_printk( "fileid=%02x:%02x:%llu fhandle=0x%08x " - "offset=%lld count=%lu stable=%s", + "offset=%lld count=%u stable=%s", MAJOR(__entry->dev), MINOR(__entry->dev), (unsigned long long)__entry->fileid, __entry->fhandle, - __entry->offset, __entry->count, + (long long)__entry->offset, __entry->count, nfs_show_stable(__entry->stable) ) ); TRACE_EVENT(nfs_writeback_done, TP_PROTO( - const struct inode *inode, - int status, - loff_t offset, - struct nfs_writeverf *writeverf + const struct rpc_task *task, + const struct nfs_pgio_header *hdr ), - TP_ARGS(inode, status, offset, writeverf), + TP_ARGS(task, hdr), TP_STRUCT__entry( - __field(int, status) - __field(loff_t, offset) - __field(enum nfs3_stable_how, stable) - __field(unsigned long long, verifier) __field(dev_t, dev) __field(u32, fhandle) __field(u64, fileid) + __field(loff_t, offset) + __field(u32, arg_count) + __field(u32, res_count) + __field(int, status) + __field(enum nfs3_stable_how, stable) + __array(char, verifier, NFS4_VERIFIER_SIZE) ), TP_fast_assign( + const struct inode *inode = hdr->inode; const struct nfs_inode *nfsi = NFS_I(inode); + const struct nfs_fh *fh = hdr->args.fh ? + hdr->args.fh : &nfsi->fh; + const struct nfs_writeverf *verf = hdr->res.verf; - __entry->status = status; - __entry->offset = offset; - __entry->stable = writeverf->committed; - memcpy(&__entry->verifier, &writeverf->verifier, - sizeof(__entry->verifier)); + __entry->status = task->tk_status; + __entry->offset = hdr->args.offset; + __entry->arg_count = hdr->args.count; + __entry->res_count = hdr->res.count; + __entry->stable = verf->committed; + memcpy(__entry->verifier, + &verf->verifier, + NFS4_VERIFIER_SIZE); __entry->dev = inode->i_sb->s_dev; __entry->fileid = nfsi->fileid; - __entry->fhandle = nfs_fhandle_hash(&nfsi->fh); + __entry->fhandle = nfs_fhandle_hash(fh); ), TP_printk( "fileid=%02x:%02x:%llu fhandle=0x%08x " - "offset=%lld status=%d stable=%s " - "verifier 0x%016llx", + "offset=%lld count=%u res=%u status=%d stable=%s " + "verifier=%s", MAJOR(__entry->dev), MINOR(__entry->dev), (unsigned long long)__entry->fileid, __entry->fhandle, - __entry->offset, __entry->status, + (long long)__entry->offset, __entry->arg_count, + __entry->res_count, __entry->status, nfs_show_stable(__entry->stable), - __entry->verifier + __print_hex_str(__entry->verifier, NFS4_VERIFIER_SIZE) ) ); diff --git a/fs/nfs/write.c b/fs/nfs/write.c index ab3d4611f0aa..d0f62aef3489 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c @@ -1412,8 +1412,7 @@ static void nfs_initiate_write(struct nfs_pgio_header *hdr, task_setup_data->priority = priority; rpc_ops->write_setup(hdr, msg, &task_setup_data->rpc_client); - trace_nfs_initiate_write(hdr->inode, hdr->io_start, hdr->good_bytes, - hdr->args.stable); + trace_nfs_initiate_write(hdr); } /* If a nfs_flush_* function fails, it should remove reqs from @head and @@ -1577,8 +1576,7 @@ static int nfs_writeback_done(struct rpc_task *task, return status; nfs_add_stats(inode, NFSIOS_SERVERWRITTENBYTES, hdr->res.count); - trace_nfs_writeback_done(inode, task->tk_status, - hdr->args.offset, hdr->res.verf); + trace_nfs_writeback_done(task, hdr); if (hdr->res.verf->committed < hdr->args.stable && task->tk_status >= 0) { From patchwork Mon Jan 6 20:25:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 11320039 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 C15B113A0 for ; Mon, 6 Jan 2020 20:27:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A045B2146E for ; Mon, 6 Jan 2020 20:27:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Y5ubT6K5" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726721AbgAFU1l (ORCPT ); Mon, 6 Jan 2020 15:27:41 -0500 Received: from mail-yb1-f195.google.com ([209.85.219.195]:35138 "EHLO mail-yb1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726735AbgAFU1k (ORCPT ); Mon, 6 Jan 2020 15:27:40 -0500 Received: by mail-yb1-f195.google.com with SMTP id a124so22628969ybg.2 for ; Mon, 06 Jan 2020 12:27:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9dDw/+1yN2S9DNI7Ptfgv7hoaMcpBXLTyYaESgUv33U=; b=Y5ubT6K55dX6A0SsrIeVcJsx/zuyTaMCleiXpjfJAtlfSolac1LoZMo0DcKmJVj9Lh vhPelA2tqa+/Fg2W9fXYbjQw6mrnACbCoBh4snNZGav718HZ3RYUjwZDXF8Hf15KdGZQ TBqaLNAeoUOL8/QBPGchlDxh6TENOgFSipf01sDT/suc5u++MwPcmB+J8Q+JWjWXY9Cy RkyJpbMRffSU864gWvbRSzZPeaZZpyX/LfCbiVfFV/7FV4TpId5rwJb3S7jx8dY32cgH jMTV7jeiS3ztNfFWJgdkkiRnhTETA63GXx5j8TJ379PChW+a7s5ZIlWb4lzKgNmuzFMG yt9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9dDw/+1yN2S9DNI7Ptfgv7hoaMcpBXLTyYaESgUv33U=; b=UR0/ze2dEl5VvQ6MHWIQMLSGwGJTrvzZG3DIOXPjYEnsSJWxSVPLiAc6LEn9/tKJoP Ldzr6noKYQz7IfLhQBpT1BCSO2E6FMKNSyml7Y2Gkxsd120s/z9mtLWsSiqc7jf6cQFi jMA0QRzHH5Lr6NqZMbYE7ohSivTNBygFHqvJGG277a6+Lc/BzT4FVhskH+P1scqJ16dz 1ifi/yLcNomFzvhHZMLuKU9WJ/HtHlRQILFLHCOdcyEP1yRrR7mE11y3a9WF+EOd4dTy nvpplVnPTaSWpuYOsGT+0OKIO7IS1f65Txh5yKzhTsucRBEJvUI2ZK1vMVg+cLGVkMGc CiuA== X-Gm-Message-State: APjAAAVeqWFU8ae2jzapJ4wCLDTSluRj12G3BXQUw7oL++4A5MwLtvJu 7aDSSTMgIbwCjcP/AZ4bQw== X-Google-Smtp-Source: APXvYqw9RKlAiAZUF5wSTsS70EA2LdcnYVq7agMbRWPaLskk7UAHni8USzIP5o7QlJxE0Am0ajqhhQ== X-Received: by 2002:a25:424b:: with SMTP id p72mr51294322yba.230.1578342459310; Mon, 06 Jan 2020 12:27:39 -0800 (PST) Received: from localhost.localdomain (c-68-40-189-247.hsd1.mi.comcast.net. [68.40.189.247]) by smtp.gmail.com with ESMTPSA id l200sm28723579ywl.106.2020.01.06.12.27.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jan 2020 12:27:38 -0800 (PST) From: Trond Myklebust X-Google-Original-From: Trond Myklebust To: Anna Schumaker Cc: linux-nfs@vger.kernel.org Subject: [PATCH 11/15] NFS: Clean up generic file commit tracepoint Date: Mon, 6 Jan 2020 15:25:10 -0500 Message-Id: <20200106202514.785483-12-trond.myklebust@hammerspace.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200106202514.785483-11-trond.myklebust@hammerspace.com> References: <20200106202514.785483-1-trond.myklebust@hammerspace.com> <20200106202514.785483-2-trond.myklebust@hammerspace.com> <20200106202514.785483-3-trond.myklebust@hammerspace.com> <20200106202514.785483-4-trond.myklebust@hammerspace.com> <20200106202514.785483-5-trond.myklebust@hammerspace.com> <20200106202514.785483-6-trond.myklebust@hammerspace.com> <20200106202514.785483-7-trond.myklebust@hammerspace.com> <20200106202514.785483-8-trond.myklebust@hammerspace.com> <20200106202514.785483-9-trond.myklebust@hammerspace.com> <20200106202514.785483-10-trond.myklebust@hammerspace.com> <20200106202514.785483-11-trond.myklebust@hammerspace.com> MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Clean up the generic file commit tracepoints to use a 64-bit value for the verifier, and to display the pNFS filehandle, if it exists. Signed-off-by: Trond Myklebust --- fs/nfs/nfstrace.h | 42 ++++++++++++++++++++++++++---------------- fs/nfs/write.c | 2 +- 2 files changed, 27 insertions(+), 17 deletions(-) diff --git a/fs/nfs/nfstrace.h b/fs/nfs/nfstrace.h index 3d8d36fe7b6f..51043f02e86f 100644 --- a/fs/nfs/nfstrace.h +++ b/fs/nfs/nfstrace.h @@ -1016,71 +1016,81 @@ TRACE_EVENT(nfs_initiate_commit, TP_ARGS(data), TP_STRUCT__entry( - __field(loff_t, offset) - __field(unsigned long, count) __field(dev_t, dev) __field(u32, fhandle) __field(u64, fileid) + __field(loff_t, offset) + __field(u32, count) ), TP_fast_assign( const struct inode *inode = data->inode; const struct nfs_inode *nfsi = NFS_I(inode); + const struct nfs_fh *fh = data->args.fh ? + data->args.fh : &nfsi->fh; __entry->offset = data->args.offset; __entry->count = data->args.count; __entry->dev = inode->i_sb->s_dev; __entry->fileid = nfsi->fileid; - __entry->fhandle = nfs_fhandle_hash(&nfsi->fh); + __entry->fhandle = nfs_fhandle_hash(fh); ), TP_printk( "fileid=%02x:%02x:%llu fhandle=0x%08x " - "offset=%lld count=%lu", + "offset=%lld count=%u", MAJOR(__entry->dev), MINOR(__entry->dev), (unsigned long long)__entry->fileid, __entry->fhandle, - __entry->offset, __entry->count + (long long)__entry->offset, __entry->count ) ); TRACE_EVENT(nfs_commit_done, TP_PROTO( + const struct rpc_task *task, const struct nfs_commit_data *data ), - TP_ARGS(data), + TP_ARGS(task, data), TP_STRUCT__entry( - __field(int, status) - __field(loff_t, offset) - __field(unsigned long long, verifier) __field(dev_t, dev) __field(u32, fhandle) __field(u64, fileid) + __field(loff_t, offset) + __field(int, status) + __field(enum nfs3_stable_how, stable) + __array(char, verifier, NFS4_VERIFIER_SIZE) ), TP_fast_assign( const struct inode *inode = data->inode; const struct nfs_inode *nfsi = NFS_I(inode); + const struct nfs_fh *fh = data->args.fh ? + data->args.fh : &nfsi->fh; + const struct nfs_writeverf *verf = data->res.verf; - __entry->status = data->res.op_status; + __entry->status = task->tk_status; __entry->offset = data->args.offset; - memcpy(&__entry->verifier, &data->verf.verifier, - sizeof(__entry->verifier)); + __entry->stable = verf->committed; + memcpy(__entry->verifier, + &verf->verifier, + NFS4_VERIFIER_SIZE); __entry->dev = inode->i_sb->s_dev; __entry->fileid = nfsi->fileid; - __entry->fhandle = nfs_fhandle_hash(&nfsi->fh); + __entry->fhandle = nfs_fhandle_hash(fh); ), TP_printk( "fileid=%02x:%02x:%llu fhandle=0x%08x " - "offset=%lld status=%d verifier 0x%016llx", + "offset=%lld status=%d stable=%s verifier=%s", MAJOR(__entry->dev), MINOR(__entry->dev), (unsigned long long)__entry->fileid, __entry->fhandle, - __entry->offset, __entry->status, - __entry->verifier + (long long)__entry->offset, __entry->status, + nfs_show_stable(__entry->stable), + __print_hex_str(__entry->verifier, NFS4_VERIFIER_SIZE) ) ); diff --git a/fs/nfs/write.c b/fs/nfs/write.c index d0f62aef3489..985ddff46051 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c @@ -1831,7 +1831,7 @@ static void nfs_commit_done(struct rpc_task *task, void *calldata) /* Call the NFS version-specific code */ NFS_PROTO(data->inode)->commit_done(task, data); - trace_nfs_commit_done(data); + trace_nfs_commit_done(task, data); } static void nfs_commit_release_pages(struct nfs_commit_data *data) From patchwork Mon Jan 6 20:25:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 11320041 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 396A314DB for ; Mon, 6 Jan 2020 20:27:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0D4962146E for ; Mon, 6 Jan 2020 20:27:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="P1OUVxKB" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726759AbgAFU1m (ORCPT ); Mon, 6 Jan 2020 15:27:42 -0500 Received: from mail-yb1-f196.google.com ([209.85.219.196]:40558 "EHLO mail-yb1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726735AbgAFU1m (ORCPT ); Mon, 6 Jan 2020 15:27:42 -0500 Received: by mail-yb1-f196.google.com with SMTP id a2so22630901ybr.7 for ; Mon, 06 Jan 2020 12:27:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qhbqhr3KRzyAH7VtiiYgrivI7REdC1kMaQXc64L62Iw=; b=P1OUVxKB+O8KJqrh3//V1akx4JSBcfhdysb8L8gNzHaCnjLg5i5qxUVpYhHrwvVwrv h1WkfemgHOJ9cX/rrnVW9na3zDu9/ZuQAqPZZbqVZvij4z8S8H1wGsBQN7D6wuVSx7bC /mLJIXrMg7nesDxY17ToWYAQmOS9Za4Zg+I1utKp3LRGx6OHu7R4hNCYOC4VPRMXNxmg K0/hLEqm547F3HD+gje06sh7THDK8GfrHNiKf989olYgVIDyZEfWQEyjChz8pPTqkyGw ckQ80qZfSx9gjlT6TLbDmmnN6eJFiuIivu0/v4Xa4oENLcAZKurOkC1Bpq5WgSC7BW+H qTWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qhbqhr3KRzyAH7VtiiYgrivI7REdC1kMaQXc64L62Iw=; b=JpQgTMA8BJJNns09nb6Df54/6vFzkDTs8vl8j6w8bcQPwYLSvYolMgNt1eoqGZl19k KL5gOOavUuQtQBKQoTlbZ9i3AXgojRMTJsJMlx/UeCqAJV2r7+26zVToO9Gw1bB8aXfw hzq+kAHTj8rpxxsp2kViImJIKBrcjMr3+I9nt9xvVfyEYKgx9+xZsp6H2oRaB1j0p0dW RKkHPIvjQI/O8YEQ45+J31VF3W2vvrJX8JaSftHu6XVvuDvHFv6q55TowmF8vbYP2dUr TLucWM9kfxM4ndHC9Aw+BNxApc14e7YXLj6Nb/gLbHZ32sYFz96KBSLDcroXlguYb7uE iaCg== X-Gm-Message-State: APjAAAW8X6Ee3296x3kBoYpsCJUy5Em64caavJsBS0y3NdhOXALWXT8N PvC/YQxead/frJTP66S40lIC4Z1Amw== X-Google-Smtp-Source: APXvYqyKmoPyRdyjm7eMh2kxxf7w76CL8tIg4I/hOD6OJdk+v6cCoOCLYkBF1r/gSA6s3gqxYMs9eg== X-Received: by 2002:a25:447:: with SMTP id 68mr70282290ybe.432.1578342460661; Mon, 06 Jan 2020 12:27:40 -0800 (PST) Received: from localhost.localdomain (c-68-40-189-247.hsd1.mi.comcast.net. [68.40.189.247]) by smtp.gmail.com with ESMTPSA id l200sm28723579ywl.106.2020.01.06.12.27.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jan 2020 12:27:40 -0800 (PST) From: Trond Myklebust X-Google-Original-From: Trond Myklebust To: Anna Schumaker Cc: linux-nfs@vger.kernel.org Subject: [PATCH 12/15] pNFS/flexfiles: Add tracing for layout errors Date: Mon, 6 Jan 2020 15:25:11 -0500 Message-Id: <20200106202514.785483-13-trond.myklebust@hammerspace.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200106202514.785483-12-trond.myklebust@hammerspace.com> References: <20200106202514.785483-1-trond.myklebust@hammerspace.com> <20200106202514.785483-2-trond.myklebust@hammerspace.com> <20200106202514.785483-3-trond.myklebust@hammerspace.com> <20200106202514.785483-4-trond.myklebust@hammerspace.com> <20200106202514.785483-5-trond.myklebust@hammerspace.com> <20200106202514.785483-6-trond.myklebust@hammerspace.com> <20200106202514.785483-7-trond.myklebust@hammerspace.com> <20200106202514.785483-8-trond.myklebust@hammerspace.com> <20200106202514.785483-9-trond.myklebust@hammerspace.com> <20200106202514.785483-10-trond.myklebust@hammerspace.com> <20200106202514.785483-11-trond.myklebust@hammerspace.com> <20200106202514.785483-12-trond.myklebust@hammerspace.com> MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Trace layout errors for pNFS/flexfiles on read/write/commit operations. Signed-off-by: Trond Myklebust --- fs/nfs/flexfilelayout/flexfilelayout.c | 28 +++++-- fs/nfs/nfs4trace.c | 4 + fs/nfs/nfs4trace.h | 109 +++++++++++++++++++++++++ 3 files changed, 132 insertions(+), 9 deletions(-) diff --git a/fs/nfs/flexfilelayout/flexfilelayout.c b/fs/nfs/flexfilelayout/flexfilelayout.c index 3163b78b1d2c..bb9148b83166 100644 --- a/fs/nfs/flexfilelayout/flexfilelayout.c +++ b/fs/nfs/flexfilelayout/flexfilelayout.c @@ -1266,9 +1266,10 @@ static int ff_layout_async_handle_error(struct rpc_task *task, static void ff_layout_io_track_ds_error(struct pnfs_layout_segment *lseg, int idx, u64 offset, u64 length, - u32 status, int opnum, int error) + u32 *op_status, int opnum, int error) { struct nfs4_ff_layout_mirror *mirror; + u32 status = *op_status; int err; if (status == 0) { @@ -1286,10 +1287,10 @@ static void ff_layout_io_track_ds_error(struct pnfs_layout_segment *lseg, case -ENOBUFS: case -EPIPE: case -EPERM: - status = NFS4ERR_NXIO; + *op_status = status = NFS4ERR_NXIO; break; case -EACCES: - status = NFS4ERR_ACCESS; + *op_status = status = NFS4ERR_ACCESS; break; default: return; @@ -1321,11 +1322,14 @@ static int ff_layout_read_done_cb(struct rpc_task *task, int new_idx = hdr->pgio_mirror_idx; int err; - if (task->tk_status < 0) + if (task->tk_status < 0) { ff_layout_io_track_ds_error(hdr->lseg, hdr->pgio_mirror_idx, hdr->args.offset, hdr->args.count, - hdr->res.op_status, OP_READ, + &hdr->res.op_status, OP_READ, task->tk_status); + trace_ff_layout_read_error(hdr); + } + err = ff_layout_async_handle_error(task, hdr->args.context->state, hdr->ds_clp, hdr->lseg, hdr->pgio_mirror_idx); @@ -1494,11 +1498,14 @@ static int ff_layout_write_done_cb(struct rpc_task *task, loff_t end_offs = 0; int err; - if (task->tk_status < 0) + if (task->tk_status < 0) { ff_layout_io_track_ds_error(hdr->lseg, hdr->pgio_mirror_idx, hdr->args.offset, hdr->args.count, - hdr->res.op_status, OP_WRITE, + &hdr->res.op_status, OP_WRITE, task->tk_status); + trace_ff_layout_write_error(hdr); + } + err = ff_layout_async_handle_error(task, hdr->args.context->state, hdr->ds_clp, hdr->lseg, hdr->pgio_mirror_idx); @@ -1537,11 +1544,14 @@ static int ff_layout_commit_done_cb(struct rpc_task *task, { int err; - if (task->tk_status < 0) + if (task->tk_status < 0) { ff_layout_io_track_ds_error(data->lseg, data->ds_commit_index, data->args.offset, data->args.count, - data->res.op_status, OP_COMMIT, + &data->res.op_status, OP_COMMIT, task->tk_status); + trace_ff_layout_commit_error(data); + } + err = ff_layout_async_handle_error(task, NULL, data->ds_clp, data->lseg, data->ds_commit_index); diff --git a/fs/nfs/nfs4trace.c b/fs/nfs/nfs4trace.c index 1a8f376b3f73..d9ac556bebcf 100644 --- a/fs/nfs/nfs4trace.c +++ b/fs/nfs/nfs4trace.c @@ -24,4 +24,8 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(pnfs_mds_fallback_read_done); EXPORT_TRACEPOINT_SYMBOL_GPL(pnfs_mds_fallback_write_done); EXPORT_TRACEPOINT_SYMBOL_GPL(pnfs_mds_fallback_read_pagelist); EXPORT_TRACEPOINT_SYMBOL_GPL(pnfs_mds_fallback_write_pagelist); + +EXPORT_TRACEPOINT_SYMBOL_GPL(ff_layout_read_error); +EXPORT_TRACEPOINT_SYMBOL_GPL(ff_layout_write_error); +EXPORT_TRACEPOINT_SYMBOL_GPL(ff_layout_commit_error); #endif diff --git a/fs/nfs/nfs4trace.h b/fs/nfs/nfs4trace.h index a467f49989f2..d39897daa284 100644 --- a/fs/nfs/nfs4trace.h +++ b/fs/nfs/nfs4trace.h @@ -2117,6 +2117,115 @@ DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_write_done); DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_read_pagelist); DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_write_pagelist); +DECLARE_EVENT_CLASS(nfs4_flexfiles_io_event, + TP_PROTO( + const struct nfs_pgio_header *hdr + ), + + TP_ARGS(hdr), + + TP_STRUCT__entry( + __field(unsigned long, error) + __field(dev_t, dev) + __field(u32, fhandle) + __field(u64, fileid) + __field(loff_t, offset) + __field(u32, count) + __field(int, stateid_seq) + __field(u32, stateid_hash) + __string(dstaddr, hdr->ds_clp ? + rpc_peeraddr2str(hdr->ds_clp->cl_rpcclient, + RPC_DISPLAY_ADDR) : "unknown") + ), + + TP_fast_assign( + const struct inode *inode = hdr->inode; + + __entry->error = hdr->res.op_status; + __entry->fhandle = nfs_fhandle_hash(hdr->args.fh); + __entry->fileid = NFS_FILEID(inode); + __entry->dev = inode->i_sb->s_dev; + __entry->offset = hdr->args.offset; + __entry->count = hdr->args.count; + __entry->stateid_seq = + be32_to_cpu(hdr->args.stateid.seqid); + __entry->stateid_hash = + nfs_stateid_hash(&hdr->args.stateid); + __assign_str(dstaddr, hdr->ds_clp ? + rpc_peeraddr2str(hdr->ds_clp->cl_rpcclient, + RPC_DISPLAY_ADDR) : "unknown"); + ), + + TP_printk( + "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " + "offset=%llu count=%u stateid=%d:0x%08x dstaddr=%s", + -__entry->error, + show_nfsv4_errors(__entry->error), + MAJOR(__entry->dev), MINOR(__entry->dev), + (unsigned long long)__entry->fileid, + __entry->fhandle, + __entry->offset, __entry->count, + __entry->stateid_seq, __entry->stateid_hash, + __get_str(dstaddr) + ) +); + +#define DEFINE_NFS4_FLEXFILES_IO_EVENT(name) \ + DEFINE_EVENT(nfs4_flexfiles_io_event, name, \ + TP_PROTO( \ + const struct nfs_pgio_header *hdr \ + ), \ + TP_ARGS(hdr)) +DEFINE_NFS4_FLEXFILES_IO_EVENT(ff_layout_read_error); +DEFINE_NFS4_FLEXFILES_IO_EVENT(ff_layout_write_error); + +TRACE_EVENT(ff_layout_commit_error, + TP_PROTO( + const struct nfs_commit_data *data + ), + + TP_ARGS(data), + + TP_STRUCT__entry( + __field(unsigned long, error) + __field(dev_t, dev) + __field(u32, fhandle) + __field(u64, fileid) + __field(loff_t, offset) + __field(u32, count) + __string(dstaddr, data->ds_clp ? + rpc_peeraddr2str(data->ds_clp->cl_rpcclient, + RPC_DISPLAY_ADDR) : "unknown") + ), + + TP_fast_assign( + const struct inode *inode = data->inode; + + __entry->error = data->res.op_status; + __entry->fhandle = nfs_fhandle_hash(data->args.fh); + __entry->fileid = NFS_FILEID(inode); + __entry->dev = inode->i_sb->s_dev; + __entry->offset = data->args.offset; + __entry->count = data->args.count; + __assign_str(dstaddr, data->ds_clp ? + rpc_peeraddr2str(data->ds_clp->cl_rpcclient, + RPC_DISPLAY_ADDR) : "unknown"); + ), + + TP_printk( + "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " + "offset=%llu count=%u dstaddr=%s", + -__entry->error, + show_nfsv4_errors(__entry->error), + MAJOR(__entry->dev), MINOR(__entry->dev), + (unsigned long long)__entry->fileid, + __entry->fhandle, + __entry->offset, __entry->count, + __get_str(dstaddr) + ) +); + + #endif /* CONFIG_NFS_V4_1 */ #endif /* _TRACE_NFS4_H */ From patchwork Mon Jan 6 20:25:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 11320043 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 96A2314DB for ; Mon, 6 Jan 2020 20:27:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 72DAB2146E for ; Mon, 6 Jan 2020 20:27:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="gdYS+JL1" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726760AbgAFU1n (ORCPT ); Mon, 6 Jan 2020 15:27:43 -0500 Received: from mail-yb1-f194.google.com ([209.85.219.194]:39450 "EHLO mail-yb1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726735AbgAFU1n (ORCPT ); Mon, 6 Jan 2020 15:27:43 -0500 Received: by mail-yb1-f194.google.com with SMTP id b12so286231ybg.6 for ; Mon, 06 Jan 2020 12:27:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=w/hIVE15LYVNdry3NEjE4WnBoq/bUjrBpu/8rkj/OzA=; b=gdYS+JL1FFSNq+ovAt0B/Wjfl1Flf4TtUntljbQ2KuRR8/p9o0zJ8FiYhTNDgSSCFN xoawP9fIMClWH4EDF1F2TPmQXKW9bf/fpmhWQ7DXFjtQEVs+5UPq2DOtqg/6wSYfYlcZ rRisf4mrLvKcLsY4iBLKM4cGGKCFyjVPz/kmWBg52qy6kO/wJPARAwbIaPwCa0nvC1u8 2bfEiGVjdklKyS33YzwLslCVHoN8wmwI7gAcBch+vxZ+lJdTNjKP54Kg2i1j/xBSezkg EnVH8T1k8NGFiFN4CEpyda4zvRShtyHPvQSdm2g1F9rKexuNPVYCvZqn+K1+xs0TkgJg 3xqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=w/hIVE15LYVNdry3NEjE4WnBoq/bUjrBpu/8rkj/OzA=; b=knZdQ1QjBWYyjqNrU9H8awq94ZYGwgifDistCOTh/bJI3y4jXBodTbAUTVl2eVmkBU KX7Mj9tyft4AyFGHrQIl42DMJKWRjbqxXh9nE0xMlD6Ed+L6cOENKkgVedjzV/3UkiNG A7jKzhlJ8Nip3Psnb5Wiz3uGbXhPbPfyhjcgoYeQ4Xy1eRgG0Q8VpP/3+dyen2x/pq8k Zyb0ruyQowJmsHaPrq3OiIipxsD6h5bbFZZuo+x/eEKlm2f9QpqaxMavgCNV+F6+biL3 wvw4U7nFgnyZhwD0JBZhTbAbKpMfXnxjkNPH0uXS6yRmPCPiOaCaSRVYr0RuK2QjBsBK 0PoA== X-Gm-Message-State: APjAAAVbZ8OqvVEL8kaVUAC1Fge/NEkUapdL8L1H9eY9shJ63aJVLCQ2 IqiD8EIC4S2DwwkMFqs5IkEoPUnv6g== X-Google-Smtp-Source: APXvYqzeCF7wCAQ3OPCCNWJP6+SZnqOXuuYXz0zRrkZmK3CwxGMnzLcm6n9iTSngtr1ke+lkVyN9BA== X-Received: by 2002:a25:d03:: with SMTP id 3mr23848685ybn.368.1578342462151; Mon, 06 Jan 2020 12:27:42 -0800 (PST) Received: from localhost.localdomain (c-68-40-189-247.hsd1.mi.comcast.net. [68.40.189.247]) by smtp.gmail.com with ESMTPSA id l200sm28723579ywl.106.2020.01.06.12.27.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jan 2020 12:27:41 -0800 (PST) From: Trond Myklebust X-Google-Original-From: Trond Myklebust To: Anna Schumaker Cc: linux-nfs@vger.kernel.org Subject: [PATCH 13/15] NFS: Improve tracing of permission calls Date: Mon, 6 Jan 2020 15:25:12 -0500 Message-Id: <20200106202514.785483-14-trond.myklebust@hammerspace.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200106202514.785483-13-trond.myklebust@hammerspace.com> References: <20200106202514.785483-1-trond.myklebust@hammerspace.com> <20200106202514.785483-2-trond.myklebust@hammerspace.com> <20200106202514.785483-3-trond.myklebust@hammerspace.com> <20200106202514.785483-4-trond.myklebust@hammerspace.com> <20200106202514.785483-5-trond.myklebust@hammerspace.com> <20200106202514.785483-6-trond.myklebust@hammerspace.com> <20200106202514.785483-7-trond.myklebust@hammerspace.com> <20200106202514.785483-8-trond.myklebust@hammerspace.com> <20200106202514.785483-9-trond.myklebust@hammerspace.com> <20200106202514.785483-10-trond.myklebust@hammerspace.com> <20200106202514.785483-11-trond.myklebust@hammerspace.com> <20200106202514.785483-12-trond.myklebust@hammerspace.com> <20200106202514.785483-13-trond.myklebust@hammerspace.com> MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On exit from nfs_do_access(), record the mask representing the requested permissions, as well as the server-supplied set of access rights for this user. Signed-off-by: Trond Myklebust --- fs/nfs/dir.c | 4 ++-- fs/nfs/nfstrace.h | 61 ++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 62 insertions(+), 3 deletions(-) diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index e180033e35cf..372c16b3042c 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c @@ -2476,7 +2476,7 @@ static int nfs_do_access(struct inode *inode, const struct cred *cred, int mask) { struct nfs_access_entry cache; bool may_block = (mask & MAY_NOT_BLOCK) == 0; - int cache_mask; + int cache_mask = -1; int status; trace_nfs_access_enter(inode); @@ -2515,7 +2515,7 @@ static int nfs_do_access(struct inode *inode, const struct cred *cred, int mask) if ((mask & ~cache_mask & (MAY_READ | MAY_WRITE | MAY_EXEC)) != 0) status = -EACCES; out: - trace_nfs_access_exit(inode, status); + trace_nfs_access_exit(inode, mask, cache_mask, status); return status; } diff --git a/fs/nfs/nfstrace.h b/fs/nfs/nfstrace.h index 51043f02e86f..b43f1b2501db 100644 --- a/fs/nfs/nfstrace.h +++ b/fs/nfs/nfstrace.h @@ -198,7 +198,66 @@ DEFINE_NFS_INODE_EVENT_DONE(nfs_writeback_inode_exit); DEFINE_NFS_INODE_EVENT(nfs_fsync_enter); DEFINE_NFS_INODE_EVENT_DONE(nfs_fsync_exit); DEFINE_NFS_INODE_EVENT(nfs_access_enter); -DEFINE_NFS_INODE_EVENT_DONE(nfs_access_exit); + +TRACE_EVENT(nfs_access_exit, + TP_PROTO( + const struct inode *inode, + unsigned int mask, + unsigned int permitted, + int error + ), + + TP_ARGS(inode, mask, permitted, error), + + TP_STRUCT__entry( + __field(unsigned long, error) + __field(dev_t, dev) + __field(u32, fhandle) + __field(unsigned char, type) + __field(u64, fileid) + __field(u64, version) + __field(loff_t, size) + __field(unsigned long, nfsi_flags) + __field(unsigned long, cache_validity) + __field(unsigned int, mask) + __field(unsigned int, permitted) + ), + + TP_fast_assign( + const struct nfs_inode *nfsi = NFS_I(inode); + __entry->error = error < 0 ? -error : 0; + __entry->dev = inode->i_sb->s_dev; + __entry->fileid = nfsi->fileid; + __entry->fhandle = nfs_fhandle_hash(&nfsi->fh); + __entry->type = nfs_umode_to_dtype(inode->i_mode); + __entry->version = inode_peek_iversion_raw(inode); + __entry->size = i_size_read(inode); + __entry->nfsi_flags = nfsi->flags; + __entry->cache_validity = nfsi->cache_validity; + __entry->mask = mask; + __entry->permitted = permitted; + ), + + TP_printk( + "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " + "type=%u (%s) version=%llu size=%lld " + "cache_validity=0x%lx (%s) nfs_flags=0x%lx (%s) " + "mask=0x%x permitted=0x%x", + -__entry->error, nfs_show_status(__entry->error), + MAJOR(__entry->dev), MINOR(__entry->dev), + (unsigned long long)__entry->fileid, + __entry->fhandle, + __entry->type, + nfs_show_file_type(__entry->type), + (unsigned long long)__entry->version, + (long long)__entry->size, + __entry->cache_validity, + nfs_show_cache_validity(__entry->cache_validity), + __entry->nfsi_flags, + nfs_show_nfsi_flags(__entry->nfsi_flags), + __entry->mask, __entry->permitted + ) +); TRACE_DEFINE_ENUM(LOOKUP_FOLLOW); TRACE_DEFINE_ENUM(LOOKUP_DIRECTORY); From patchwork Mon Jan 6 20:25:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 11320045 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 B41B813A0 for ; Mon, 6 Jan 2020 20:27:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 92AF42146E for ; Mon, 6 Jan 2020 20:27:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Y0EZdxAk" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726767AbgAFU1p (ORCPT ); Mon, 6 Jan 2020 15:27:45 -0500 Received: from mail-yb1-f195.google.com ([209.85.219.195]:46456 "EHLO mail-yb1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726735AbgAFU1o (ORCPT ); Mon, 6 Jan 2020 15:27:44 -0500 Received: by mail-yb1-f195.google.com with SMTP id k128so11631195ybc.13 for ; Mon, 06 Jan 2020 12:27:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LCS3ND5K0LSGjGrE+PmH6QLpz2D5+xDXwsHW2kduECw=; b=Y0EZdxAko6SewWSg+iqvf3INxGDYr/NnX5DtpVVMC04IhNwiWysiIHS43ihcDKD9Au ILTq8fXd/yiumNhyIpyzMNOu9DyS+zTIgEHfjeT6Rf6KmoCZ5bLZvK+eUsbc8hOHP9Vu IfYdQAiQVe/F5/Pg5GLyPqGahfPa1IElBUyHo6BxLfziqtOfbydf69oE/KVCNJAeNhNl 9TbTTWQazbGn1B68lzAo7R7efJJgU6amVWzcVYcr8dFodKSu7s+mAz7aJPW7pUAFuibn WVxgt5IH//iZACTr3V9UAOFK3Hi6ZdNEhbKZRQgj73mlXAMWAyKELQUxLESxyAnXaW3w CZDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=LCS3ND5K0LSGjGrE+PmH6QLpz2D5+xDXwsHW2kduECw=; b=rovrrR1FIU1WBCVpzU5Op9vete1p9+4KwVrS8wMz6Vc3y55unHZh34UkUi96m+6bEX XdOee7GiR2py95/bM9BVSfTeKy5MkTh0MuMi7WLwaZeNVylQ/+U+MdaHRouTzsULDiR6 H67sLVS6qZonbp1bwjA2MbMPXaUvZmZpKqZXF54pOOm9IhMrWX048vb3nFuIFuio4jQ0 afRY1LVbEwwKo872/1lBxQvOKCz/0N2QF+3sHqbws8Q2S/8d+Xmgng82UgSzcd2PmZDH 3wGEigfumq09Jr//NYhpWWwRft+LkWaKZyaNphvQWRKSO57/3tZgiWiXeYIuwmpDVzxi o2TA== X-Gm-Message-State: APjAAAWpK5S9O4LdPEiA8Pu2Pr+VJpWcNOHIOpCA9sZAqOnXD0sQkdK3 5yoL0zH2lO3S21YRui6Mj+oIl/bPaQ== X-Google-Smtp-Source: APXvYqyQuffDkcmfqj5BObfvxe3qfo+Ig0QbFhrslt+4ZzmyOnI5FK8G9YMRT8XOtLuWWuKcKd25zg== X-Received: by 2002:a5b:409:: with SMTP id m9mr25179991ybp.423.1578342463570; Mon, 06 Jan 2020 12:27:43 -0800 (PST) Received: from localhost.localdomain (c-68-40-189-247.hsd1.mi.comcast.net. [68.40.189.247]) by smtp.gmail.com with ESMTPSA id l200sm28723579ywl.106.2020.01.06.12.27.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jan 2020 12:27:43 -0800 (PST) From: Trond Myklebust X-Google-Original-From: Trond Myklebust To: Anna Schumaker Cc: linux-nfs@vger.kernel.org Subject: [PATCH 14/15] NFS: When resending after a short write, reset the reply count to zero Date: Mon, 6 Jan 2020 15:25:13 -0500 Message-Id: <20200106202514.785483-15-trond.myklebust@hammerspace.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200106202514.785483-14-trond.myklebust@hammerspace.com> References: <20200106202514.785483-1-trond.myklebust@hammerspace.com> <20200106202514.785483-2-trond.myklebust@hammerspace.com> <20200106202514.785483-3-trond.myklebust@hammerspace.com> <20200106202514.785483-4-trond.myklebust@hammerspace.com> <20200106202514.785483-5-trond.myklebust@hammerspace.com> <20200106202514.785483-6-trond.myklebust@hammerspace.com> <20200106202514.785483-7-trond.myklebust@hammerspace.com> <20200106202514.785483-8-trond.myklebust@hammerspace.com> <20200106202514.785483-9-trond.myklebust@hammerspace.com> <20200106202514.785483-10-trond.myklebust@hammerspace.com> <20200106202514.785483-11-trond.myklebust@hammerspace.com> <20200106202514.785483-12-trond.myklebust@hammerspace.com> <20200106202514.785483-13-trond.myklebust@hammerspace.com> <20200106202514.785483-14-trond.myklebust@hammerspace.com> MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org If we're resending a write due to a short read or write, ensure we reset the reply count to zero. Signed-off-by: Trond Myklebust --- fs/nfs/read.c | 2 ++ fs/nfs/write.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/fs/nfs/read.c b/fs/nfs/read.c index 12deb3bdb2a0..34bb9add2302 100644 --- a/fs/nfs/read.c +++ b/fs/nfs/read.c @@ -281,6 +281,8 @@ static void nfs_readpage_retry(struct rpc_task *task, argp->offset += resp->count; argp->pgbase += resp->count; argp->count -= resp->count; + resp->count = 0; + resp->eof = 0; rpc_restart_call_prepare(task); } diff --git a/fs/nfs/write.c b/fs/nfs/write.c index 985ddff46051..2c2020546e24 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c @@ -1656,6 +1656,8 @@ static void nfs_writeback_result(struct rpc_task *task, */ argp->stable = NFS_FILE_SYNC; } + resp->count = 0; + resp->verf->committed = 0; rpc_restart_call_prepare(task); } } From patchwork Mon Jan 6 20:25:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 11320047 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 389EF13A0 for ; Mon, 6 Jan 2020 20:27:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 17AEC2146E for ; Mon, 6 Jan 2020 20:27:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Y4O/7kyn" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726781AbgAFU1q (ORCPT ); Mon, 6 Jan 2020 15:27:46 -0500 Received: from mail-yb1-f195.google.com ([209.85.219.195]:36343 "EHLO mail-yb1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726735AbgAFU1q (ORCPT ); Mon, 6 Jan 2020 15:27:46 -0500 Received: by mail-yb1-f195.google.com with SMTP id w126so20729422yba.3 for ; Mon, 06 Jan 2020 12:27:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Q3RZF081h0n2EOEc31Pc7IloAelAP8r+igP5Mlubtyk=; b=Y4O/7kynJ063IwPSbStbiygP6oEh7CgCjbWr3yWYwFKuxj3Sn1idlYPKWSbthgJgcV UIV74+uSGJe/tVqZdKalEZodcd4X/sNu1WVWSnKsSihbWXIhOegbGuC8b9yIj2Nv63B1 RzJfOIzHHaLf55QSgyf3PSgjGRdPq5jFmiYLbImLt64lNUStAmzr9RgyG1HgXZGMiCT+ HCsEORW3NEoLWgxzMqQo40Fga6zOETk9U79WGT1hKR8/AmQolb01h3yP3y6GRyL3/6RO XHVR+LkbpfAVbtwFoR8YLTAXzMkg7LuMLmoH+wBacFUh9Vqhpy5ftFMVy2chyRl0u0qy OQ1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Q3RZF081h0n2EOEc31Pc7IloAelAP8r+igP5Mlubtyk=; b=GpaLqUTX/5wGWzJUBz0s7YbjVBm3QQop3gxruToMcXws++FH4yTr6BetmxRAnO5R1X SKViY+7teSqzlG49gmwin2nVEqVe+qt6kUnUVINqln/BcPrr6VXJuyd75ulDoxO3Wf0d 0qM2KOEfTX8dDD5Q2Stx2XIqKknTcEVcsZtca7E6zBoavRMb4b14KDDGzKgSpzEloAoN sbvZrbja/GwoijJ799OiZIjJOjBBNCBGElfdrpcVTzW6m2OmHnua0VTtFTdTNbFNpOPB NcvMD4fXuILt4YkCqW+gD1fZ2LSeAfuV5Cr2WFIV+qjDOA3UHAvaCPIRoi+em4UrDrbv kiLw== X-Gm-Message-State: APjAAAXfIJVFnBX4BoY6xSnd6AQIR7gs3io8WDgnJO+Fj5gElFDpYgVi hEOtAMuFR3oM97CzlfmzgA== X-Google-Smtp-Source: APXvYqziXtPi/zqJTg2fwzwiQAzPT6tO6hW3aVN5mqO1XMXAhpgJ12gnzuNLT6nhUC54eXJOw0bkRA== X-Received: by 2002:a25:7ac2:: with SMTP id v185mr44063564ybc.331.1578342465028; Mon, 06 Jan 2020 12:27:45 -0800 (PST) Received: from localhost.localdomain (c-68-40-189-247.hsd1.mi.comcast.net. [68.40.189.247]) by smtp.gmail.com with ESMTPSA id l200sm28723579ywl.106.2020.01.06.12.27.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jan 2020 12:27:44 -0800 (PST) From: Trond Myklebust X-Google-Original-From: Trond Myklebust To: Anna Schumaker Cc: linux-nfs@vger.kernel.org Subject: [PATCH 15/15] NFS: Fix nfs_direct_write_reschedule_io() Date: Mon, 6 Jan 2020 15:25:14 -0500 Message-Id: <20200106202514.785483-16-trond.myklebust@hammerspace.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200106202514.785483-15-trond.myklebust@hammerspace.com> References: <20200106202514.785483-1-trond.myklebust@hammerspace.com> <20200106202514.785483-2-trond.myklebust@hammerspace.com> <20200106202514.785483-3-trond.myklebust@hammerspace.com> <20200106202514.785483-4-trond.myklebust@hammerspace.com> <20200106202514.785483-5-trond.myklebust@hammerspace.com> <20200106202514.785483-6-trond.myklebust@hammerspace.com> <20200106202514.785483-7-trond.myklebust@hammerspace.com> <20200106202514.785483-8-trond.myklebust@hammerspace.com> <20200106202514.785483-9-trond.myklebust@hammerspace.com> <20200106202514.785483-10-trond.myklebust@hammerspace.com> <20200106202514.785483-11-trond.myklebust@hammerspace.com> <20200106202514.785483-12-trond.myklebust@hammerspace.com> <20200106202514.785483-13-trond.myklebust@hammerspace.com> <20200106202514.785483-14-trond.myklebust@hammerspace.com> <20200106202514.785483-15-trond.myklebust@hammerspace.com> MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org The 'hdr->good_bytes' is defined as the number of bytes we expect to read or write starting at offset hdr->io_start. In the case of a partial read/write we may end up adjusting hdr->args.offset and hdr->args.count to skip I/O for data that was already read/written, and so we must ensure the calculation takes that into account. Signed-off-by: Trond Myklebust --- fs/nfs/direct.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c index 29f00da8a0b7..b768a0b42e82 100644 --- a/fs/nfs/direct.c +++ b/fs/nfs/direct.c @@ -824,7 +824,8 @@ static void nfs_direct_write_reschedule_io(struct nfs_pgio_header *hdr) dreq->flags = NFS_ODIRECT_RESCHED_WRITES; /* fake unstable write to let common nfs resend pages */ hdr->verf.committed = NFS_UNSTABLE; - hdr->good_bytes = hdr->args.count; + hdr->good_bytes = hdr->args.offset + hdr->args.count - + hdr->io_start; } spin_unlock(&dreq->lock); }