git: 09fa4e2293d9 - main - Revert "vm_object: Fix synchronization with teardown in the object list loop"

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Wed, 18 Nov 2026 19:27:42 UTC
The branch main has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=09fa4e2293d964e6c0ec3d14638a3cac51b80b54

commit 09fa4e2293d964e6c0ec3d14638a3cac51b80b54
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2026-11-18 19:27:22 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2026-11-18 19:27:29 +0000

    Revert "vm_object: Fix synchronization with teardown in the object list loop"
    
    This was pushed by accident.
    
    This reverts commit 4e6e4fa8be9940e711b791073eee5bcfa77ec5d4.
---
 sys/vm/vm_object.c | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)

diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c
index b6f5e4983fd4..1e6e25d26a54 100644
--- a/sys/vm/vm_object.c
+++ b/sys/vm/vm_object.c
@@ -2523,7 +2523,7 @@ vm_object_list_handler(struct sysctl_req *req, bool swap_only)
 	vm_object_t obj;
 	vm_page_t m;
 	u_long sp;
-	int count, error, flags;
+	int count, error;
 	key_t key;
 	unsigned short seq;
 	bool want_path;
@@ -2556,13 +2556,12 @@ vm_object_list_handler(struct sysctl_req *req, bool swap_only)
 	 */
 	mtx_lock(&vm_object_list_mtx);
 	TAILQ_FOREACH(obj, &vm_object_list, object_list) {
-		if (obj->type == OBJT_DEAD || (obj->flags & OBJ_DEAD) != 0 ||
+		if (obj->type == OBJT_DEAD ||
 		    (swap_only && (obj->flags & (OBJ_ANON | OBJ_SWAP)) == 0))
 			continue;
 		VM_OBJECT_RLOCK(obj);
-		flags = obj->flags;
-		if (obj->type == OBJT_DEAD || (flags & OBJ_DEAD) != 0 ||
-		    (swap_only && (flags & (OBJ_ANON | OBJ_SWAP)) == 0)) {
+		if (obj->type == OBJT_DEAD ||
+		    (swap_only && (obj->flags & (OBJ_ANON | OBJ_SWAP)) == 0)) {
 			VM_OBJECT_RUNLOCK(obj);
 			continue;
 		}
@@ -2605,7 +2604,7 @@ vm_object_list_handler(struct sysctl_req *req, bool swap_only)
 		    NULL);
 		if (vp != NULL) {
 			vref(vp);
-		} else if ((flags & OBJ_ANON) != 0) {
+		} else if ((obj->flags & OBJ_ANON) != 0) {
 			MPASS(kvo->kvo_type == KVME_TYPE_SWAP);
 			kvo->kvo_me = (uintptr_t)obj;
 			/* tmpfs objs are reported as vnodes */
@@ -2618,18 +2617,13 @@ vm_object_list_handler(struct sysctl_req *req, bool swap_only)
 			    sizeof(kvo->kvo_path));
 		}
 		VM_OBJECT_RUNLOCK(obj);
-
-		/*
-		 * Note, it is safe to invoke shmobjinfo() and shm_get_path()
-		 * concurrent with teardown of the object.
-		 */
-		if ((flags & OBJ_SYSVSHM) != 0) {
+		if ((obj->flags & OBJ_SYSVSHM) != 0) {
 			kvo->kvo_flags |= KVMO_FLAG_SYSVSHM;
 			shmobjinfo(obj, &key, &seq);
 			kvo->kvo_vn_fileid = key;
 			kvo->kvo_vn_fsid_freebsd11 = seq;
 		}
-		if ((flags & OBJ_POSIXSHM) != 0) {
+		if ((obj->flags & OBJ_POSIXSHM) != 0) {
 			kvo->kvo_flags |= KVMO_FLAG_POSIXSHM;
 			shm_get_path(obj, kvo->kvo_path,
 			    sizeof(kvo->kvo_path));