From owner-svn-src-projects@FreeBSD.ORG Fri Aug 31 00:11:31 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B3B121065670; Fri, 31 Aug 2012 00:11:31 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4861B8FC14; Fri, 31 Aug 2012 00:11:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q7V0BUuA035851; Fri, 31 Aug 2012 00:11:30 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7V0BUvq035849; Fri, 31 Aug 2012 00:11:30 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201208310011.q7V0BUvq035849@svn.freebsd.org> From: Attilio Rao Date: Fri, 31 Aug 2012 00:11:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239930 - projects/fuse/sys/fs/fuse X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Aug 2012 00:11:31 -0000 Author: attilio Date: Fri Aug 31 00:11:30 2012 New Revision: 239930 URL: http://svn.freebsd.org/changeset/base/239930 Log: Mimic Linux behaviour and disable signals delivery for fuse libs user while waiting for deamon notifications. Otherwise the fuse libs user gets interrupted by spourious signals sent by the deamon. In collaboration with: pho Tested by: Gustau Perez i Querol Modified: projects/fuse/sys/fs/fuse/fuse_ipc.c Modified: projects/fuse/sys/fs/fuse/fuse_ipc.c ============================================================================== --- projects/fuse/sys/fs/fuse/fuse_ipc.c Thu Aug 30 23:54:49 2012 (r239929) +++ projects/fuse/sys/fs/fuse/fuse_ipc.c Fri Aug 31 00:11:30 2012 (r239930) @@ -72,6 +72,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include @@ -124,6 +126,27 @@ SYSCTL_INT(_vfs_fuse, OID_AUTO, iov_cred MALLOC_DEFINE(M_FUSEMSG, "fuse_msgbuf", "fuse message buffer"); static uma_zone_t ticket_zone; +static void +fuse_block_sigs(sigset_t *oldset) +{ + sigset_t newset; + + SIGFILLSET(newset); + SIGDELSET(newset, SIGKILL); + if (kern_sigprocmask(curthread, SIG_BLOCK, &newset, oldset, 0)) + panic("%s: Invalid operation for kern_sigprocmask()", + __func__); +} + +static void +fuse_restore_sigs(sigset_t *oldset) +{ + + if (kern_sigprocmask(curthread, SIG_SETMASK, oldset, NULL, 0)) + panic("%s: Invalid operation for kern_sigprocmask()", + __func__); +} + void fiov_init(struct fuse_iov *fiov, size_t size) { @@ -289,6 +312,7 @@ fticket_refresh(struct fuse_ticket *ftic static int fticket_wait_answer(struct fuse_ticket *ftick) { + sigset_t tset; int err = 0; struct fuse_data *data; @@ -305,8 +329,10 @@ fticket_wait_answer(struct fuse_ticket * fticket_set_answered(ftick); goto out; } + fuse_block_sigs(&tset); err = msleep(ftick, &ftick->tk_aw_mtx, PCATCH, "fu_ans", data->daemon_timeout * hz); + fuse_restore_sigs(&tset); if (err == EAGAIN) { /* same as EWOULDBLOCK */ #ifdef XXXIP /* die conditionally */ if (!fdata_get_dead(data)) {