From patchwork Thu Sep 26 13:21:19 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kirill Tkhai X-Patchwork-Id: 278191 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 33F722C0196 for ; Thu, 26 Sep 2013 23:27:58 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751080Ab3IZN15 (ORCPT ); Thu, 26 Sep 2013 09:27:57 -0400 Received: from forward12.mail.yandex.net ([95.108.130.94]:48666 "EHLO forward12.mail.yandex.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750764Ab3IZN14 (ORCPT ); Thu, 26 Sep 2013 09:27:56 -0400 X-Greylist: delayed 394 seconds by postgrey-1.27 at vger.kernel.org; Thu, 26 Sep 2013 09:27:56 EDT Received: from web5j.yandex.ru (web5j.yandex.ru [5.45.198.46]) by forward12.mail.yandex.net (Yandex) with ESMTP id 77984C204C6; Thu, 26 Sep 2013 17:21:20 +0400 (MSK) Received: from 127.0.0.1 (localhost [127.0.0.1]) by web5j.yandex.ru (Yandex) with ESMTP id E7D7A268001A; Thu, 26 Sep 2013 17:21:19 +0400 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1380201680; bh=IBxMRTkrcQDw85EXnWRuLZJCOI1luvX1t754zhHSBjI=; h=From:To:Cc:Subject:Date; b=jCoP0XJaVKLBdLNwY4B8C88GZGE3ehaH+OH0W0V0rJnGwOWQhouHbwZJtddpfh5YG X85lCzOgEQuVqTtGJxm4pdmsKBBtpsTvTolgvD39qS6NLiSiD3LtA5wbyUfBy72hYu pCp1ThwQCoqwEMRbU8ZRx+mocvUfleQrCvhLL4Tk= Received: from ns.ineum.ru (ns.ineum.ru [213.247.249.139]) by web5j.yandex.ru with HTTP; Thu, 26 Sep 2013 17:21:19 +0400 From: Kirill Tkhai To: Tejun Heo Cc: linux-ide@vger.kernel.org Subject: [PATCH] ata_port_wait_eh(): Change irqsave into unconditional closing of interrupts MIME-Version: 1.0 Message-Id: <1491380201679@web5j.yandex.ru> X-Mailer: Yamail [ http://yandex.ru ] 5.0 Date: Thu, 26 Sep 2013 17:21:19 +0400 Sender: linux-ide-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ide@vger.kernel.org Hi, ata_port_wait_eh() uses spin_lock_irqsave() and this can confuse in fact that it is suitable to use in irqs_disabled() context. But we can't. (schedule() returns with interrupts enabled so it's possible ata_port_wait_eh() enters with disabled interrupts but returns with enabled) So, replace irqsave to unconditional closing of interrupts. I propose to consider to add patch like this. (If you don't have a magic with flags which is not obvious for me :) Signed-off-by: Kirill Tkhai --- drivers/ata/libata-eh.c | 9 ++++----- 1 files changed, 4 insertions(+), 5 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-ide" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index c69fcce..502c1f9 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c @@ -841,21 +841,20 @@ EXPORT_SYMBOL_GPL(ata_scsi_port_error_handler); */ void ata_port_wait_eh(struct ata_port *ap) { - unsigned long flags; DEFINE_WAIT(wait); retry: - spin_lock_irqsave(ap->lock, flags); + spin_lock_irq(ap->lock); while (ap->pflags & (ATA_PFLAG_EH_PENDING | ATA_PFLAG_EH_IN_PROGRESS)) { prepare_to_wait(&ap->eh_wait_q, &wait, TASK_UNINTERRUPTIBLE); - spin_unlock_irqrestore(ap->lock, flags); + spin_unlock_irq(ap->lock); schedule(); - spin_lock_irqsave(ap->lock, flags); + spin_lock_irq(ap->lock); } finish_wait(&ap->eh_wait_q, &wait); - spin_unlock_irqrestore(ap->lock, flags); + spin_unlock_irq(ap->lock); /* make sure SCSI EH is complete */ if (scsi_host_in_recovery(ap->scsi_host)) {