Memory leak in ZFS?

Kostik Belousov kostikbel at gmail.com
Tue Feb 8 21:37:26 UTC 2011


On Wed, Feb 09, 2011 at 12:22:01AM +0300, Emil Muratov wrote:
> >Try this. I the similar fix is needed for tmpfs, but there are some
> >more issues and pending rewrite, so I decided not to touch it.
> >
> >commit 8e5885bce1afecd419e40240a2d7ab90deb0392a
> >Author: Konstantin Belousov <kostik at pooma.home>
> >Date:   Tue Feb 8 22:35:29 2011 +0200
> >
> >    Do not forget to activate the page
> >
> >diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c  
> >b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
> >index e8191b3..7343c72 100644
> >--- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
> >+++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
> 
> 
> What is this patch up against? I can't apply it to the STABLE. :(
HEAD.

I adopted the patch to stable/8, but did not even compiled it.

Index: cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
===================================================================
--- cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c	(revision 218456)
+++ cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c	(working copy)
@@ -347,6 +347,9 @@ page_unlock(vm_page_t pp)
 {
 
 	vm_page_wakeup(pp);
+	vm_page_lock_queues();
+	vm_page_activate(pp);
+	vm_page_unlock_queues();
 }
 
 static caddr_t
@@ -465,7 +468,7 @@ again:
 			if (error == 0)
 				uiomove_fromphys(&m, off, bytes, uio);
 			VM_OBJECT_LOCK(obj);
-			vm_page_wakeup(m);
+			page_unlock(m);
 		} else if (uio->uio_segflg == UIO_NOCOPY) {
 			/*
 			 * The code below is here to make sendfile(2) work
@@ -504,10 +507,16 @@ again:
 				zfs_unmap_page(sf);
 			}
 			VM_OBJECT_LOCK(obj);
-			if (error == 0)
-				m->valid = VM_PAGE_BITS_ALL;
 			vm_page_io_finish(m);
+			vm_page_lock_queues();
 			if (error == 0) {
+				m->valid = VM_PAGE_BITS_ALL;
+				vm_page_activate(m);
+			} else
+				vm_page_free(m);
+			vm_page_unlock_queues();
+
+			if (error == 0) {
 				uio->uio_resid -= bytes;
 				uio->uio_offset += bytes;
 			}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-fs/attachments/20110208/0218c6ff/attachment.pgp


More information about the freebsd-fs mailing list