Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp3760890pxt; Tue, 10 Aug 2021 10:41:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxCwKYA+P79QYd0eTZvyKE8zC+vLVz/3mRiN4QyFGjd45nNf+n0F/F8GMRXRFfbEXnA/LQx X-Received: by 2002:a17:906:af4f:: with SMTP id ly15mr255649ejb.175.1628617300236; Tue, 10 Aug 2021 10:41:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628617300; cv=none; d=google.com; s=arc-20160816; b=bRFolaArp02g2VmcFQLiXC8u9827Ks1jzHX+Tqkn8Z9x4ON6Z0uE9/Gn73ON0UWwBx Ed9eswwbtz/nDezmQGzvt4CbE5mP9PFS4qeWRGM/oIazXurDGgXAx2sbT05rJsISGnpo Svzu67JnX0PtYbzqFK/gySZjs6EZxi7NwkDFubhcMBfSalPMpjpfLwrdeMyYZDRkUPdk BrgICDFLNO4To+YvsK+NIW++t92kubvjRtF+rTCD533dHCt8swz1XIrw2hmHZ6EQGl4G zwsoxu+dSVk8MsuOcWWVCWrQLGPu3YWGPoWa550rZ5jCQznBdhddii6OXgeiRQpuISjp TNlg== 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=NQ/PAY2j4kNmZQ3iTuFjCM7zN87in/psGRTNsGhPpZ8=; b=crGwlXdZMQ8SJF/pIfbhqiYMRYysdMny81v11VqSMzxd95bkapdhmw/VRy56nYcjTu 1dMebXZC8SQxDWzxuPI0QJusQvYhRfH3jdM3Q1JpXg+GafBwQSVgNDSGqGy2KEMwcL65 zkKbeTn7n2mjXSr/THK8i7GqbXT5yj90/6r3jt62WTe7fMkmv/Mh1cdjeWOtEFFNvhMN MFJaEfj6S2bFOx1BnnMqXq08txMZ/k7pV07Ksrf62hnU3xWdnUEJoOrjIbyLcADNbkOF uu6fI/ylEPbmkVhsyP/95xjiSC8L+Z8gowAHOMWNNYSt9MZFyxzqXhbCy7BXjSDlRMYA MnvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2ke4vLxD; 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 p5si21002841edt.311.2021.08.10.10.41.16; Tue, 10 Aug 2021 10:41:40 -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=2ke4vLxD; 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 S234635AbhHJRhi (ORCPT + 99 others); Tue, 10 Aug 2021 13:37:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:35348 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232730AbhHJRgA (ORCPT ); Tue, 10 Aug 2021 13:36:00 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7EA0360EBD; Tue, 10 Aug 2021 17:35:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1628616922; bh=B1Huvc6SGYWvTrb/8b7wJgnUZg9jISGPpiuOqfjJgPE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2ke4vLxDPWq1+HqY+yWXZdUXk2LVYTY9xObNblFHKoeeJIHzNPydxqUpGDreERDMF aaUxcwpokkf1AeO9tFLUQ43jmOgfeIXtavBVHR4WWUHvfPVYcvyz1e/0T89JbxXxto +UiD92LV7cbrU7LFOHHg1OZ6b/t5S4/r6WqoVevg= 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 5.4 17/85] scsi: sr: Return correct event when media event code is 3 Date: Tue, 10 Aug 2021 19:29:50 +0200 Message-Id: <20210810172948.782169058@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210810172948.192298392@linuxfoundation.org> References: <20210810172948.192298392@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 2332b245b182..279dea628620 100644 --- a/drivers/scsi/sr.c +++ b/drivers/scsi/sr.c @@ -219,7 +219,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