Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp1681335ioo; Mon, 23 May 2022 00:06:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzEj/MirGB0VG9u57Avk59zxURZziyt1iDDLgmTpDnCFjXTMKV2tncXcae2pXPSpIZP1UKH X-Received: by 2002:a17:902:7247:b0:162:32db:a9a1 with SMTP id c7-20020a170902724700b0016232dba9a1mr527821pll.131.1653289596537; Mon, 23 May 2022 00:06:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653289596; cv=none; d=google.com; s=arc-20160816; b=uZk8iHr86bB+G56bCVa0pyDsdcdjsrWO7jKdhVE2NcBpXSg8Fe+C0qqIRgXIsHSVco iF+yfmGMoIEGAAxvGInzWGfdzquFk0YgDijLppgAIn7DwMQX0IgWp1G/JkNvDjlfdZe0 1nEm2epdbqri5uxyjWZ8g1u+v+o97GBo2ALGd6iEJTcDC/0fVf0xXoJLtcLSY61XwN0N RwuSXYBQl6SSJpTzEDkkmeSEnQWhm6WywvjxTt5D4rFuQwtih4sjt627xZTqSBt9ZMVo kTjX3Vd8H6uk2H2I7zOsWuILKINBqZjAF+onnvKCDp1OQ2xW/kcJXUj6QnADKQ/213dW /Y3A== 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 :message-id:date:subject:cc:to:from; bh=EctTsEmDnzcgqI9iCDnzICz1q9wvj0gu7p5ZcHOieAY=; b=K7OHHNboVloFJnHR8sgr0/PaXQEhuW5sfp+CMEI5L+Hbj9ANNx4q+3XGdncLRWWTaP IJbTuKiLmDl/JwKWZhyqHIuNXrl37hpEzDwJiU/piTWpdts+hgWWDzjuNNBRJIf6bA9S fhVYqGS8dH9MEdLotdJdbeN866PEqqZO7dkisu9puA1xlt6P3mIGUUP3wC7rr/YQ/MwC kPHJVbCcarrlZ/0ELOY//CWR13kvkWmwI2lTi0U1pNgbRVfkMwYqnh1XGhUzZx5YnTxs 6aY48ezBvXlPy+zp00zJwlcopyfnCKtPDIwfeDD4nTYgSeRihJce8B+VDtkJMZzU3Et0 +36w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id a185-20020a6390c2000000b003f84816d04fsi9361333pge.8.2022.05.23.00.06.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 00:06:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D77EB6B0AA; Sun, 22 May 2022 23:27:46 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237967AbiEWBfO (ORCPT + 99 others); Sun, 22 May 2022 21:35:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233232AbiEWBfL (ORCPT ); Sun, 22 May 2022 21:35:11 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A493238BF6; Sun, 22 May 2022 18:35:10 -0700 (PDT) Received: from kwepemi500025.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4L60H85zpdzjWvg; Mon, 23 May 2022 09:34:12 +0800 (CST) Received: from kwepemm600015.china.huawei.com (7.193.23.52) by kwepemi500025.china.huawei.com (7.221.188.170) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Mon, 23 May 2022 09:35:08 +0800 Received: from huawei.com (10.175.127.227) by kwepemm600015.china.huawei.com (7.193.23.52) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Mon, 23 May 2022 09:35:08 +0800 From: ChenXiaoSong To: CC: , , , , , Subject: [PATCH -next,v2] fuse: return the more nuanced writeback error on close() Date: Mon, 23 May 2022 09:48:38 +0800 Message-ID: <20220523014838.1647498-1-chenxiaosong2@huawei.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.127.227] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemm600015.china.huawei.com (7.193.23.52) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 As filemap_check_errors() only report -EIO or -ENOSPC, we return more nuanced writeback error -(file->f_mapping->wb_err & MAX_ERRNO). filemap_write_and_wait filemap_write_and_wait_range filemap_check_errors -ENOSPC or -EIO filemap_check_wb_err errseq_check return -(file->f_mapping->wb_err & MAX_ERRNO) Signed-off-by: ChenXiaoSong --- fs/fuse/file.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/fuse/file.c b/fs/fuse/file.c index f18d14d5fea1..9917bc2795e6 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -488,10 +488,10 @@ static int fuse_flush(struct file *file, fl_owner_t id) inode_unlock(inode); err = filemap_check_errors(file->f_mapping); + /* return more nuanced writeback errors */ if (err) - return err; + return filemap_check_wb_err(file->f_mapping, 0); - err = 0; if (fm->fc->no_flush) goto inval_attr_out; -- v2: remove redundant code: err = 0 2.31.1