Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp3757000pxt; Tue, 10 Aug 2021 10:35:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJywms/YW+Mbm7WKA+fq6xq+7Kdgmv+rC0lLCVdB2VP1ter6OAnCWzoC+7IcQdzMNjBEppvX X-Received: by 2002:a17:906:3948:: with SMTP id g8mr28362002eje.282.1628616948945; Tue, 10 Aug 2021 10:35:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628616948; cv=none; d=google.com; s=arc-20160816; b=uPhqQOb84xA2thf+oR85D30Q0/xpDO/gBh515YZn0rmfAM6qIAv8zHOYz+KWxJshLY 3y+/XHPGBcNAekqReOCxelYUh1v+frgnsplgCAotqZTTQIBMb5gfeQzkbh9umxwtD6v6 wPFuG/6M7In2CjLJshQwCYmpdsU3olypbH9Ct+uE0X68ux+zjel9NX/2UlqzM0oH1QcC eLcfp/XvXkq8T2GoAEgCmQci9znrhQxfOJOAhbB4PHPqYjussiAutGoXoOaB8ybxHt68 2D2BH6eh+26eF0QDRWwHl/ncyR10jlRp0rTi+/vojAx7UBEfSzwuutT4bqMgLx69C+Bk q7xQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=tvjQnSPl6w40t4PgF5BWxSGQfxvWmsWZarpsXXv5s6c=; b=Tt4FY221TeYQG0y93SVIwQbagpyCxPIXvfuFD7GuXrKmrGHJOj3fuCopKusHJTHpHh wUj+sRS/qcCtRCFpuGj48UCJHkpfZ8B2HS+qgliZDXHOF0uzHkkFrs0NR9qAN/bWd9sB sinkVoY4xWmr0ShDugZaaaSCiasrtAl2KRCXnxDYNAmaMp/IjIlvzu8D3fTqKh96wf8P Yg5jT0ql8K+6lsiW3DmmqGydccpHhiMbaIwEqLVC/of6nuF5htd7bYxJj/F64EYzfG+e WpOs+Jr+7KDuSA6P9rW4Se6W3pSF0Ionpvp3Ir+TWTG8hDE7kF0I8QEykOZPCwMoSfxE KFeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IJOEi39o; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bv23si21276007ejb.62.2021.08.10.10.35.24; Tue, 10 Aug 2021 10:35:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IJOEi39o; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232191AbhHJRdb (ORCPT + 99 others); Tue, 10 Aug 2021 13:33:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:34268 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232134AbhHJRdE (ORCPT ); Tue, 10 Aug 2021 13:33:04 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A900C61076; Tue, 10 Aug 2021 17:32:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1628616762; bh=Cr5UIL6t6XUtm8+tHN3SpOQIyrfTb7C8IGymWK1WlvA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IJOEi39o6qVvvs23xgswzMKgAm1D5nT4XEX+ynE5uDXSU478Ya6SDR+u8dT9dVWTd lPndUWyYzqLie8Qbq7JmjgH5OEwTF9cdQt53WNxYiD1dOIbe/uKpKA2jHNQAGXLY6l r5o3i6iKZ+Jtfd+qDWfVpaOyJpjs7vZRxs6I/vO8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Li Manyi , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 4.19 08/54] scsi: sr: Return correct event when media event code is 3 Date: Tue, 10 Aug 2021 19:30:02 +0200 Message-Id: <20210810172944.463604205@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210810172944.179901509@linuxfoundation.org> References: <20210810172944.179901509@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Li Manyi [ Upstream commit 5c04243a56a7977185b00400e59ca7e108004faf ] Media event code 3 is defined in the MMC-6 spec as follows: "MediaRemoval: The media has been removed from the specified slot, and the Drive is unable to access the media without user intervention. This applies to media changers only." This indicated that treating the condition as an EJECT_REQUEST was appropriate. However, doing so had the unfortunate side-effect of causing the drive tray to be physically ejected on resume. Instead treat the event as a MEDIA_CHANGE request. Fixes: 7dd753ca59d6 ("scsi: sr: Return appropriate error code when disk is ejected") Link: https://bugzilla.kernel.org/show_bug.cgi?id=213759 Link: https://lore.kernel.org/r/20210726114913.6760-1-limanyi@uniontech.com Signed-off-by: Li Manyi Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/sr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c index acf0c244141f..84dd776d36c3 100644 --- a/drivers/scsi/sr.c +++ b/drivers/scsi/sr.c @@ -217,7 +217,7 @@ static unsigned int sr_get_events(struct scsi_device *sdev) else if (med->media_event_code == 2) return DISK_EVENT_MEDIA_CHANGE; else if (med->media_event_code == 3) - return DISK_EVENT_EJECT_REQUEST; + return DISK_EVENT_MEDIA_CHANGE; return 0; } -- 2.30.2