From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=113.46.200.217 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796021262; b=Xbp+aeNd+HKx0ENSUznA/1zX89noi7fytgc7XMvYotMYjPVPKUoCxof/HMETcBLEkpOa pvssBFDuBaPFRtifq3cbUyXh4vEhQ1R3/4BQmOrEkzMkJz2EQiKD4M2JZS+0Bw4tACsIe yw+c3Xa+B0m/gXRtynvAE5Gy/QG0n91RNio0wrH90sHJBZt2KWtnwmt8t78Om4mL4H2vc jXxk/fY8lWWcFqX+o4GnyWMEalcWne4Wot0vQ8kF2/wdkhA1sgTHOQVkH8AIOP0DFzOQN SxT/1A/X4yWxOLqZvIdwt7GuW+hyW4Do9jneKACsF2T+nxy0jfvCXHGscnYawsRP65Q== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796021262; h=DMARC-Filter:dkim-signature:Received:Received:Received:Subject:To:CC: References:From:Message-ID:Date:User-Agent:MIME-Version:In-Reply-To: Content-Type:Content-Language:Content-Transfer-Encoding: X-Originating-IP:X-ClientProxiedBy; bh=SJYad9PXBiIwijjUFCYuJ1PykbbXT517es0RgVITN3E=; b=j4z0KbImfjNZLy9cFzQH16W6Bs0WppcfogOZaakRefD5Qz6uMvJPBtO2iRdAPuoq7dJn Z/HxfuyPrzw6hvK1f+V2r7sUp0I0CS4ZM6y40bzUzLWjqzpG/Dm5d0FgH3gpOtl/qV8ln ublasR+XXOqtEwXag6Dzqtf6kivq9lVrfBo5YQAk0ZP4k7Cjh5PCgNjbk9tU5ahkK5FfB avvWuU0NhJzdpOwy/4AcbivbXTZaU1rw5Grg9ZiA1hneikJBLQEuycAB+qXPZ8ME1tnSm SO5IRx/E6uxo3CRGwid6DYs59y8yrNycx5fVBMyTkGtwIpNIkB2qb8PHWSWIxqhedjA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; dkim=pass header.d=huawei.com header.i=@huawei.com header.a=rsa-sha256 header.s=dkim header.b=4kMQITt4; arc=none smtp.remote-ip=113.46.200.217 Received: from canpmsgout02.his.huawei.com (canpmsgout02.his.huawei.com [113.46.200.217]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 08AFD606A31C for ; Mon, 30 Nov 2026 06:47:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 08AFD606A31C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=huawei.com header.i=@huawei.com header.a=rsa-sha256 header.s=dkim header.b=4kMQITt4 dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=SJYad9PXBiIwijjUFCYuJ1PykbbXT517es0RgVITN3E=; b=4kMQITt43TNDTcIH1Bl23DSuvJqc4/lEnIWgn5tm60g96WBDdmOYqW2LKkskRTx/JefdYut17 PAFUZlLEgpDpN4s7eIA6wy9LQmm21ie5VuP6GbSjg8IxOyHslyI7WLd1Nogg614bCzM1b+PQ5Io L4JMzM5cWaOhrwiEPimwcAw= Received: from mail.maildlp.com (unknown [172.19.162.140]) by canpmsgout02.his.huawei.com (SkyGuard) with ESMTPS id 4jdF0v3gw6zcbNc; Mon, 30 Nov 2026 14:46:23 +0800 (CST) Received: from whupemk100004.china.huawei.com (unknown [7.152.185.74]) by mail.maildlp.com (Postfix) with ESMTPS id F1393203AB; Mon, 30 Nov 2026 14:47:37 +0800 (CST) Received: from [10.173.98.163] (10.173.98.163) by whupemk100004.china.huawei.com (7.152.185.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.56; Mon, 30 Nov 2026 14:47:37 +0800 Subject: Re: [PATCH] nilfs2: report mapping errors from fsync() To: Andrew Morton CC: , Naoya Horiguchi , Ryusuke Konishi , Viacheslav Dubeyko References: <0ee434a194ce4d8090007b8082a3667d.1@linux-foundation.org> From: Miaohe Lin Message-ID: <56ca69a4-d2df-dd11-aa21-3cf71bfc8d5f@huawei.com> Date: Mon, 30 Nov 2026 14:47:36 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 X-Mailing-List: linux-nilfs@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 In-Reply-To: <0ee434a194ce4d8090007b8082a3667d.1@linux-foundation.org> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-ClientProxiedBy: kwepems200001.china.huawei.com (7.221.188.67) To whupemk100004.china.huawei.com (7.152.185.74) On 2026/11/28 14:27, Andrew Morton wrote: > From: Andrew Morton > Subject: nilfs2: report mapping errors from fsync() > Date: Sun, 22 Nov 2026 17:23:26 -0800 > > nilfs_sync_file() constructs a segment and flushes the device, but never > looks at the error state of the file's mapping. Nothing else in nilfs2 > does either. So an error which was recorded with mapping_set_error() is > never reported to the application. > > memory_failure() records -EIO that way when it has to discard a dirty > page-cache page. On other filesystems the next fsync() then fails with > EIO, which is how the application learns that data it wrote has been > lost. On nilfs2 fsync() returns 0. The memory-failure selftest, once it > checks for this, fails on nilfs2 in 20 of 20 runs: > > memory-failure.c:413:dirty_pagecache:Expected fsync(fd) (0) == -1 (-1) > > Call file_check_and_advance_wb_err() in nilfs_sync_file(). Call it even > when segment construction or the flush has failed, so that the recorded > error is consumed for this file either way, and return it if nothing > failed earlier. > > Signed-off-by: Andrew Morton Looks good to me. Thanks Andrew. Reviewed-by: Miaohe Lin Thanks. .