At the same time fix another buggy code because in writepages_finish if the opcode doesn't equal to CEPH_OSD_OP_WRITE the request memory must have been corrupted. URL: https://tracker.ceph.com/issues/55421 Signed-off-by: Xiubo Li <xiubli@xxxxxxxxxx> --- fs/ceph/addr.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c index e52b62407b10..ae224135440b 100644 --- a/fs/ceph/addr.c +++ b/fs/ceph/addr.c @@ -146,6 +146,8 @@ static void ceph_invalidate_folio(struct folio *folio, size_t offset, if (offset != 0 || length != folio_size(folio)) { dout("%p invalidate_folio idx %lu partial dirty page %zu~%zu\n", inode, folio->index, offset, length); + filemap_dirty_folio(folio->mapping, folio); + folio_account_redirty(folio); return; } @@ -733,8 +735,7 @@ static void writepages_finish(struct ceph_osd_request *req) /* clean all pages */ for (i = 0; i < req->r_num_ops; i++) { - if (req->r_ops[i].op != CEPH_OSD_OP_WRITE) - break; + BUG_ON(req->r_ops[i].op != CEPH_OSD_OP_WRITE); osd_data = osd_req_op_extent_osd_data(req, i); BUG_ON(osd_data->type != CEPH_OSD_DATA_TYPE_PAGES); -- 2.36.0.rc1