Date: Sat, 5 Nov 2016 10:22:51 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r308332 - stable/10/sys/vm Message-ID: <201611051022.uA5AMp3Y033691@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Sat Nov 5 10:22:51 2016 New Revision: 308332 URL: https://svnweb.freebsd.org/changeset/base/308332 Log: MFC r308094: Add unlock_vp() helper. MFC r308095 (by markj): Add one more use of unlock_vp(). Modified: stable/10/sys/vm/vm_fault.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/vm/vm_fault.c ============================================================================== --- stable/10/sys/vm/vm_fault.c Sat Nov 5 10:09:21 2016 (r308331) +++ stable/10/sys/vm/vm_fault.c Sat Nov 5 10:22:51 2016 (r308332) @@ -153,6 +153,16 @@ unlock_map(struct faultstate *fs) } static void +unlock_vp(struct faultstate *fs) +{ + + if (fs->vp != NULL) { + vput(fs->vp); + fs->vp = NULL; + } +} + +static void unlock_and_deallocate(struct faultstate *fs) { @@ -168,11 +178,8 @@ unlock_and_deallocate(struct faultstate fs->first_m = NULL; } vm_object_deallocate(fs->first_object); - unlock_map(fs); - if (fs->vp != NULL) { - vput(fs->vp); - fs->vp = NULL; - } + unlock_map(fs); + unlock_vp(fs); } static void @@ -320,8 +327,7 @@ RetryFault:; growstack = FALSE; goto RetryFault; } - if (fs.vp != NULL) - vput(fs.vp); + unlock_vp(&fs); return (result); } @@ -338,10 +344,7 @@ RetryFault:; vm_map_lock(fs.map); if (vm_map_lookup_entry(fs.map, vaddr, &fs.entry) && (fs.entry->eflags & MAP_ENTRY_IN_TRANSITION)) { - if (fs.vp != NULL) { - vput(fs.vp); - fs.vp = NULL; - } + unlock_vp(&fs); fs.entry->eflags |= MAP_ENTRY_NEEDS_WAKEUP; vm_map_unlock_and_wait(fs.map, 0); } else @@ -628,10 +631,7 @@ readrest: vp = fs.object->handle; if (vp == fs.vp) goto vnode_locked; - else if (fs.vp != NULL) { - vput(fs.vp); - fs.vp = NULL; - } + unlock_vp(&fs); locked = VOP_ISLOCKED(vp); if (locked != LK_EXCLUSIVE)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201611051022.uA5AMp3Y033691>