Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2148656iof; Tue, 7 Jun 2022 21:22:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy9UgTpncmVjKQzda2OralP/VECVS9HfD9BbC2fgfl7mK/6P0b8WIxLqUirteBV6tjr7N3F X-Received: by 2002:a17:902:ecc2:b0:163:fe60:43cd with SMTP id a2-20020a170902ecc200b00163fe6043cdmr31620633plh.43.1654662142394; Tue, 07 Jun 2022 21:22:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654662142; cv=none; d=google.com; s=arc-20160816; b=vLaknN0TZyN33V0MSc+hsbrygTCbB50MjLPlpOfrf91X0ooIDH1r8WhDiLXTTMTriM diS5qW3lCBiZJ4MyQ40Dhath9aw0mxs38kuOn/5Vx4x9DO8R/RLitjFa0msJpDA/jA3z eqoJ7kbaG59T6tZKkv9sFF7CrwItddpp8YE7CfbjPOen/OhJtuYAk8Y4RMTbRsiXokn8 dH8Ewd63qJBvW+r3EH+cHncSpGIOeai1wnZxrQBQOGeCGZhUuEpntoJAKB1Rf7xkoC3p kz8QLQh1q3wf2biisJpUbvRTinNwdH9e3oOKzqUNNw9N2VOihwStkBBOmVi9brD3YAZP +RkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=kQcjGM3xGF2i+PHbaHGB1DzWFr0G8Vs0C2FSRtxpVP4=; b=gdFrTafCGsNPgV83tTtNDWxPm2825dq8ZRclNr5wrRyWcep9HV1s6fvuXC6prSBIP3 gKwJbADDaLD53/HdwgusPiuyj9scxRdCxiIwy/mqT5bHlH6kMgbXBeTXPCLjmOow6evR mGditOSgGIHLoT54qTDilG5G5UvTYzWQqZ+UiMoKPjxwSiBlE25BkVbWgUKgq69Xl7uv HGI0i9QWtcpnOCEac3Dojelrs+hI6ValPTX2methSuMrGf9plKBZLwDwps556YBs5FB+ 0YnQOsMp4PmjAljraXDrDxz6YDsnTNgtCdoR+gNwWymb91XKQMx7ZIt24VuMi9YiMNAB MlPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=F9ODb5ci; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id p4-20020a17090ad30400b001e30a3a5f49si23768684pju.121.2022.06.07.21.22.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 21:22:22 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=F9ODb5ci; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 30E57443558; Tue, 7 Jun 2022 21:11:37 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348855AbiFGR7E (ORCPT + 99 others); Tue, 7 Jun 2022 13:59:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347992AbiFGRk3 (ORCPT ); Tue, 7 Jun 2022 13:40:29 -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 7674A59B8D; Tue, 7 Jun 2022 10:33:44 -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 D8D9461407; Tue, 7 Jun 2022 17:33:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E86EDC385A5; Tue, 7 Jun 2022 17:33:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654623200; bh=eQnOAPPA0T9I35kYUtt6/88w/2lQQZcTibDUJqet/ss=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F9ODb5ciG1PALmHeG7/hdloCnl5JBfoVWlpEU8e4kX6HjlQ7CQV49bYuk2FHekamj HkFNr83HuMa3/YnlsEHtEhmM+mem/y8V/Uu6PlC5qmUx0Cgn2m2QwxplmJCGysxC8d VeSY/Zq6zO3FLZMbKmB79MyLjC9Vcesk0nqf5ooM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Trond Myklebust , Anna Schumaker , Sasha Levin Subject: [PATCH 5.10 329/452] NFS: fsync() should report filesystem errors over EINTR/ERESTARTSYS Date: Tue, 7 Jun 2022 19:03:06 +0200 Message-Id: <20220607164918.364902253@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607164908.521895282@linuxfoundation.org> References: <20220607164908.521895282@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Trond Myklebust [ Upstream commit 9641d9bc9b75f11f70646f5c6ee9f5f519a1012e ] If the commit to disk is interrupted, we should still first check for filesystem errors so that we can report them in preference to the error due to the signal. Fixes: 2197e9b06c22 ("NFS: Fix up fsync() when the server rebooted") Signed-off-by: Trond Myklebust Signed-off-by: Anna Schumaker Signed-off-by: Sasha Levin --- fs/nfs/file.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/fs/nfs/file.c b/fs/nfs/file.c index 7b47f9b063f1..887faff3a73e 100644 --- a/fs/nfs/file.c +++ b/fs/nfs/file.c @@ -208,15 +208,16 @@ static int nfs_file_fsync_commit(struct file *file, int datasync) { struct inode *inode = file_inode(file); - int ret; + int ret, ret2; dprintk("NFS: fsync file(%pD2) datasync %d\n", file, datasync); nfs_inc_stats(inode, NFSIOS_VFSFSYNC); ret = nfs_commit_inode(inode, FLUSH_SYNC); - if (ret < 0) - return ret; - return file_check_and_advance_wb_err(file); + ret2 = file_check_and_advance_wb_err(file); + if (ret2 < 0) + return ret2; + return ret; } int -- 2.35.1