Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp3764431pxt; Tue, 10 Aug 2021 10:46:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxe+yQypj0HEjAictk/awRZbJu8+mXGGXFyb3fOAbLDfPMy1/Tbu1/YkdcrfVKAWJWmebRr X-Received: by 2002:aa7:c2d4:: with SMTP id m20mr6395765edp.368.1628617604247; Tue, 10 Aug 2021 10:46:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628617604; cv=none; d=google.com; s=arc-20160816; b=zdq0R0RFT0SFfHD+umiOqNpBJKLnxevJS8beZ2paT09EFkPQXf8IAlaNBCll9XFhmZ AFmzivyvO+GjRF5yzOntIR0/UBXj+zvbL7Ah2744/qdEUmNNvJwiN039HHAfU5WzmNYO kRGQAp2A/1g+eKJXGn3JhS11ZEiulTdIF5a5DpSTekTVL0+5k3rFjdB6K2OlWl3wbbXL VRQk1IrqKhUFLGQCm4RmpuboRJiTU3Do1902YztBFtJwmz5NXw+1ffBMlqBch60MNo/f pq+rkUATXhHZFCMeNLcGN0/vXIyqp7HSdmLH82Fgf2kqVTDiB4t4wIZwOtJ5aE5PR4wI VWKA== 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=qaOfy115I4Tc78blZd5AHYzIEqZsRjf7lmSYeDYrDfg=; b=BKFpKEfCQsPIWD9VABt0hlWBxGfQsK0/IuDm++q2oJWX+CxRx7QE3luJ+fxi2S5upl BXgidn2O+HLorFSXuXf5kSZjWZ79l7B9N6bAPtSmwfkrZ/Q7upoQDrlNKNPsNqYql3Fl ubqpXnQ+SLqhtkPtLk2eavB5C8y5qf1zQyk9Z9LWmKWNXsYDf9YwBn6FPY/nb6k8mRoZ kaHa9wPjIe3j3yaztPm+787CFRCMw6GibkSNpfenVy6VpKoLNHgLIgYxrZJTGU8KXSJP 3aY/LIpOTk8aAF1cKHvU/fROjJIZVNvhAlinE+uyB5qJBwrG4wrieMpBV9bWv7WOBEFB YV6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cYsVRVBb; 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 b3si18493244ejb.219.2021.08.10.10.46.20; Tue, 10 Aug 2021 10:46:44 -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=cYsVRVBb; 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 S232895AbhHJRnO (ORCPT + 99 others); Tue, 10 Aug 2021 13:43:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:59194 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233469AbhHJRjt (ORCPT ); Tue, 10 Aug 2021 13:39:49 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 34BCA611C6; Tue, 10 Aug 2021 17:37:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1628617056; bh=cxvJByPagMpfRpFA5lFwdQ7dBNJGS4nUR3J6IK7apTc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cYsVRVBbGwlU6p9IH0IZdsikzY8AuHhs37Hr/iYUIi85tPGrb1VCDx5AsPjRH9NX7 ntNDW6Pb8XFMT0HlNB51HKBG8zAOmOWMjn/uMkh5hc8KpkvryKpElAvJQ5HMedqWFm esjkWgcuMqdffNXtTAn1QOMnGdBo08xyQOtyB+ZY= 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.10 025/135] scsi: sr: Return correct event when media event code is 3 Date: Tue, 10 Aug 2021 19:29:19 +0200 Message-Id: <20210810172956.529704096@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210810172955.660225700@linuxfoundation.org> References: <20210810172955.660225700@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 726b7048a767..4cb4ab9c6137 100644 --- a/drivers/scsi/sr.c +++ b/drivers/scsi/sr.c @@ -221,7 +221,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