diff mbox series

ceph: redirty the page for wirtepage if fails

Message ID 20220424093924.32691-1-xiubli@redhat.com
State New
Headers show
Series ceph: redirty the page for wirtepage if fails | expand

Commit Message

Xiubo Li April 24, 2022, 9:39 a.m. UTC
When run out of memories we should redirty the page before failing
the writepage. Or we will hit BUG_ON(folio_get_private(folio)) in
ceph_dirty_folio().

URL: https://tracker.ceph.com/issues/55421
Signed-off-by: Xiubo Li <xiubli@redhat.com>
---
 fs/ceph/addr.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Jeff Layton April 25, 2022, 7:04 p.m. UTC | #1
On Sun, 2022-04-24 at 17:39 +0800, Xiubo Li wrote:
> When run out of memories we should redirty the page before failing
> the writepage. Or we will hit BUG_ON(folio_get_private(folio)) in
> ceph_dirty_folio().
> 
> URL: https://tracker.ceph.com/issues/55421
> Signed-off-by: Xiubo Li <xiubli@redhat.com>
> ---
>  fs/ceph/addr.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
> index 261bc8bb2ab8..656bc0ca7a78 100644
> --- a/fs/ceph/addr.c
> +++ b/fs/ceph/addr.c
> @@ -606,8 +606,10 @@ static int writepage_nounlock(struct page *page, struct writeback_control *wbc)
>  				    CEPH_OSD_OP_WRITE, CEPH_OSD_FLAG_WRITE, snapc,
>  				    ceph_wbc.truncate_seq, ceph_wbc.truncate_size,
>  				    true);
> -	if (IS_ERR(req))
> +	if (IS_ERR(req)) {
> +		redirty_page_for_writepage(wbc, page);
>  		return PTR_ERR(req);
> +	}
>  
>  	set_page_writeback(page);
>  	if (caching)

Reviewed-by: Jeff Layton <jlayton@kernel.org>
diff mbox series

Patch

diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
index 261bc8bb2ab8..656bc0ca7a78 100644
--- a/fs/ceph/addr.c
+++ b/fs/ceph/addr.c
@@ -606,8 +606,10 @@  static int writepage_nounlock(struct page *page, struct writeback_control *wbc)
 				    CEPH_OSD_OP_WRITE, CEPH_OSD_FLAG_WRITE, snapc,
 				    ceph_wbc.truncate_seq, ceph_wbc.truncate_size,
 				    true);
-	if (IS_ERR(req))
+	if (IS_ERR(req)) {
+		redirty_page_for_writepage(wbc, page);
 		return PTR_ERR(req);
+	}
 
 	set_page_writeback(page);
 	if (caching)