From patchwork Sat Apr 9 20:01:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 12808038 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B2446C433EF for ; Sat, 9 Apr 2022 20:07:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230284AbiDIUJn (ORCPT ); Sat, 9 Apr 2022 16:09:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230102AbiDIUJn (ORCPT ); Sat, 9 Apr 2022 16:09:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 884B7154499 for ; Sat, 9 Apr 2022 13:07:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2318D60C35 for ; Sat, 9 Apr 2022 20:07:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2FDF5C385A0; Sat, 9 Apr 2022 20:07:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1649534853; bh=XDyu0lsurJEAhJLJoQZYLGFV2g+T+Pe+yv9mizVz8CE=; h=From:To:Cc:Subject:Date:From; b=cAzYzd381HzbY6BWVzNtISKpawAHG90kHUx3iGBREFq1Lg8MlV2el/8l2Xqu0Oz6F rmSCoHPl4N/4LDO8Sa//mKDI3ab4nY9Xs2f13cHSyOmxfHWXHxNAxy48ICV450HNdf Tz50LMb5QPGpLR4hPsfThJa64SshuKgw5AXemMhcSuwGuqhpwQvLtf622xTGAVS4Dg xKgplaRFE7Q0I65xj8lFLOZEGZnb22rAQm0ejWRUdgi5/cZ5M/RxtjE/mOtNaxR6CT OMzwAez5aFaPQouujGA6tQNcEiCYZyTSK1QUpuKQTfNGCS00XJm5G9PFo036z3VTzy iushapIT4jMZA== From: trondmy@kernel.org To: linux-nfs@vger.kernel.org Cc: ChenXiaoSong , Scott Mayhew Subject: [PATCH 1/2] NFS: Do not report EINTR/ERESTARTSYS as mapping errors Date: Sat, 9 Apr 2022 16:01:07 -0400 Message-Id: <20220409200108.94208-1-trondmy@kernel.org> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Trond Myklebust If the attempt to flush data was interrupted due to a local signal, then just requeue the writes back for I/O. Fixes: 6fbda89b257f ("NFS: Replace custom error reporting mechanism with generic one") Signed-off-by: Trond Myklebust --- fs/nfs/write.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/nfs/write.c b/fs/nfs/write.c index e864ac836237..9d3ac6edc901 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c @@ -1436,7 +1436,7 @@ static void nfs_async_write_error(struct list_head *head, int error) while (!list_empty(head)) { req = nfs_list_entry(head->next); nfs_list_remove_request(req); - if (nfs_error_is_fatal(error)) + if (nfs_error_is_fatal_on_server(error)) nfs_write_error(req, error); else nfs_redirty_request(req); From patchwork Sat Apr 9 20:01:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 12808039 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EB161C433F5 for ; Sat, 9 Apr 2022 20:07:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230102AbiDIUJo (ORCPT ); Sat, 9 Apr 2022 16:09:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230215AbiDIUJn (ORCPT ); Sat, 9 Apr 2022 16:09:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C1B61557EE for ; Sat, 9 Apr 2022 13:07:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AEA0360AF0 for ; Sat, 9 Apr 2022 20:07:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B884BC385A6; Sat, 9 Apr 2022 20:07:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1649534854; bh=8s36uDwAQ6drbCdhPcH2bpOPAXfnPHdl8tI9JW7lbvs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZWaH8MKzBoPCVStXuVC/zwCgXkC1Ti+5gAFzVqDTF0jhU285MfBNmgxQjZ4tWpzwy /YAOz+QyGPK/TYGacxe9rMIU45nkcaxys3EVz7d8c1sFMSuLdt8fKqvDx142Ys+TNS yTQiIsZ4ioOJh88JGigHnT6z5yyrqPg7CiX4LMtrGIDMUFuJfaEoO54Zgf4EkjZThj rHZJqyUM6HPiZcwUTHKDeKWuKddeJOwB+O8GHMl+tONakCGOQX2fH8mFweuAUVgCu6 oMR95O1c+lQhQQB/blnTHEs0v7tuO3i1puB3GaXXXmTiqTuHz4wcMGdTwetfJKrpai VWFjPy2h5QpAQ== From: trondmy@kernel.org To: linux-nfs@vger.kernel.org Cc: ChenXiaoSong , Scott Mayhew Subject: [PATCH 2/2] NFS: Don't report write errors twice Date: Sat, 9 Apr 2022 16:01:08 -0400 Message-Id: <20220409200108.94208-2-trondmy@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220409200108.94208-1-trondmy@kernel.org> References: <20220409200108.94208-1-trondmy@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Trond Myklebust Any errors reported by the write() system call need to be cleared from the file descriptor's error tracking. The current call to nfs_wb_all() causes the error to be reported, but since it doesn't call file_check_and_advance_wb_err(), we can end up reporting the same error a second time when the application calls fsync(). Reported-by: ChenXiaoSong Fixes: ce368536dd61 ("nfs: nfs_file_write() should check for writeback errors") Signed-off-by: Trond Myklebust --- fs/nfs/file.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/fs/nfs/file.c b/fs/nfs/file.c index 81c80548a5c6..54dc6f176f5c 100644 --- a/fs/nfs/file.c +++ b/fs/nfs/file.c @@ -677,9 +677,10 @@ ssize_t nfs_file_write(struct kiocb *iocb, struct iov_iter *from) /* Return error values */ error = filemap_check_wb_err(file->f_mapping, since); if (nfs_need_check_write(file, inode, error)) { - int err = nfs_wb_all(inode); - if (err < 0) - result = err; + nfs_wb_all(inode); + error = file_check_and_advance_wb_err(file); + if (error < 0) + result = error; } nfs_add_stats(inode, NFSIOS_NORMALWRITTENBYTES, written); out: