Commit 019dd669 authored by Bob Peterson's avatar Bob Peterson
Browse files

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: default avatarBob Peterson <rpeterso@redhat.com>
parent ca399c96
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -805,10 +805,15 @@ int gfs2_releasepage(struct page *page, gfp_t gfp_mask)
		bd = bh->b_private;
		if (bd) {
			gfs2_assert_warn(sdp, bd->bd_bh == bh);
			if (!list_empty(&bd->bd_list))
				list_del_init(&bd->bd_list);
			bd->bd_bh = NULL;
			bh->b_private = NULL;
			/*
			 * The bd may still be queued as a revoke, in which
			 * case we must not dequeue nor free it.
			 */
			if (!bd->bd_blkno && !list_empty(&bd->bd_list))
				list_del_init(&bd->bd_list);
			if (list_empty(&bd->bd_list))
				kmem_cache_free(gfs2_bufdata_cachep, bd);
		}