Re: [PATCH v2 3/5] NFS: Don't report ENOSPC write errors twice

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



在 2022/4/12 21:13, chenxiaosong (A) 写道:
在 2022/4/12 20:16, Trond Myklebust 写道:
I understand all that. The point you appear to be missing is that this
is in fact in agreement with the documented behaviour in the write(2)
and fsync(2) manpages. These errors are supposed to be reported once,
even if they were caused by a write to a different file descriptor.

In fact, even with your change, if you make the second 'dd' call fsync
(by adding a conv=fsync), I would expect it to report the exact same
ENOSPC error, and that would be correct behaviour!

So my patches are more concerned with the fact that we appear to be
reporting the same error more than once, rather than the fact that
we're reporting them in the second attempt at I/O. As far as I'm
concerned, that is the main change that is needed to meet the behaviour
that is documented in the manpages.


After merging my patchset, when make the second 'dd' call fsync (by adding a conv=fsync), it can report ENOSPC error by calling fsync() syscall.

And when make the second 'dd' sync write (by adding a oflag=sync), it can report ENOSPC error too:

```c
write
   ksys_write
     vfs_write
       new_sync_write
         call_write_iter
           nfs_file_write
             generic_write_sync
               vfs_fsync_range
                 nfs_file_fsync
```


On other filesystem, wb error is only cleared when doing fsync() or sync write(), it should not clear the wb error when doing async write(). Your patch will clear the wb error when doing async write().

And my patchset mainly fix following problem:

filemap_sample_wb_err() always return 0 if old writeback error
have not been consumed. 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
    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
```





[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux