From patchwork Wed Jul 15 11:23:24 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Reinecke X-Patchwork-Id: 6797101 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A7F189F380 for ; Wed, 15 Jul 2015 11:23:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D4E0D2058E for ; Wed, 15 Jul 2015 11:23:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A90A120588 for ; Wed, 15 Jul 2015 11:23:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752353AbbGOLX3 (ORCPT ); Wed, 15 Jul 2015 07:23:29 -0400 Received: from cantor2.suse.de ([195.135.220.15]:37938 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752277AbbGOLX3 (ORCPT ); Wed, 15 Jul 2015 07:23:29 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id E76A1AAD6; Wed, 15 Jul 2015 11:23:27 +0000 (UTC) From: Hannes Reinecke To: Mike Snitzer Cc: Christoph Hellwig , dm-devel@redhat.com, linux-scsi@vger.kernel.org, James Bottomley , Hannes Reinecke Subject: [PATCH] dm-mpath: always return reservation conflict Date: Wed, 15 Jul 2015 13:23:24 +0200 Message-Id: <1436959404-14035-1-git-send-email-hare@suse.de> X-Mailer: git-send-email 1.8.5.2 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If dm-mpath encounters an reservation conflict it should not fail the path (as communication with the target is not affected) but should rather retry on another path. However, in doing so we might be inducing a ping-pong between paths, with no guarantee of any forward progress. And arguably a reservation conflict is an unexpected error, so we should be passing it upwards to allow the application to take appropriate steps. Signed-off-by: Hannes Reinecke --- drivers/md/dm-mpath.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c index 5a67671..e65d266 100644 --- a/drivers/md/dm-mpath.c +++ b/drivers/md/dm-mpath.c @@ -1269,7 +1269,16 @@ static int do_end_io(struct multipath *m, struct request *clone, if (noretry_error(error)) return error; - if (mpio->pgpath) + /* + * EBADE signals an reservation conflict. + * We shouldn't fail the path here as we can communicate with + * the target. We should failover to the next path, but in + * doing so we might be causing a ping-pong between paths. + * So just return the reservation conflict error. + */ + if (error == -EBADE) + r = error; + else if (mpio->pgpath) fail_path(mpio->pgpath); spin_lock_irqsave(&m->lock, flags); @@ -1277,9 +1286,6 @@ static int do_end_io(struct multipath *m, struct request *clone, if (!m->queue_if_no_path) { if (!__must_push_back(m)) r = -EIO; - } else { - if (error == -EBADE) - r = error; } } spin_unlock_irqrestore(&m->lock, flags);