From owner-freebsd-stable@FreeBSD.ORG Sat Oct 30 09:54:16 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 C48D21065670; Sat, 30 Oct 2010 09:54:16 +0000 (UTC) (envelope-from ai@kliksys.ru) Received: from gate.kliksys.ru (gate.kliksys.ru [78.110.241.113]) by mx1.freebsd.org (Postfix) with ESMTP id 6B4C58FC1E; Sat, 30 Oct 2010 09:54:16 +0000 (UTC) Received: from [192.168.0.204] (helo=two.kliksys.ru) by gate.kliksys.ru with esmtp (Exim 4.71 (FreeBSD)) (envelope-from ) id 1PC88c-0007UR-Cg; Sat, 30 Oct 2010 13:54:14 +0400 Date: Sat, 30 Oct 2010 13:54:25 +0400 From: Artemiev Igor To: freebsd-stable@freebsd.org, freebsd-fs@freebsd.org Message-ID: <20101030095425.GA79691@two.kliksys.ru> References: <3D1C350B94A44E5D95BAA1596D1EBF13@vosz.local> <20101029090417.GA17537@two.kliksys.ru> <4CCABFC2.3040701@icyb.net.ua> <4CCADD37.7000306@icyb.net.ua> <20101029152602.GA18613@two.kliksys.ru> <4CCAF0EB.4080001@icyb.net.ua> <20101029175105.GB18613@two.kliksys.ru> <4CCBD443.7010305@icyb.net.ua> <4CCBD46E.9030200@icyb.net.ua> <4CCBD661.3000204@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4CCBD661.3000204@freebsd.org> User-Agent: Mutt/1.5.20 (2009-06-14) X-Spam_score: 0.0 Cc: 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: Sat, 30 Oct 2010 09:54:16 -0000 On Sat, Oct 30, 2010 at 11:25:05AM +0300, Andriy Gapon wrote: > > Note: I have only compile tested the patch. > > Missed one NULL check. > > 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,8 +475,18 @@ > */ > 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; > + if (m == NULL) { > + m = vm_page_alloc(obj, OFF_TO_IDX(start), > + VM_ALLOC_NOBUSY | VM_ALLOC_SYSTEM); > + if (m == NULL) { > + VM_OBJECT_UNLOCK(obj); > + VM_WAIT; > + VM_OBJECT_LOCK(obj); > + goto again; > + } > + } > vm_page_busy(m); > VM_OBJECT_UNLOCK(obj); > if (dirbytes > 0) { Ok, i tested this patch. It worked :) freebsd_zfs_read now calls (file_size/MAXBSIZE) times. Thanks!