svn commit: r346640 - in projects/fuse2/sys: fs/fuse kern
Alan Somers
asomers at FreeBSD.org
Tue Sep 3 14:07:28 UTC 2019
Author: asomers
Date: Wed Apr 24 15:54:18 2019
New Revision: 346640
URL: https://svnweb.freebsd.org/changeset/base/346640
Log:
fusefs: interruptibility improvements suggested by kib
* Block stop signals in fticket_wait_answer
* Hold ps_mtx while checking signal disposition
* style(9) changes
PR: 346357
Reported by: kib
Sponsored by: The FreeBSD Foundation
Modified:
projects/fuse2/sys/fs/fuse/fuse_ipc.c
projects/fuse2/sys/kern/kern_sig.c
Modified: projects/fuse2/sys/fs/fuse/fuse_ipc.c
==============================================================================
--- projects/fuse2/sys/fs/fuse/fuse_ipc.c Wed Apr 24 15:35:29 2019 (r346639)
+++ projects/fuse2/sys/fs/fuse/fuse_ipc.c Wed Apr 24 15:54:18 2019 (r346640)
@@ -430,10 +430,11 @@ fticket_wait_answer(struct fuse_ticket *ftick)
{
struct thread *td = curthread;
sigset_t blockedset, oldset;
- int err = 0;
+ int err = 0, stops_deferred;
struct fuse_data *data;
- SIGEMPTYSET(blockedset);
+ SIGEMPTYSET(blockedset);
+ stops_deferred = sigdeferstop(SIGDEFERSTOP_SILENT);
kern_sigprocmask(td, SIG_BLOCK, NULL, &oldset, 0);
fuse_lck_mtx_lock(ftick->tk_aw_mtx);
@@ -476,6 +477,7 @@ retry:
* or EAGAIN to the interrupt.
*/
int sig;
+ bool fatal;
SDT_PROBE2(fusefs, , ipc, trace, 4,
"fticket_wait_answer: interrupt");
@@ -485,11 +487,12 @@ retry:
PROC_LOCK(td->td_proc);
mtx_lock(&td->td_proc->p_sigacts->ps_mtx);
sig = cursig(td);
+ fatal = sig_isfatal(td->td_proc, sig);
mtx_unlock(&td->td_proc->p_sigacts->ps_mtx);
PROC_UNLOCK(td->td_proc);
fuse_lck_mtx_lock(ftick->tk_aw_mtx);
- if (!sig_isfatal(td->td_proc, sig)) {
+ if (!fatal) {
/*
* Block the just-delivered signal while we wait for an
* interrupt response
@@ -512,6 +515,7 @@ out:
err = ENXIO;
}
fuse_lck_mtx_unlock(ftick->tk_aw_mtx);
+ sigallowstop(stops_deferred);
return err;
}
Modified: projects/fuse2/sys/kern/kern_sig.c
==============================================================================
--- projects/fuse2/sys/kern/kern_sig.c Wed Apr 24 15:35:29 2019 (r346639)
+++ projects/fuse2/sys/kern/kern_sig.c Wed Apr 24 15:54:18 2019 (r346640)
@@ -929,16 +929,16 @@ osigreturn(struct thread *td, struct osigreturn_args *
#endif
#endif /* COMPAT_43 */
-/* Will this signal be fatal to the current process ? */
+/* Would this signal be fatal to the current process, if it were caught ? */
bool
sig_isfatal(struct proc *p, int sig)
{
intptr_t act;
+ int prop;
+ mtx_assert(&p->p_sigacts->ps_mtx, MA_OWNED);
act = (intptr_t)p->p_sigacts->ps_sigact[_SIG_IDX(sig)];
if ((intptr_t)SIG_DFL == act) {
- int prop;
-
prop = sigprop(sig);
return (0 != (prop & (SIGPROP_KILL | SIGPROP_CORE)));
} else {
More information about the svn-src-projects
mailing list