Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 29 Dec 2008 12:45:11 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r186563 - in head/sys: compat/linprocfs fs/procfs kern
Message-ID:  <200812291245.mBTCjBUn057535@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Mon Dec 29 12:45:11 2008
New Revision: 186563
URL: http://svn.freebsd.org/changeset/base/186563

Log:
  vm_map_lock_read() does not increment map->timestamp, so we should
  compare map->timestamp with saved timestamp after map read lock is
  reacquired, not with saved timestamp + 1. The only consequence of the +1
  was unconditional lookup of the next map entry, though.
  
  Tested by:	pho
  Approved by:	des
  MFC after:	2 weeks

Modified:
  head/sys/compat/linprocfs/linprocfs.c
  head/sys/fs/procfs/procfs_map.c
  head/sys/kern/kern_proc.c

Modified: head/sys/compat/linprocfs/linprocfs.c
==============================================================================
--- head/sys/compat/linprocfs/linprocfs.c	Mon Dec 29 12:41:32 2008	(r186562)
+++ head/sys/compat/linprocfs/linprocfs.c	Mon Dec 29 12:45:11 2008	(r186563)
@@ -980,7 +980,7 @@ linprocfs_doprocmaps(PFS_FILL_ARGS)
 			error = 0;
 			break;
 		}
-		if (last_timestamp + 1 != map->timestamp) {
+		if (last_timestamp != map->timestamp) {
 			/*
 			 * Look again for the entry because the map was
 			 * modified while it was unlocked.  Specifically,

Modified: head/sys/fs/procfs/procfs_map.c
==============================================================================
--- head/sys/fs/procfs/procfs_map.c	Mon Dec 29 12:41:32 2008	(r186562)
+++ head/sys/fs/procfs/procfs_map.c	Mon Dec 29 12:45:11 2008	(r186563)
@@ -224,7 +224,7 @@ procfs_doprocmap(PFS_FILL_ARGS)
 			error = 0;
 			break;
 		}
-		if (last_timestamp + 1 != map->timestamp) {
+		if (last_timestamp != map->timestamp) {
 			/*
 			 * Look again for the entry because the map was
 			 * modified while it was unlocked.  Specifically,

Modified: head/sys/kern/kern_proc.c
==============================================================================
--- head/sys/kern/kern_proc.c	Mon Dec 29 12:41:32 2008	(r186562)
+++ head/sys/kern/kern_proc.c	Mon Dec 29 12:45:11 2008	(r186563)
@@ -1500,7 +1500,7 @@ sysctl_kern_proc_ovmmap(SYSCTL_HANDLER_A
 		vm_map_lock_read(map);
 		if (error)
 			break;
-		if (last_timestamp + 1 != map->timestamp) {
+		if (last_timestamp != map->timestamp) {
 			vm_map_lookup_entry(map, addr - 1, &tmp_entry);
 			entry = tmp_entry;
 		}
@@ -1677,7 +1677,7 @@ sysctl_kern_proc_vmmap(SYSCTL_HANDLER_AR
 		vm_map_lock_read(map);
 		if (error)
 			break;
-		if (last_timestamp + 1 != map->timestamp) {
+		if (last_timestamp != map->timestamp) {
 			vm_map_lookup_entry(map, addr - 1, &tmp_entry);
 			entry = tmp_entry;
 		}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200812291245.mBTCjBUn057535>