Date: Thu, 18 Jun 2026 04:40:00 +0000 From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 7d69db2f49d9 - stable/15 - ntsync(9): properly handle timeouts Message-ID: <6a3376a0.1d8c0.29f17a9a@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch stable/15 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=7d69db2f49d924342cf0ba2eda0af16592db3811 commit 7d69db2f49d924342cf0ba2eda0af16592db3811 Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2026-06-15 00:59:46 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2026-06-17 18:24:57 +0000 ntsync(9): properly handle timeouts (cherry picked from commit 96759ab67a42226679675e24e35549aea2aa49e0) --- sys/dev/ntsync/ntsync.c | 16 ++++++++++++---- sys/dev/ntsync/ntsyncvar.h | 1 + 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/sys/dev/ntsync/ntsync.c b/sys/dev/ntsync/ntsync.c index a7b002de7cb6..2d3054e0a4ee 100644 --- a/sys/dev/ntsync/ntsync.c +++ b/sys/dev/ntsync/ntsync.c @@ -215,7 +215,7 @@ ntsync_wait_locked(struct ntsync_wait_state *state, struct thread *td) if (state->ready) break; error = msleep_sbt(state, &state->owner->lock, - PCATCH, "ntsync", state->sb, 0, + PCATCH, "ntsync", state->sb, state->prec, C_ABSOLUTE /* | C_HARDCLOCK XXXKIB */); /* @@ -1195,7 +1195,6 @@ ntsync_wait_state_get(struct ntsync_wait_args *nwa, u_long cmd, { struct ntsync_wait_state *state; struct ntsync_obj *obj; - struct bintime btb; int error, i, j; if (nwa->count > NTSYNC_MAX_WAIT_COUNT) @@ -1270,14 +1269,23 @@ ntsync_wait_state_get(struct ntsync_wait_args *nwa, u_long cmd, } } + state->prec = 0; if (nwa->timeout == UINT64_MAX) { state->sb = 0; } else { state->sb = nstosbt(nwa->timeout); if ((nwa->flags & NTSYNC_WAIT_REALTIME) != 0) { - getboottimebin(&btb); - state->sb += bttosbt(btb); + struct bintime btb; + + bintime(&btb); + state->sb -= bttosbt(btb); + } else { + struct timespec ts; + + nanouptime(&ts); + state->sb -= tstosbt(ts); } + state->sb += sbinuptime(); } *statep = state; diff --git a/sys/dev/ntsync/ntsyncvar.h b/sys/dev/ntsync/ntsyncvar.h index fd875588e889..97828c99bb7d 100644 --- a/sys/dev/ntsync/ntsyncvar.h +++ b/sys/dev/ntsync/ntsyncvar.h @@ -81,6 +81,7 @@ struct ntsync_wait_state { struct ntsync_obj *objs[NTSYNC_MAX_WAIT_COUNT + 1]; struct ntsync_obj_event *alert_event; sbintime_t sb; + sbintime_t prec; int error; int index; bool any;home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a3376a0.1d8c0.29f17a9a>
