8.1-STABLE: zfs and sendfile: problem still exists
Andriy Gapon
avg at icyb.net.ua
Sun Oct 31 05:59:51 UTC 2010
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 <sys/sf_buf.h>
>> #include <sys/sched.h>
>> #include <sys/acl.h>
>> +#include <vm/vm_pageout.h>
>>
>> /*
>> * 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
More information about the freebsd-fs
mailing list