From: Miaohe Lin <linmiaohe@huawei.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: <linux-nilfs@vger.kernel.org>,
Naoya Horiguchi <nao.horiguchi@gmail.com>,
Ryusuke Konishi <konishi.ryusuke@gmail.com>,
Viacheslav Dubeyko <slava@dubeyko.com>
Subject: Re: [PATCH] nilfs2: report mapping errors from fsync()
Date: Mon, 30 Nov 2026 14:47:36 +0800 [thread overview]
Message-ID: <56ca69a4-d2df-dd11-aa21-3cf71bfc8d5f@huawei.com> (raw)
In-Reply-To: <0ee434a194ce4d8090007b8082a3667d.1@linux-foundation.org>
On 2026/11/28 14:27, Andrew Morton wrote:
> From: Andrew Morton <akpm@linux-foundation.org>
> 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 <akpm@linux-foundation.org>
Looks good to me. Thanks Andrew.
Reviewed-by: Miaohe Lin <linmiaohe@huawei.com>
Thanks.
.
prev parent reply other threads:[~2026-11-30 6:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-28 6:27 [PATCH] nilfs2: report mapping errors from fsync() Andrew Morton
2026-11-28 8:42 ` Ryusuke Konishi
2026-11-30 18:17 ` Viacheslav Dubeyko
2026-11-30 6:47 ` Miaohe Lin [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56ca69a4-d2df-dd11-aa21-3cf71bfc8d5f@huawei.com \
--to=linmiaohe@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=konishi.ryusuke@gmail.com \
--cc=linux-nilfs@vger.kernel.org \
--cc=nao.horiguchi@gmail.com \
--cc=slava@dubeyko.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox