Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2194924iof; Tue, 7 Jun 2022 22:50:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx3+0JmwtOTayjx1QGNfYfJo2GUrx4sKRb83xpm7NdcO66OABEdjM70sBsVpJ6JJMI5hej3 X-Received: by 2002:a63:8b42:0:b0:3fc:7de2:7764 with SMTP id j63-20020a638b42000000b003fc7de27764mr28682088pge.358.1654667428277; Tue, 07 Jun 2022 22:50:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654667428; cv=none; d=google.com; s=arc-20160816; b=hiFjyTPmngtew4nWXAVja6ctcmHAqSlICHqc9jPMixcBZvy/qKrtJwrdJdYpFQ7/qj 2FgvBWlegm6Frj4PF6Y/2QxyOs5JVCWkd8uB0Zc/iNUvHYivyrojJ6phRigRxHvRU0wD vIDzX5rMdSqroQjfCtIv4Nme0WcbUl5Y3F4mLc5l4KIyui0SN71SqrMZP5rPKVd+C0AD +slCy9YD+3NWz8I7Ip/I/V9KYfrE+bs9RVgskt7khU5Q+8FUGqa7IYhP7YYH1uaY+RlE nO7gFk8aPVje+TiNfuBdetBx0SgVKTI+eEJlvQqnZIqxDS1+8YmAuR1dnaJGfpeICopI 5vTw== 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=l0GsGzZsqgnk41UpV1nIC/Zfr+jM9hjWCiZFw94By9c=; b=ypjmfsNBHVev2jQeEhI901vwsFBbKO2Ji9IG4fpI38tkSGsVBk8xp3E1C7ypo8lNVi 7QgVVaojKJe1BAVOCLXE8Ve0eKMQfIks6RgusVFts5sdoqxCMCaKpHxOfrIpLvnuZ3C1 THCRmj+iDL3DfQWs6yUM9/+Rq43qJmBGjzNiVXgCk5LJs99hXnMJr0he+RlcjSb4hebq Uwrsmk09v39fPZqXM3Loy7kOolZSJgseyfFv3BzXoXAOJ2kVl70Of4um/QQ7m4cz6vJ2 jQ4/wgJAosOFHaWpkPSIoqEHZuiBmmnlrJ1IfdrGwglvdeCD7M5e0huBpLBCxwE4tKZu 6aVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=s7mSMTOy; 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 w138-20020a627b90000000b0051873a68dd2si25861744pfc.252.2022.06.07.22.50.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 22:50:28 -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=s7mSMTOy; 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 1200F4A5D1E; Tue, 7 Jun 2022 22:17:20 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235025AbiFHAmw (ORCPT + 99 others); Tue, 7 Jun 2022 20:42:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382906AbiFGWHT (ORCPT ); Tue, 7 Jun 2022 18:07:19 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A2D2254EEA; Tue, 7 Jun 2022 12:18: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 ams.source.kernel.org (Postfix) with ESMTPS id 63A17B823CA; Tue, 7 Jun 2022 19:18:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C753AC36B08; Tue, 7 Jun 2022 19:18:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654629502; bh=rLzYEFQhxQzMthEPxUzfgqVrGddGFJ4QCp/TClNTFx8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s7mSMTOyUf8ElIK9XEF84LknlmR5aabGHoRGY5xVTH2aFhhfUsj95oYFf2JBha4c6 nXlrsLqEcBa8nbGP5EfvDewdBHbs3ddY//Yk5DSNvkDE6xOBgo17nCEVEoUQBgl4/B aA8v/+FjX9y13buzh07/mxHedSlLKidnC22rwvHw= 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.18 677/879] NFS: fsync() should report filesystem errors over EINTR/ERESTARTSYS Date: Tue, 7 Jun 2022 19:03:15 +0200 Message-Id: <20220607165022.498883333@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@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 150b7fa8f0a7..7c380e555224 100644 --- a/fs/nfs/file.c +++ b/fs/nfs/file.c @@ -204,15 +204,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