Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp449824iog; Wed, 15 Jun 2022 05:46:28 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tsrP1gxCv05ILdw/LdS1qh9whwuUbVsImsRHTpH6e6Ya6K5xy2YNoXtSsf2tkHbSAL6ta8 X-Received: by 2002:a17:902:e0d1:b0:168:bedf:7146 with SMTP id e17-20020a170902e0d100b00168bedf7146mr9212338pla.107.1655297188230; Wed, 15 Jun 2022 05:46:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655297188; cv=none; d=google.com; s=arc-20160816; b=GHI0FBAWkjOyJJi3hKffYsJFSO4V2aY2/IOjfGI+cWhJ+vSLiRsSRdLRmqbTcnZmWP fXGb2sf7mnclgx6wU0lxFCxobZmFIUlAuNmhJVoaM+mSUcIEZ9eCjmwwbOJJXuGjQ2Vc zB50SZ76SuW/e4uTG8NpTVK9PZSN8eL3zy/fpi7u3swz+oKQC2uNU7ODyDNkP9FLel0y k25edJHkOFIEHkXaL1fCXC/UG/nlZ2AmV2gYwExmT63tXGti8qtwo/C3cQKqpskttm5P 9TRSSNBJNQa0sZ286MqTJsPIlIldeanWWq+Bi/ZlYb8gFD+mzbReilqf0wzE4UdSNrRY edsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:subject:from:cc:to :user-agent:mime-version:date:message-id; bh=P1h0tEwaRMWQErIq8lCzNrgZZHQA6CvSCJlKv6raF0g=; b=dDYBz/g8UuN1TOONH4TGg3U70dqqxX0dKLp5o8/yp18iM2Bsx6bNycOYAj1HZoscXn fd1GUK91aSW3CGUo1z2sXywLbYhnYwx1oYm6Vl4/ErC6MjacUzMWkhlowUHZkdP/EP5u NyNpjZQHDNYbuUSUv007JlhKn0ksAMr3QTRif7PxGRo3vz3M9NjYadNZmwrt2cZIkMRY EFbLMjEsHm+A9S7BnYEXGjkonGFT0oJG7zGYPS2gWUz75C643t4+kHYLEYxNFJXpG2fa uSctwCOOeRnTPWi5XDwvAYapFIaB1lc1BsO7Cta2cXYrA7RQZiwuKMezHNk9YQPGvAyb 3OTw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f29-20020aa7969d000000b0050df0f5da58si15262440pfk.62.2022.06.15.05.46.05; Wed, 15 Jun 2022 05:46:28 -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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343511AbiFOMns (ORCPT + 99 others); Wed, 15 Jun 2022 08:43:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348747AbiFOMnm (ORCPT ); Wed, 15 Jun 2022 08:43:42 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B972E22 for ; Wed, 15 Jun 2022 05:43:41 -0700 (PDT) Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.57]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4LNQ2S1jY6zDrK8; Wed, 15 Jun 2022 20:43:12 +0800 (CST) Received: from kwepemm600015.china.huawei.com (7.193.23.52) by dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 15 Jun 2022 20:43:38 +0800 Received: from [10.174.176.52] (10.174.176.52) 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; Wed, 15 Jun 2022 20:43:37 +0800 Message-ID: Date: Wed, 15 Jun 2022 20:43:36 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.2.1 To: Trond Myklebust CC: "linux-nfs@vger.kernel.org" , "zhangxiaoxu5@huawei.com" From: "chenxiaosong (A)" Subject: Question about reporting unexpected wb err in nfs write()/flush() Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.176.52] 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=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, 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 Hi Trond: OK, I understand, I will not clear wb err in close(). I will not change rules that apply to all filesystems. But if old wb err (such as -ERESTARTSYS or -EINTR, etc.) exist in struct address_space->wb_err, nfs_file_write() will always return the unexpected error. filemap_check_wb_err() will return the old error even if there is no new writeback error between filemap_sample_wb_err() and filemap_check_wb_err(). ```c since = filemap_sample_wb_err() = 0 // never be error errseq_sample if (!(old & ERRSEQ_SEEN)) // nobody see the error return 0; nfs_wb_all // no new error error = filemap_check_wb_err(..., since) != 0 // unexpected error ``` I will fix this by store old err before filemap_sample_wb_err(), and restore old err after filemap_check_wb_err(): ```c // Store the wb err old_err = file_check_and_advance_wb_err(file) since = filemap_sample_wb_err() nfs_wb_all // detect new wb err error = filemap_check_wb_err(..., since) // Restore old wb err if no new err is detected if (!error && old_err) errseq_set(&file->f_mapping->wb_err, old_err); ``` Is my fixes reasonable ?