From owner-svn-src-head@freebsd.org Thu May 19 19:27:34 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B9785B3F875; Thu, 19 May 2016 19:27:34 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7ACA51A5F; Thu, 19 May 2016 19:27:34 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4JJRX4Q078703; Thu, 19 May 2016 19:27:33 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4JJRXi4078702; Thu, 19 May 2016 19:27:33 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201605191927.u4JJRXi4078702@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Thu, 19 May 2016 19:27:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300225 - head/sys/vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 May 2016 19:27:34 -0000 Author: alc Date: Thu May 19 19:27:33 2016 New Revision: 300225 URL: https://svnweb.freebsd.org/changeset/base/300225 Log: Clean up the handling of errors from vm_pager_get_pages(). Mostly, this cleanup consists of fixes to comments. However, there is one change to code: Remove special-case handling of errors involving the kernel map. We do not perform I/O on the kernel map, so there is no need for this special case. Reviewed by: kib (an earlier version) Modified: head/sys/vm/vm_fault.c Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Thu May 19 19:13:43 2016 (r300224) +++ head/sys/vm/vm_fault.c Thu May 19 19:27:33 2016 (r300225) @@ -657,48 +657,40 @@ vnode_locked: hardfault++; break; /* break to PAGE HAS BEEN FOUND */ } - /* - * Remove the bogus page (which does not exist at this - * object/offset); before doing so, we must get back - * our object lock to preserve our invariant. - * - * Also wake up any other process that may want to bring - * in this page. - * - * If this is the top-level object, we must leave the - * busy page to prevent another process from rushing - * past us, and inserting the page in that object at - * the same time that we are. - */ if (rv == VM_PAGER_ERROR) printf("vm_fault: pager read error, pid %d (%s)\n", curproc->p_pid, curproc->p_comm); + /* - * Data outside the range of the pager or an I/O error - */ - /* - * XXX - the check for kernel_map is a kludge to work - * around having the machine panic on a kernel space - * fault w/ I/O error. + * If an I/O error occurred or the requested page was + * outside the range of the pager, clean up and return + * an error. */ - if (((fs.map != kernel_map) && (rv == VM_PAGER_ERROR)) || - (rv == VM_PAGER_BAD)) { + if (rv == VM_PAGER_ERROR || rv == VM_PAGER_BAD) { vm_page_lock(fs.m); vm_page_free(fs.m); vm_page_unlock(fs.m); fs.m = NULL; unlock_and_deallocate(&fs); - return ((rv == VM_PAGER_ERROR) ? KERN_FAILURE : KERN_PROTECTION_FAILURE); + return (rv == VM_PAGER_ERROR ? KERN_FAILURE : + KERN_PROTECTION_FAILURE); } + + /* + * The requested page does not exist at this object/ + * offset. Remove the invalid page from the object, + * waking up anyone waiting for it, and continue on to + * the next object. However, if this is the top-level + * object, we must leave the busy page in place to + * prevent another process from rushing past us, and + * inserting the page in that object at the same time + * that we are. + */ if (fs.object != fs.first_object) { vm_page_lock(fs.m); vm_page_free(fs.m); vm_page_unlock(fs.m); fs.m = NULL; - /* - * XXX - we cannot just fall out at this - * point, m has been freed and is invalid! - */ } }