From patchwork Thu Apr 18 18:41:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: hubcap@kernel.org X-Patchwork-Id: 10907857 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 A9D531390 for ; Thu, 18 Apr 2019 18:42:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9283A285DB for ; Thu, 18 Apr 2019 18:42:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 86F9B28D5E; Thu, 18 Apr 2019 18:42:56 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 27CDA285DB for ; Thu, 18 Apr 2019 18:42:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389997AbfDRSmz (ORCPT ); Thu, 18 Apr 2019 14:42:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:60734 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389983AbfDRSmy (ORCPT ); Thu, 18 Apr 2019 14:42:54 -0400 Received: from localhost.localdomain (unknown [24.213.116.99]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E05192186A; Thu, 18 Apr 2019 18:42:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555612973; bh=T9xNwwoTXM3UEnf0o6svaPYx6etKJbi2Np75OhEOn60=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bdbXE0K1hQ6eZ/XWbtPiERour/XM/mzxlbCT1RX2jIV+SqV14l8/q+L3/QslPRBdZ AfPlyFe1UwWmGOvip0hc1b/uGIRsAF8NgeLBJMZ8FLPyQOCRXVNWA3BLTL1tzCuLo6 Hyffw5Gw0SG3a9qjbJYvAIUQh4P9zRtKLUmrhj/Y= From: hubcap@kernel.org To: linux-fsdevel@vger.kernel.org, christoph@lameter.com Cc: Martin Brandenburg , Mike Marshall Subject: [PATCH 10/22] orangefs: service ops done for writeback are not killable Date: Thu, 18 Apr 2019 14:41:02 -0400 Message-Id: <20190418184113.9152-11-hubcap@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190418184113.9152-1-hubcap@kernel.org> References: <20190418184113.9152-1-hubcap@kernel.org> 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 From: Martin Brandenburg Signed-off-by: Martin Brandenburg Signed-off-by: Mike Marshall --- fs/orangefs/orangefs-kernel.h | 1 + fs/orangefs/orangefs-utils.c | 2 +- fs/orangefs/waitqueue.c | 18 ++++++++++-------- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/fs/orangefs/orangefs-kernel.h b/fs/orangefs/orangefs-kernel.h index a74d9e8c5f9e..46b9ad1d2a9b 100644 --- a/fs/orangefs/orangefs-kernel.h +++ b/fs/orangefs/orangefs-kernel.h @@ -442,6 +442,7 @@ extern const struct dentry_operations orangefs_dentry_operations; #define ORANGEFS_OP_CANCELLATION 4 /* this is a cancellation */ #define ORANGEFS_OP_NO_MUTEX 8 /* don't acquire request_mutex */ #define ORANGEFS_OP_ASYNC 16 /* Queue it, but don't wait */ +#define ORANGEFS_OP_WRITEBACK 32 int service_operation(struct orangefs_kernel_op_s *op, const char *op_name, diff --git a/fs/orangefs/orangefs-utils.c b/fs/orangefs/orangefs-utils.c index a4fac527f85d..9221c4a3398e 100644 --- a/fs/orangefs/orangefs-utils.c +++ b/fs/orangefs/orangefs-utils.c @@ -430,7 +430,7 @@ int orangefs_inode_setattr(struct inode *inode) spin_unlock(&inode->i_lock); ret = service_operation(new_op, __func__, - get_interruptible_flag(inode)); + get_interruptible_flag(inode) | ORANGEFS_OP_WRITEBACK); gossip_debug(GOSSIP_UTILS_DEBUG, "orangefs_inode_setattr: returning %d\n", ret); if (ret) diff --git a/fs/orangefs/waitqueue.c b/fs/orangefs/waitqueue.c index 0729d2645d6a..beafc33d57be 100644 --- a/fs/orangefs/waitqueue.c +++ b/fs/orangefs/waitqueue.c @@ -19,7 +19,7 @@ static int wait_for_matching_downcall(struct orangefs_kernel_op_s *op, long timeout, - bool interruptible) + int flags) __acquires(op->lock); static void orangefs_clean_up_interrupted_operation(struct orangefs_kernel_op_s *op) __releases(op->lock); @@ -143,9 +143,7 @@ int service_operation(struct orangefs_kernel_op_s *op, if (!(flags & ORANGEFS_OP_NO_MUTEX)) mutex_unlock(&orangefs_request_mutex); - ret = wait_for_matching_downcall(op, timeout, - flags & ORANGEFS_OP_INTERRUPTIBLE); - + ret = wait_for_matching_downcall(op, timeout, flags); gossip_debug(GOSSIP_WAIT_DEBUG, "%s: wait_for_matching_downcall returned %d for %p\n", __func__, @@ -319,10 +317,12 @@ static void */ static int wait_for_matching_downcall(struct orangefs_kernel_op_s *op, long timeout, - bool interruptible) + int flags) __acquires(op->lock) { long n; + int writeback = flags & ORANGEFS_OP_WRITEBACK, + interruptible = flags & ORANGEFS_OP_INTERRUPTIBLE; /* * There's a "schedule_timeout" inside of these wait @@ -330,10 +330,12 @@ static int wait_for_matching_downcall(struct orangefs_kernel_op_s *op, * user process that needs something done and is being * manipulated by the client-core process. */ - if (interruptible) + if (writeback) + n = wait_for_completion_io_timeout(&op->waitq, timeout); + else if (!writeback && interruptible) n = wait_for_completion_interruptible_timeout(&op->waitq, - timeout); - else + timeout); + else /* !writeback && !interruptible but compiler complains */ n = wait_for_completion_killable_timeout(&op->waitq, timeout); spin_lock(&op->lock);