[PATCH 6.6 019/158] ceph: redirty page before returning AOP_WRITEPAGE_ACTIVATE

Greg Kroah-Hartman
2024-04-23T21:43:06Z

From: NeilBrown <neilb@suse.de>

[ Upstream commit b372e96bd0a32729d55d27f613c8bc80708a82e1 ]

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.

Cc: stable@vger.kernel.org
Fixes: 503d4fa6ee28 ("ceph: remove reliance on bdi congestion")
Signed-off-by: NeilBrown <neilb@suse.de>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: Xiubo Li <xiubli@redhat.org>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
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 28fa05a9d4d2f..da64bb7325dbc 100644
--- a/fs/ceph/addr.c
+++ b/fs/ceph/addr.c
@@ -803,8 +803,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);

--
2.43.0