Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1396988iob; Sat, 14 May 2022 07:58:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwJ/4aN0ciU7dJeCBU3Ivr15zpyt8aSia2ZV/XBaBVfEZwBtzJHNlv97YlQdy0w2J+D2php X-Received: by 2002:a5d:4744:0:b0:20a:ea5a:dc39 with SMTP id o4-20020a5d4744000000b0020aea5adc39mr7852310wrs.236.1652540324564; Sat, 14 May 2022 07:58:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652540324; cv=none; d=google.com; s=arc-20160816; b=vsXMAlrxK75Da8urx+lGgp4FVx2dL6k3+NB0IsGS8U6Wudv1KO16Ej426ypMZgkhrs QxI6YHv/9o+uxBNgCcYzNV6i9DZvQNu4elD9sg360W5+VoRNXiT3oxnMfS34OfBBbXiO dg6BbfiWMxRasZD6N9485IsPV8c8pJQXjD+DeSE+t/aJhXxRPVMAnKTJDiKU9saGYdon fPXqd0NjMDiqOYUlZh2Z2v8xaC5gjnWeiR9LNoz1U1T69m4zO2tIEJ4XgT2DfTI254GA nYYaQHtnyGpwLi28KLkKPvRTcjOuFa3cVEwe59NJq5/F+UKfeaxsDQRXYixquQ9OL24B 6oTQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=xnHuleJ/EuM02TNYXwxR0Qu7xB1FXXRPkEuV0A7/0Ls=; b=tErEvXEzvA+9ih0Yz9VHC6NF31HsHx4DsWsFOlWO7wgAYSvqsGwfFo3l5fbWbZUuT5 u5Tvopl0QAQAOVPaQnpgAPaSl0coMjjNeDOFe0y5H4gejCeor6tGLPkJsY8fm5aqWyDc sH9iF98jmI1lH636xdzJ99V2JMXMBN+HLEfSP76r2Bx0SObS6TyH8tE9mecO44SZSm7W Eu4TD2dLZKhB7jwZH2OCiPA9lxpKWkK0WJDwirj4wxYivhPC8+ass86iaRcF/2bWNEKr 7V89rdfyozwG+Y5HNXGsMK6jTg9EmEqtNf9Vz02riY8ggr0hsvQyrWo4r6oA4ICXLgva PzEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jBkA6nPh; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t16-20020a05600c2f9000b0039434521ec3si4889812wmn.151.2022.05.14.07.58.01; Sat, 14 May 2022 07:58:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jBkA6nPh; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233335AbiENOdR (ORCPT + 99 others); Sat, 14 May 2022 10:33:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53118 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233333AbiENOdQ (ORCPT ); Sat, 14 May 2022 10:33:16 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1D861C91A for ; Sat, 14 May 2022 07:33:14 -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 5D971B808D4 for ; Sat, 14 May 2022 14:33:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BC8E0C340EE; Sat, 14 May 2022 14:33:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1652538792; bh=TnkYOxtcX0bijf8kIP+vmw0tFtDlR1x+1BxPHrsP0j8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jBkA6nPhVjwesla2NEbqgmzmcgK0jIn445dnxVDyHpBSUWZAE7wcNutKWKp0Xg7qr 3J0D6Fd4R9Cb5noCoTLqtiu8Hr7VOd5tkhDb9ivAVL/Z9YF+dmMZsoTZtdFEyx0QZB wbr56vuthWblLak3px2Au2bmPZ7HVtdSPcF2At9iEkMiIYkupIzj1qKjSUoUw5oSLm lb7EyAybxIx73qrI2DOYIwyKTCSIl7bkqa2MuMvoZnbWH/msKIhZRCIrm9gwiP3Vdk JuDjdwy4276vxi0hlR95ksUyHNaIj5LmrkF0lqs6zmX/6+CiA/l0I+4MbSTNriskwA dcgH6y/TfzQcw== From: trondmy@kernel.org To: Anna Schumaker Cc: linux-nfs@vger.kernel.org Subject: [PATCH v3 2/5] NFS: fsync() should report filesystem errors over EINTR/ERESTARTSYS Date: Sat, 14 May 2022 10:27:01 -0400 Message-Id: <20220514142704.4149-3-trondmy@kernel.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220514142704.4149-2-trondmy@kernel.org> References: <20220514142704.4149-1-trondmy@kernel.org> <20220514142704.4149-2-trondmy@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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-nfs@vger.kernel.org From: Trond Myklebust 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 --- 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.36.1