Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp946669pxp; Sun, 6 Mar 2022 01:37:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJzh4IqQD2Ze0HQPFwfeK3A+TCiX0O3E/yLNHoJtG+2GBLCK+itlPHCaGeq8+8ptoX0Ug6kX X-Received: by 2002:a17:906:2ad5:b0:6cf:9cca:d9db with SMTP id m21-20020a1709062ad500b006cf9ccad9dbmr5140076eje.252.1646559443700; Sun, 06 Mar 2022 01:37:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646559443; cv=none; d=google.com; s=arc-20160816; b=gtUZGEKYrQX+uoaDEiwgTASFtBBCrExSvbYYzNCwheYrJbuadHppiWJjAwn3TDaOxK KP43naw24TMg2rtRyTUfgFRW3dVQ1CZzKu0K5yuHKK4lDcRgIbCBeZkXZ6rqU4vGLTAg NClpTH5RPFhhyCSlFHMjy9ChClwtxHWpNMmniJQWy1YVy3c5vPXIkJEeJC02RKNqZYx8 QQ2x9o9epao/8NxzkhfXUu1qqiCyNKpWATygc+uyEz95l7DhpixCiLR1npbGpRaJHvts wbX3qw43mybh5Y123vydZ/nX4O+79qVWqO6c+0JRe3XUzTcWzCGDAbx2OODp2phK2gkb xDhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:subject:user-agent:mime-version:date:message-id; bh=YwRYpu3dLJDb7MDxGmqbBpYUDM3C/5Jg1JdUJDk/oBg=; b=Jc+5WrBsU5n4laotAXpXK7HQHqhNi3VeBsvHvMkqN7nhJ3VarpQaKAWG9AllAUGoYG c7ApUimdb82G7RyMwVx3oN9W/UQRvmlmdNXV6vNvERoO3kGdKXHviZMryijvJhyfwtxP 310LX1ZJ63We6AsYuq+1ZjlS2JmkhoEecmkj5PIrAB5FHNMU59pqlixuR1hsrzYkSVYl CjoMsafGweZKvThQQChpk+nITRWS2U1DcpStzu/V18+k5a2qaNfE3N271g1QKVQ3ogfK y67ACVLBmtGr7oeVgtQWusBJaZ+h1UcgA5uWwUxv4xFgPUtqLdnoERoqY5eBCIcHiRu+ /10g== 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 hq38-20020a1709073f2600b006da636443a9si7726725ejc.301.2022.03.06.01.36.42; Sun, 06 Mar 2022 01:37:23 -0800 (PST) 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 S232018AbiCFDzB (ORCPT + 99 others); Sat, 5 Mar 2022 22:55:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231794AbiCFDzA (ORCPT ); Sat, 5 Mar 2022 22:55:00 -0500 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 95E1F580F2; Sat, 5 Mar 2022 19:54:08 -0800 (PST) Received: from kwepemi100006.china.huawei.com (unknown [172.30.72.53]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4KB70N1WKNz9sR4; Sun, 6 Mar 2022 11:50:28 +0800 (CST) Received: from kwepemm600015.china.huawei.com (7.193.23.52) by kwepemi100006.china.huawei.com (7.221.188.165) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Sun, 6 Mar 2022 11:54:05 +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.2308.21; Sun, 6 Mar 2022 11:54:05 +0800 Message-ID: <5666cb64-c9e4-0549-6ddb-cfc877c9c071@huawei.com> Date: Sun, 6 Mar 2022 11:54:04 +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 Subject: Re: [PATCH -next 1/2] nfs: nfs{,4}_file_flush should consume writeback error To: Trond Myklebust , "anna@kernel.org" , "smayhew@redhat.com" CC: "linux-nfs@vger.kernel.org" , "liuyongqiang13@huawei.com" , "linux-kernel@vger.kernel.org" , "yi.zhang@huawei.com" , "zhangxiaoxu5@huawei.com" , ChenXiaoSong References: <20220305124636.2002383-1-chenxiaosong2@huawei.com> <20220305124636.2002383-2-chenxiaosong2@huawei.com> From: "chenxiaosong (A)" In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.176.52] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) 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,NICE_REPLY_A, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,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 It would be more clear if I update the reproducer like this: nfs server | nfs client --------------------------------- |--------------------------------- # No space left on server | fallocate -l 100G /server/nospace | | mount -t nfs $nfs_server_ip:/ /mnt | | # Expected error | dd if=/dev/zero of=/mnt/file | | # Release space on mountpoint | rm /mnt/nospace | | # Unexpected error | dd if=/dev/zero of=/mnt/file The Unexpected error (No space left on device) when doing second `dd`, is from unconsumed writeback error after close() the file when doing first `dd`. There is enough space when doing second `dd`, we should not report the nospace error. We should report and consume the writeback error when userspace call close()->flush(), the writeback error should not be left for next open(). Currently, fsync() will consume the writeback error while calling file_check_and_advance_wb_err(), close()->flush() should also consume the writeback error. 在 2022/3/6 0:53, Trond Myklebust 写道: > 'rm' doesn't open any files or do any I/O, so it shouldn't be returning > any errors from the page cache. > > IOW: The problem here is not that we're failing to clear an error from > the page cache. It is that something in 'rm' is checking the page cache > and returning any errors that it finds there. > > Is 'rm' perhaps doing a stat() on the file it is deleting? If so, does > this patch fix the bug? > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/comm > it/?id=d19e0183a883 >