public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] free temporary cursor in xfs_dialloc
@ 2009-10-14  3:55 Eric Sandeen
  2009-10-14  3:59 ` [PATCH V2] " Eric Sandeen
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Sandeen @ 2009-10-14  3:55 UTC (permalink / raw)
  To: xfs-oss; +Cc: Christoph Hellwig, Alex Elder

Commit bd169565993b39b9b4b102cdac8b13e0a259ce2f seems
to have a slight regression where this code path:

	if (!--searchdistance) {
		/*
		 * Not in range - save last search
		 * location and allocate a new inode
		 */
		...
		goto newino;
	}

doesn't free the temporary cursor (tcur) that got dup'd in
this function.

This leaks an item in the xfs_btree_cur zone, and it's caught
on module unload:

===========================================================
BUG xfs_btree_cur: Objects remaining on kmem_cache_close()
-----------------------------------------------------------

It seems like maybe a single free at the end of the function might
be cleaner, but for now put a del_cursor right in this code block
similar to the handling in the rest of the function.

Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
---

diff --git a/fs/xfs/xfs_ialloc.c b/fs/xfs/xfs_ialloc.c
index ab64f3e..0785797 100644
--- a/fs/xfs/xfs_ialloc.c
+++ b/fs/xfs/xfs_ialloc.c
@@ -880,6 +880,7 @@ nextag:
 				 * Not in range - save last search
 				 * location and allocate a new inode
 				 */
+				xfs_btree_del_cursor(tcur, XFS_BTREE_NOERROR);
 				pag->pagl_leftrec = trec.ir_startino;
 				pag->pagl_rightrec = rec.ir_startino;
 				pag->pagl_pagino = pagino;

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH V2] free temporary cursor in xfs_dialloc
  2009-10-14  3:55 [PATCH] free temporary cursor in xfs_dialloc Eric Sandeen
@ 2009-10-14  3:59 ` Eric Sandeen
  2009-10-14 13:13   ` Christoph Hellwig
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Sandeen @ 2009-10-14  3:59 UTC (permalink / raw)
  To: xfs-oss; +Cc: Christoph Hellwig, Alex Elder

Commit bd169565993b39b9b4b102cdac8b13e0a259ce2f seems
to have a slight regression where this code path:

    if (!--searchdistance) {
        /*
         * Not in range - save last search
         * location and allocate a new inode
         */
        ...
        goto newino;
    }

doesn't free the temporary cursor (tcur) that got dup'd in
this function.

This leaks an item in the xfs_btree_cur zone, and it's caught
on module unload:

===========================================================
BUG xfs_btree_cur: Objects remaining on kmem_cache_close()
-----------------------------------------------------------

It seems like maybe a single free at the end of the function might
be cleaner, but for now put a del_cursor right in this code block
similar to the handling in the rest of the function.

Signed-off-by: Eric Sandeen <sandeen@sandeen.net>

---

(V2 w/o whitespace mangling, ugh)

diff --git a/fs/xfs/xfs_ialloc.c b/fs/xfs/xfs_ialloc.c
index ab64f3e..0785797 100644
--- a/fs/xfs/xfs_ialloc.c
+++ b/fs/xfs/xfs_ialloc.c
@@ -880,6 +880,7 @@ nextag:
 				 * Not in range - save last search
 				 * location and allocate a new inode
 				 */
+				xfs_btree_del_cursor(tcur, XFS_BTREE_NOERROR);
 				pag->pagl_leftrec = trec.ir_startino;
 				pag->pagl_rightrec = rec.ir_startino;
 				pag->pagl_pagino = pagino;

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH V2] free temporary cursor in xfs_dialloc
  2009-10-14  3:59 ` [PATCH V2] " Eric Sandeen
@ 2009-10-14 13:13   ` Christoph Hellwig
  0 siblings, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2009-10-14 13:13 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: Christoph Hellwig, Alex Elder, xfs-oss

Thanks Eric,

the patch looks correct to me, this was the only path in that area not
freeing the tcur (or freeing cur and assigning tcur to cur) before
jumping to newino/alloc_inode.

Reviewed-by: Christoph Hellwig <hch@lst.de>

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-10-14 13:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-14  3:55 [PATCH] free temporary cursor in xfs_dialloc Eric Sandeen
2009-10-14  3:59 ` [PATCH V2] " Eric Sandeen
2009-10-14 13:13   ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox