diff mbox series

ceph: redirty page before returning AOP_WRITEPAGE_ACTIVATE

Message ID 171131888022.13576.8585118457506044105@noble.neil.brown.name (mailing list archive)
State New, archived
Headers show
Series ceph: redirty page before returning AOP_WRITEPAGE_ACTIVATE | expand

Commit Message

NeilBrown March 24, 2024, 10:21 p.m. UTC
The page has been marked clean before writepage is called.  If we don't
redirty it before postponing the write, it might never get written.

Fixes: 503d4fa6ee28 ("ceph: remove reliance on bdi congestion")
Signed-off-by: NeilBrown <neilb@suse.de>
---
 fs/ceph/addr.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Jeff Layton March 24, 2024, 11:45 p.m. UTC | #1
On Mon, 2024-03-25 at 09:21 +1100, NeilBrown wrote:
> The page has been marked clean before writepage is called.  If we don't
> redirty it before postponing the write, it might never get written.
> 
> Fixes: 503d4fa6ee28 ("ceph: remove reliance on bdi congestion")
> Signed-off-by: NeilBrown <neilb@suse.de>
> ---
>  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 1340d77124ae..ee9caf7916fb 100644
> --- a/fs/ceph/addr.c
> +++ b/fs/ceph/addr.c
> @@ -795,8 +795,10 @@ static int ceph_writepage(struct page *page, struct writeback_control *wbc)
>  	ihold(inode);
>  
>  	if (wbc->sync_mode == WB_SYNC_NONE &&
> -	    ceph_inode_to_fs_client(inode)->write_congested)
> +	    ceph_inode_to_fs_client(inode)->write_congested) {
> +		redirty_page_for_writepage(wbc, page);
>  		return AOP_WRITEPAGE_ACTIVATE;
> +	}
>  
>  	wait_on_page_fscache(page);
>  

Reviewed-by: Jeff Layton <jlayton@kernel.org>
Xiubo Li March 25, 2024, 1:28 a.m. UTC | #2
On 3/25/24 06:21, NeilBrown wrote:
> The page has been marked clean before writepage is called.  If we don't
> redirty it before postponing the write, it might never get written.
>
> Fixes: 503d4fa6ee28 ("ceph: remove reliance on bdi congestion")
> Signed-off-by: NeilBrown <neilb@suse.de>
> ---
>   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 1340d77124ae..ee9caf7916fb 100644
> --- a/fs/ceph/addr.c
> +++ b/fs/ceph/addr.c
> @@ -795,8 +795,10 @@ static int ceph_writepage(struct page *page, struct writeback_control *wbc)
>   	ihold(inode);
>   
>   	if (wbc->sync_mode == WB_SYNC_NONE &&
> -	    ceph_inode_to_fs_client(inode)->write_congested)
> +	    ceph_inode_to_fs_client(inode)->write_congested) {
> +		redirty_page_for_writepage(wbc, page);
>   		return AOP_WRITEPAGE_ACTIVATE;
> +	}
>   
>   	wait_on_page_fscache(page);
>   

Good catch!

Applied to the testing branch to run the tests.

Thanks NeilBrown

- Xiubo
diff mbox series

Patch

diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
index 1340d77124ae..ee9caf7916fb 100644
--- a/fs/ceph/addr.c
+++ b/fs/ceph/addr.c
@@ -795,8 +795,10 @@  static int ceph_writepage(struct page *page, struct writeback_control *wbc)
 	ihold(inode);
 
 	if (wbc->sync_mode == WB_SYNC_NONE &&
-	    ceph_inode_to_fs_client(inode)->write_congested)
+	    ceph_inode_to_fs_client(inode)->write_congested) {
+		redirty_page_for_writepage(wbc, page);
 		return AOP_WRITEPAGE_ACTIVATE;
+	}
 
 	wait_on_page_fscache(page);