diff mbox series

[7/8] ceph: check page writeback error during write

Message ID 20190617125529.6230-8-zyan@redhat.com (mailing list archive)
State New, archived
Headers show
Series ceph: remount aborted mount | expand

Commit Message

Yan, Zheng June 17, 2019, 12:55 p.m. UTC
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@redhat.com>
---
 fs/ceph/caps.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Jeff Layton June 20, 2019, 3:26 p.m. UTC | #1
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@redhat.com>
> ---
>  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.
diff mbox series

Patch

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);