On Mon, 2019-06-17 at 20:55 +0800, Yan, Zheng wrote: > 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); > This seems wrong. Just because an earlier write failed, we don't necessarily want to start returning errors on other writes. I'd drop this patch. -- Jeff Layton <jlayton@xxxxxxxxxx>