Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 08 Feb 2011 22:51:56 +0100
From:      Bartosz Stec <admin@kkip.pl>
To:        Kostik Belousov <kostikbel@gmail.com>
Cc:        freebsd-fs@freebsd.org
Subject:   Re: Memory leak in ZFS?
Message-ID:  <4D51BAFC.50806@kkip.pl>
In-Reply-To: <20110208213721.GE78089@deviant.kiev.zoral.com.ua>
References:  <AANLkTi=8fFwiaQ4%2Bm_cWFkXwpa4_W0_DDV2aW8vyNU4E@mail.gmail.com> <op.vqjyb21daevz08@ghost-pc.home.lan> <4D510BBB.1060708@kkip.pl> <20110208102727.GA8555@icarus.home.lan> <4D511F65.2050503@kkip.pl> <4D519F97.2000805@kkip.pl> <20110208203653.GC78089@deviant.kiev.zoral.com.ua> <op.vqlsazg6aevz08@ghost-pc.home.lan> <20110208213721.GE78089@deviant.kiev.zoral.com.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
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@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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4D51BAFC.50806>