From patchwork Wed Jul 26 23:58:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Goldwyn Rodrigues X-Patchwork-Id: 9866043 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B5552602B1 for ; Wed, 26 Jul 2017 23:59:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A65C8287D8 for ; Wed, 26 Jul 2017 23:59:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9AD50287DB; Wed, 26 Jul 2017 23:59:20 +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=-6.9 required=2.0 tests=BAYES_00,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 3B918287D7 for ; Wed, 26 Jul 2017 23:59:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751481AbdGZX6h (ORCPT ); Wed, 26 Jul 2017 19:58:37 -0400 Received: from mx2.suse.de ([195.135.220.15]:46062 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751078AbdGZX6f (ORCPT ); Wed, 26 Jul 2017 19:58:35 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id D5166ADFB; Wed, 26 Jul 2017 23:58:33 +0000 (UTC) From: Goldwyn Rodrigues To: linux-block@vger.kernel.org Cc: hch@infradead.org, jack@suse.cz, linux-raid@vger.kernel.org, dm-devel@redhat.com, Goldwyn Rodrigues Subject: [PATCH 4/9] md: raid5 nowait support Date: Wed, 26 Jul 2017 18:58:01 -0500 Message-Id: <20170726235806.12148-5-rgoldwyn@suse.de> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20170726235806.12148-1-rgoldwyn@suse.de> References: <20170726235806.12148-1-rgoldwyn@suse.de> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Goldwyn Rodrigues Return EAGAIN in case RAID5 would block because of waiting due to: + Reshaping + Suspension + Stripe Expansion Signed-off-by: Goldwyn Rodrigues --- drivers/md/raid5.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index aeeb8d6854e2..d1b3bcf26d29 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -5635,6 +5635,11 @@ static bool raid5_make_request(struct mddev *mddev, struct bio * bi) ? logical_sector < conf->reshape_safe : logical_sector >= conf->reshape_safe) { spin_unlock_irq(&conf->device_lock); + if (bi->bi_opf & REQ_NOWAIT) { + bio_wouldblock_error(bi); + finish_wait(&conf->wait_for_overlap, &w); + return true; + } schedule(); do_prepare = true; goto retry; @@ -5672,6 +5677,11 @@ static bool raid5_make_request(struct mddev *mddev, struct bio * bi) spin_unlock_irq(&conf->device_lock); if (must_retry) { raid5_release_stripe(sh); + if (bi->bi_opf & REQ_NOWAIT) { + bio_wouldblock_error(bi); + finish_wait(&conf->wait_for_overlap, &w); + return true; + } schedule(); do_prepare = true; goto retry; @@ -5700,6 +5710,11 @@ static bool raid5_make_request(struct mddev *mddev, struct bio * bi) sigset_t full, old; sigfillset(&full); sigprocmask(SIG_BLOCK, &full, &old); + if (bi->bi_opf & REQ_NOWAIT) { + bio_wouldblock_error(bi); + finish_wait(&conf->wait_for_overlap, &w); + return true; + } schedule(); sigprocmask(SIG_SETMASK, &old, NULL); do_prepare = true; @@ -5715,6 +5730,11 @@ static bool raid5_make_request(struct mddev *mddev, struct bio * bi) */ md_wakeup_thread(mddev->thread); raid5_release_stripe(sh); + if (bi->bi_opf & REQ_NOWAIT) { + bio_wouldblock_error(bi); + finish_wait(&conf->wait_for_overlap, &w); + return true; + } schedule(); do_prepare = true; goto retry;