Linux CIFS filesystem development
 help / color / mirror / Atom feed
* [PATCH -next] cifs: return the more nuanced writeback error on close()
@ 2022-05-18 14:56 ChenXiaoSong
  0 siblings, 0 replies; only message in thread
From: ChenXiaoSong @ 2022-05-18 14:56 UTC (permalink / raw)
  To: sfrench
  Cc: linux-cifs, samba-technical, linux-kernel, chenxiaosong2,
	liuyongqiang13, yi.zhang, zhangxiaoxu5

As filemap_check_errors() only report -EIO or -ENOSPC, we return more nuanced
writeback error -(file->f_mapping->wb_err & MAX_ERRNO).

  filemap_write_and_wait
    filemap_write_and_wait_range
      filemap_check_errors
        -ENOSPC or -EIO
  filemap_check_wb_err
    errseq_check
      return -(file->f_mapping->wb_err & MAX_ERRNO)

Signed-off-by: ChenXiaoSong <chenxiaosong2@huawei.com>
---
 fs/cifs/file.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index d511a78383c3..559f59a047c2 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -2777,8 +2777,11 @@ int cifs_flush(struct file *file, fl_owner_t id)
 		rc = filemap_write_and_wait(inode->i_mapping);
 
 	cifs_dbg(FYI, "Flush inode %p file %p rc %d\n", inode, file, rc);
-	if (rc)
+	if (rc) {
+		/* get more nuanced writeback errors */
+		rc = filemap_check_wb_err(file->f_mapping, 0);
 		trace_cifs_flush_err(inode->i_ino, rc);
+	}
 	return rc;
 }
 
-- 
2.31.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-05-18 14:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-18 14:56 [PATCH -next] cifs: return the more nuanced writeback error on close() ChenXiaoSong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox