Memory leak in ZFS?
Bartosz Stec
admin at kkip.pl
Tue Feb 8 21:52:09 UTC 2011
W dniu 2011-02-08 22:37, Kostik Belousov pisze:
> 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;
> }
Patching was succesfull
# patch < patch
Hmm... Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|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)
--------------------------
Patching file zfs_vnops.c using Plan A...
Hunk #1 succeeded at 347.
Hunk #2 succeeded at 468.
Hunk #3 succeeded at 507.
Hmm... Ignoring the trailing garbage.
done
Now what's the recommended way to apply above changes to system (without
rebuilding whole universe...)?
--
Bartosz Stec
More information about the freebsd-fs
mailing list