Index | Thread | Search

From:
Vitaliy Makkoveev <otto@bsdbox.dev>
Subject:
Re: sysctl fill_file shared net lock
To:
Alexander Bluhm <bluhm@openbsd.org>
Cc:
tech@openbsd.org
Date:
Wed, 12 Feb 2025 23:44:20 +0300

Download raw body.

Thread
> On 12 Feb 2025, at 23:07, Alexander Bluhm <bluhm@openbsd.org> wrote:
> 
> Hi,
> 
> FILLINPTABLE() already uses shared net lock for fill_file().  The
> FILLIT() sysctls should do the same instead of exclusive net lock.
> 
> ok?
> 

ok mvs

> bluhm
> 
> Index: kern/kern_sysctl.c
> ===================================================================
> RCS file: /data/mirror/openbsd/cvs/src/sys/kern/kern_sysctl.c,v
> diff -u -p -r1.462 kern_sysctl.c
> --- kern/kern_sysctl.c	14 Jan 2025 18:37:51 -0000	1.462
> +++ kern/kern_sysctl.c	12 Feb 2025 20:01:01 -0000
> @@ -1499,7 +1499,7 @@ fill_file(struct kinfo_file *kf, struct 
> 		if (so == NULL) {
> 			so = (struct socket *)fp->f_data;
> 			/* if so is passed as parameter it is already locked */
> -			solock(so);
> +			solock_shared(so);
> 			locked = 1;
> 		}
> 
> @@ -1523,7 +1523,7 @@ fill_file(struct kinfo_file *kf, struct 
> 			kf->so_splicelen = -1;
> 		if (so->so_pcb == NULL) {
> 			if (locked)
> -				sounlock(so);
> +				sounlock_shared(so);
> 			break;
> 		}
> 		switch (kf->so_family) {
> @@ -1599,7 +1599,7 @@ fill_file(struct kinfo_file *kf, struct 
> 		    }
> 		}
> 		if (locked)
> -			sounlock(so);
> +			sounlock_shared(so);
> 		break;
> 	    }
> 
>