From 46691b42ab5b026cd5e79edd4423904a5852765b Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Tue, 10 Feb 2004 12:53:44 +1100 Subject: [PATCH] [XFS] plug a pagebuf leak SGI Modid: xfs-linux:xfs-kern:166109a --- fs/xfs/linux/xfs_buf.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/fs/xfs/linux/xfs_buf.c b/fs/xfs/linux/xfs_buf.c index 44fe9669e59a1..856b31e7a032d 100644 --- a/fs/xfs/linux/xfs_buf.c +++ b/fs/xfs/linux/xfs_buf.c @@ -384,8 +384,8 @@ _pagebuf_freepages( * pagebuf_free releases the specified buffer. The modification * state of any associated pages is left unchanged. */ -void -pagebuf_free( +STATIC void +__pagebuf_free( page_buf_t *pb) { pb_hash_t *hash = pb_hash(pb); @@ -431,6 +431,17 @@ pagebuf_free( pagebuf_deallocate(pb); } +void +pagebuf_free( + page_buf_t *pb) +{ + if (unlikely(!atomic_dec_and_test(&pb->pb_hold))) { + printk(KERN_ERR "XFS: freeing inuse buffer!\n"); + dump_stack(); + } else + __pagebuf_free(pb); +} + /* * _pagebuf_lookup_pages * @@ -1028,7 +1039,7 @@ pagebuf_rele( } if (do_free) { - pagebuf_free(pb); + __pagebuf_free(pb); } } } -- 2.53.0