Skip to content

Commit 019dd66

Browse files
committed
gfs2: don't allow releasepage to free bd still used for revokes
Before this patch, function gfs2_releasepage would free any bd elements that had been used for the page being released. However, those bd elements may still be queued to the sd_log_revokes list, in which case we cannot free them until the revoke has been issued. This patch adds additional checks for bds that are still being used for revokes. Signed-off-by: Bob Peterson <[email protected]>
1 parent ca399c9 commit 019dd66

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

fs/gfs2/aops.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -805,11 +805,16 @@ int gfs2_releasepage(struct page *page, gfp_t gfp_mask)
805805
bd = bh->b_private;
806806
if (bd) {
807807
gfs2_assert_warn(sdp, bd->bd_bh == bh);
808-
if (!list_empty(&bd->bd_list))
809-
list_del_init(&bd->bd_list);
810808
bd->bd_bh = NULL;
811809
bh->b_private = NULL;
812-
kmem_cache_free(gfs2_bufdata_cachep, bd);
810+
/*
811+
* The bd may still be queued as a revoke, in which
812+
* case we must not dequeue nor free it.
813+
*/
814+
if (!bd->bd_blkno && !list_empty(&bd->bd_list))
815+
list_del_init(&bd->bd_list);
816+
if (list_empty(&bd->bd_list))
817+
kmem_cache_free(gfs2_bufdata_cachep, bd);
813818
}
814819

815820
bh = bh->b_this_page;

0 commit comments

Comments
 (0)