From owner-freebsd-stable@FreeBSD.ORG Sun Oct 31 05:59:51 2010 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C5B0A106564A; Sun, 31 Oct 2010 05:59:51 +0000 (UTC) (envelope-from avg@icyb.net.ua) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id D5E918FC08; Sun, 31 Oct 2010 05:59:50 +0000 (UTC) Received: from porto.topspin.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id HAA29149; Sun, 31 Oct 2010 07:59:45 +0200 (EET) (envelope-from avg@icyb.net.ua) Received: from localhost.topspin.kiev.ua ([127.0.0.1]) by porto.topspin.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1PCQxE-000OpJ-RK; Sun, 31 Oct 2010 07:59:44 +0200 Message-ID: <4CCD05CF.8080301@icyb.net.ua> Date: Sun, 31 Oct 2010 07:59:43 +0200 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.2.12) Gecko/20101029 Lightning/1.0b2 Thunderbird/3.1.6 MIME-Version: 1.0 To: Kostik Belousov References: <4CCAF0EB.4080001@icyb.net.ua> <20101029175105.GB18613@two.kliksys.ru> <4CCBD443.7010305@icyb.net.ua> <4CCBD46E.9030200@icyb.net.ua> <4CCBD661.3000204@freebsd.org> <4CCBEAF6.2030408@freebsd.org> <20101030101254.GB79691@two.kliksys.ru> <4CCBF45C.4080208@icyb.net.ua> <20101030112520.GD79691@two.kliksys.ru> <4CCC2F2A.7020809@icyb.net.ua> <20101030233739.GE2392@deviant.kiev.zoral.com.ua> In-Reply-To: <20101030233739.GE2392@deviant.kiev.zoral.com.ua> X-Enigmail-Version: 1.1.2 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: freebsd-fs@freebsd.org, freebsd-stable@freebsd.org, Artemiev Igor Subject: Re: 8.1-STABLE: zfs and sendfile: problem still exists X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Oct 2010 05:59:51 -0000 on 31/10/2010 02:37 Kostik Belousov said the following: > On Sat, Oct 30, 2010 at 05:43:54PM +0300, Andriy Gapon wrote: >> on 30/10/2010 14:25 Artemiev Igor said the following: >>> On Sat, Oct 30, 2010 at 01:33:00PM +0300, Andriy Gapon wrote: >>>> on 30/10/2010 13:12 Artemiev Igor said the following: >>>>> On Sat, Oct 30, 2010 at 12:52:54PM +0300, Andriy Gapon wrote: >>>>> >>>>>> Heh, next try. >>>>> >>>>> Got a panic, "vm_page_unwire: invalid wire count: 0" >>>> >>>> Oh, thank you for testing - forgot another piece (VM_ALLOC_WIRE for vm_page_alloc): >>> >>> Yep, it work. But VM_ALLOC_WIRE not exists in RELENG_8, therefore i slightly modified your patch: >> >> I apologize for my haste, it should have been VM_ALLOC_WIRED. >> Here is a corrected patch: >> Index: sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c >> =================================================================== >> --- sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c (revision 214318) >> +++ sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c (working copy) >> @@ -67,6 +67,7 @@ >> #include >> #include >> #include >> +#include >> >> /* >> * Programming rules. >> @@ -464,7 +465,7 @@ >> uiomove_fromphys(&m, off, bytes, uio); >> VM_OBJECT_LOCK(obj); >> vm_page_wakeup(m); >> - } else if (m != NULL && uio->uio_segflg == UIO_NOCOPY) { >> + } else if (uio->uio_segflg == UIO_NOCOPY) { >> /* >> * The code below is here to make sendfile(2) work >> * correctly with ZFS. As pointed out by ups@ >> @@ -474,9 +475,23 @@ >> */ >> KASSERT(off == 0, >> ("unexpected offset in mappedread for sendfile")); >> - if (vm_page_sleep_if_busy(m, FALSE, "zfsmrb")) >> + if (m != NULL && vm_page_sleep_if_busy(m, FALSE, "zfsmrb")) >> goto again; >> - vm_page_busy(m); >> + if (m == NULL) { >> + m = vm_page_alloc(obj, OFF_TO_IDX(start), >> + VM_ALLOC_NOBUSY | VM_ALLOC_WIRED | VM_ALLOC_NORMAL); >> + if (m == NULL) { >> + VM_OBJECT_UNLOCK(obj); >> + VM_WAIT; >> + VM_OBJECT_LOCK(obj); >> + goto again; >> + } >> + } else { >> + vm_page_lock_queues(); >> + vm_page_wire(m); >> + vm_page_unlock_queues(); >> + } >> + vm_page_io_start(m); > Why wiring the page if it is busied ? Eh? Because it is not? -- Andriy Gapon