Make write(2) return error prematurely if there is writeback error. User can use fsync() or fdatasync() to clear the error. This change is mainly for reporting errors after blacklist + reconnect. Signed-off-by: "Yan, Zheng" <zyan@xxxxxxxxxx> --- fs/ceph/caps.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c index 57e1447a9d4b..f07767d3864c 100644 --- a/fs/ceph/caps.c +++ b/fs/ceph/caps.c @@ -2814,6 +2814,14 @@ int ceph_get_caps(struct file *filp, int need, int want, break; } + if (_got & CEPH_CAP_FILE_WR) { + ret = filemap_check_wb_err(inode->i_mapping, filp->f_wb_err); + if (ret < 0) { + ceph_put_cap_refs(ci, _got); + return ret; + } + } + if ((_got & CEPH_CAP_FILE_RD) && (_got & CEPH_CAP_FILE_CACHE)) ceph_fscache_revalidate_cookie(ci); -- 2.17.2