From owner-dev-commits-src-branches@freebsd.org  Fri Apr 16 19:25:58 2021
Return-Path: <owner-dev-commits-src-branches@freebsd.org>
Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id AE1005DC952;
 Fri, 16 Apr 2021 19:25:58 +0000 (UTC) (envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
 client-signature RSA-PSS (4096 bits) client-digest SHA256)
 (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 4FMR5L4Xbjz4kpn;
 Fri, 16 Apr 2021 19:25:58 +0000 (UTC) (envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org
 [IPv6:2610:1c1:1:6068::e6a:5])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
 (Client did not present a certificate)
 by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8EA9624AC;
 Fri, 16 Apr 2021 19:25:58 +0000 (UTC) (envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
 by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 13GJPwwv060255;
 Fri, 16 Apr 2021 19:25:58 GMT (envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
 by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13GJPwsd060254;
 Fri, 16 Apr 2021 19:25:58 GMT (envelope-from git)
Date: Fri, 16 Apr 2021 19:25:58 GMT
Message-Id: <202104161925.13GJPwsd060254@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
 dev-commits-src-branches@FreeBSD.org
From: Richard Scheffenegger <rscheff@FreeBSD.org>
Subject: git: 13d418a967c9 - stable/13 - Export sbuf_drain to orchestrate lock
 and drain action
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: rscheff
X-Git-Repository: src
X-Git-Refname: refs/heads/stable/13
X-Git-Reftype: branch
X-Git-Commit: 13d418a967c90cfd845f41db96383ac7eb5862aa
Auto-Submitted: auto-generated
X-BeenThere: dev-commits-src-branches@freebsd.org
X-Mailman-Version: 2.1.34
Precedence: list
List-Id: Commits to the stable branches of the FreeBSD src repository
 <dev-commits-src-branches.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-branches>, 
 <mailto:dev-commits-src-branches-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-branches/>
List-Post: <mailto:dev-commits-src-branches@freebsd.org>
List-Help: <mailto:dev-commits-src-branches-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-branches>, 
 <mailto:dev-commits-src-branches-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 16 Apr 2021 19:25:58 -0000

The branch stable/13 has been updated by rscheff:

URL: https://cgit.FreeBSD.org/src/commit/?id=13d418a967c90cfd845f41db96383ac7eb5862aa

commit 13d418a967c90cfd845f41db96383ac7eb5862aa
Author:     Richard Scheffenegger <rscheff@FreeBSD.org>
AuthorDate: 2021-03-31 16:25:53 +0000
Commit:     Richard Scheffenegger <rscheff@FreeBSD.org>
CommitDate: 2021-04-16 18:50:48 +0000

    Export sbuf_drain to orchestrate lock and drain action
    
    While exporting large amounts of data to a sysctl
    request, datastructures may need to be locked.
    
    Exporting the sbuf_drain function allows the
    coordination between drain events and held
    locks, to avoid stalls.
    
    PR:             254333
    Reviewed By:    jhb
    MFC after:      2 weeks
    Sponsored by:   NetApp, Inc.
    Differential Revision: https://reviews.freebsd.org/D29481
    
    (cherry picked from commit c804c8f2c58ba42d476de07fbceff9ac4dd95f0e)
---
 sys/kern/subr_sbuf.c | 2 +-
 sys/sys/sbuf.h       | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/sys/kern/subr_sbuf.c b/sys/kern/subr_sbuf.c
index 20a831aa75b2..66822115dbcb 100644
--- a/sys/kern/subr_sbuf.c
+++ b/sys/kern/subr_sbuf.c
@@ -383,7 +383,7 @@ sbuf_set_drain(struct sbuf *s, sbuf_drain_func *func, void *ctx)
 /*
  * Call the drain and process the return.
  */
-static int
+int
 sbuf_drain(struct sbuf *s)
 {
 	int len;
diff --git a/sys/sys/sbuf.h b/sys/sys/sbuf.h
index 10b59f360cd0..d87e3917b84c 100644
--- a/sys/sys/sbuf.h
+++ b/sys/sys/sbuf.h
@@ -95,6 +95,7 @@ int		 sbuf_vprintf(struct sbuf *, const char *, __va_list)
 int		 sbuf_nl_terminate(struct sbuf *);
 int		 sbuf_putc(struct sbuf *, int);
 void		 sbuf_set_drain(struct sbuf *, sbuf_drain_func *, void *);
+int		 sbuf_drain(struct sbuf *);
 int		 sbuf_trim(struct sbuf *);
 int		 sbuf_error(const struct sbuf *);
 int		 sbuf_finish(struct sbuf *);