Skip to content

Commit 642d51f

Browse files
lxbszidryomov
authored andcommitted
ceph: check folio PG_private bit instead of folio->private
The pages in the file mapping maybe reclaimed and reused by other subsystems and the page->private maybe used as flags field or something else, if later that pages are used by page caches again the page->private maybe not cleared as expected. Here will check the PG_private bit instead of the folio->private. Cc: [email protected] URL: https://tracker.ceph.com/issues/55421 Signed-off-by: Xiubo Li <[email protected]> Reviewed-by: Luis Henriques <[email protected]> Reviewed-by: Jeff Layton <[email protected]> Signed-off-by: Ilya Dryomov <[email protected]>
1 parent 620239d commit 642d51f

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

fs/ceph/addr.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ static bool ceph_dirty_folio(struct address_space *mapping, struct folio *folio)
8585
if (folio_test_dirty(folio)) {
8686
dout("%p dirty_folio %p idx %lu -- already dirty\n",
8787
mapping->host, folio, folio->index);
88-
BUG_ON(!folio_get_private(folio));
88+
VM_BUG_ON_FOLIO(!folio_test_private(folio), folio);
8989
return false;
9090
}
9191

@@ -122,7 +122,7 @@ static bool ceph_dirty_folio(struct address_space *mapping, struct folio *folio)
122122
* Reference snap context in folio->private. Also set
123123
* PagePrivate so that we get invalidate_folio callback.
124124
*/
125-
BUG_ON(folio_get_private(folio));
125+
VM_BUG_ON_FOLIO(folio_test_private(folio), folio);
126126
folio_attach_private(folio, snapc);
127127

128128
return ceph_fscache_dirty_folio(mapping, folio);
@@ -150,7 +150,7 @@ static void ceph_invalidate_folio(struct folio *folio, size_t offset,
150150
}
151151

152152
WARN_ON(!folio_test_locked(folio));
153-
if (folio_get_private(folio)) {
153+
if (folio_test_private(folio)) {
154154
dout("%p invalidate_folio idx %lu full dirty page\n",
155155
inode, folio->index);
156156

@@ -729,8 +729,11 @@ static void writepages_finish(struct ceph_osd_request *req)
729729

730730
/* clean all pages */
731731
for (i = 0; i < req->r_num_ops; i++) {
732-
if (req->r_ops[i].op != CEPH_OSD_OP_WRITE)
732+
if (req->r_ops[i].op != CEPH_OSD_OP_WRITE) {
733+
pr_warn("%s incorrect op %d req %p index %d tid %llu\n",
734+
__func__, req->r_ops[i].op, req, i, req->r_tid);
733735
break;
736+
}
734737

735738
osd_data = osd_req_op_extent_osd_data(req, i);
736739
BUG_ON(osd_data->type != CEPH_OSD_DATA_TYPE_PAGES);

0 commit comments

Comments
 (0)