From patchwork Tue Jan 15 10:19:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kirill Tkhai X-Patchwork-Id: 10764243 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F2DF513B5 for ; Tue, 15 Jan 2019 10:19:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E1D4F2B2ED for ; Tue, 15 Jan 2019 10:19:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D57532B2FF; Tue, 15 Jan 2019 10:19:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6A3EF2B2ED for ; Tue, 15 Jan 2019 10:19:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728327AbfAOKTg (ORCPT ); Tue, 15 Jan 2019 05:19:36 -0500 Received: from relay.sw.ru ([185.231.240.75]:36298 "EHLO relay.sw.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726077AbfAOKTg (ORCPT ); Tue, 15 Jan 2019 05:19:36 -0500 Received: from [172.16.25.169] (helo=localhost.localdomain) by relay.sw.ru with esmtp (Exim 4.91) (envelope-from ) id 1gjLoh-00012i-23; Tue, 15 Jan 2019 13:19:31 +0300 Subject: [PATCH 3/7] fuse: Drop and reacquire fc->lock in middle of fuse_abort_conn() From: Kirill Tkhai To: miklos@szeredi.hu, ktkhai@virtuozzo.com, linux-fsdevel@vger.kernel.org Date: Tue, 15 Jan 2019 13:19:30 +0300 Message-ID: <154754757079.4244.14375895153780525981.stgit@localhost.localdomain> In-Reply-To: <154754701031.4244.8089449938935364463.stgit@localhost.localdomain> References: <154754701031.4244.8089449938935364463.stgit@localhost.localdomain> User-Agent: StGit/0.18 MIME-Version: 1.0 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Preparation for next patches. Signed-off-by: Kirill Tkhai --- fs/fuse/dev.c | 7 +++++++ fs/fuse/fuse_i.h | 3 +++ 2 files changed, 10 insertions(+) diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index dd8f019447a9..b393fbedcc1f 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -2231,11 +2231,18 @@ void fuse_abort_conn(struct fuse_conn *fc) kill_fasync(&fiq->fasync, SIGIO, POLL_IN); end_polls(fc); wake_up_all(&fc->blocked_waitq); + fc->aborting = true; spin_unlock(&fc->lock); end_requests(fc, &to_end); + + spin_lock(&fc->lock); + fc->aborting = false; + spin_unlock(&fc->lock); + wake_up_all(&fc->blocked_waitq); } else { spin_unlock(&fc->lock); + wait_event(fc->blocked_waitq, !fc->aborting); } } EXPORT_SYMBOL_GPL(fuse_abort_conn); diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h index 033e30af519f..b5f2265c437c 100644 --- a/fs/fuse/fuse_i.h +++ b/fs/fuse/fuse_i.h @@ -587,6 +587,9 @@ struct fuse_conn { abort and device release */ unsigned connected; + /** Connection abort is in process */ + bool aborting; + /** Connection aborted via sysfs */ bool aborted;