mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "chenxiaosong (A)" <chenxiaosong2@huawei.com>
To: <trond.myklebust@hammerspace.com>, <anna@kernel.org>,
	<smayhew@redhat.com>
Cc: <linux-nfs@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<liuyongqiang13@huawei.com>, <yi.zhang@huawei.com>,
	<zhangxiaoxu5@huawei.com>
Subject: Re: [PATCH -next,v2 0/3] nfs: handle writeback errors correctly
Date: Fri, 1 Apr 2022 15:03:34 +0800	[thread overview]
Message-ID: <3381d7df-7254-e0ba-648c-6e763bda2ea4@huawei.com> (raw)
In-Reply-To: <20220401034409.256770-1-chenxiaosong2@huawei.com>

在 2022/4/1 11:44, ChenXiaoSong 写道:
> v1:
> cover letter: (nfs: check writeback errors correctly)
> 
> v2:
> - return more nuanced writeback errors in nfs_file_write().
> - return writeback error in close()->flush() without consumed it.
> - fix: nfs_file_write() will always call nfs_wb_all() even if there is no
> new writeback error.
> 
> 
> ChenXiaoSong (3):
>    NFS: return more nuanced writeback errors in nfs_file_write()
>    NFS: nfs{,4}_file_flush() return correct writeback errors
>    Revert "nfs: nfs_file_write() should check for writeback errors"
> 
>   fs/nfs/file.c     | 23 ++++++++++-------------
>   fs/nfs/nfs4file.c |  8 ++++----
>   fs/nfs/write.c    |  5 +----
>   3 files changed, 15 insertions(+), 21 deletions(-)
> 

It is not a good idea to modify error sequence mechanism, as the 
`lib/errseq.c` described:

	22  * Note that there is a risk of collisions if new errors are being 
recorded
	23  * frequently, since we have so few bits to use as a counter. 

	24  *
	25  * To mitigate this, one bit is used as a flag to tell whether the 
value has
	26  * been sampled since a new value was recorded. That allows us to 
avoid bumping
	27  * the counter if no one has sampled it since the last time an error was
	28  * recorded.


So, if we want to report nuanced writeback error, it is better to detect 
wb error from filemap_check_errors(), and then return 
-(file->f_mapping->wb_err & MAX_ERRNO) to userspace without consume it.

   nfs_mapping_set_error
     mapping_set_error
       __filemap_set_wb_err // record error sequence
         errseq_set
       set_bit(..., &mapping->flags) // record address_space flag

   // it is not used to be reported, just used to detect
   error = filemap_check_errors // -ENOSPC or -EIO
     test_and_clear_bit(..., &mapping->flags) // error bit cleared

   // now we try to return nuanced writeback error
   if (error)
   return filemap_check_wb_err(file->f_mapping, 0);
     return -(file->f_mapping->wb_err & MAX_ERRNO)


  parent reply	other threads:[~2022-04-01  7:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-01  3:44 ChenXiaoSong
2022-04-01  3:44 ` [PATCH -next,v2 1/3] NFS: return more nuanced writeback errors in nfs_file_write() ChenXiaoSong
2022-04-01  3:44 ` [PATCH -next,v2 2/3] NFS: nfs{,4}_file_flush() return correct writeback errors ChenXiaoSong
2022-04-01  3:44 ` [PATCH -next,v2 3/3] Revert "nfs: nfs_file_write() should check for writeback errors" ChenXiaoSong
2022-04-01  7:03 ` chenxiaosong (A) [this message]
2022-04-11 14:15   ` [PATCH -next,v2 0/3] nfs: handle writeback errors correctly chenxiaosong (A)

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=3381d7df-7254-e0ba-648c-6e763bda2ea4@huawei.com \
    --to=chenxiaosong2@huawei.com \
    --cc=anna@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=liuyongqiang13@huawei.com \
    --cc=smayhew@redhat.com \
    --cc=trond.myklebust@hammerspace.com \
    --cc=yi.zhang@huawei.com \
    --cc=zhangxiaoxu5@huawei.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

all inboxes | Powered by JetHome®