Received: by 10.223.176.5 with SMTP id f5csp525561wra; Sat, 27 Jan 2018 04:49:09 -0800 (PST) X-Google-Smtp-Source: AH8x2268eUWXSh7RPn9FvpvElGzbXDRjUS0kdTBKyQEMExCSEIIj8xB5KcSy4vZUxTXG/uQMheuw X-Received: by 10.99.132.200 with SMTP id k191mr17251805pgd.177.1517057349608; Sat, 27 Jan 2018 04:49:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517057349; cv=none; d=google.com; s=arc-20160816; b=IH2JWIevOpArT9L0UNVG2pueZbsQ4OaLOLAGlzWQx6cVpfN9z7MHd3acmBEYNsvSZv qA5RNVJwJ7T1V0rEqXph4aUZ8GpAj85uDdo9NwzL6IgXdZqKcxqrG0DnP+H59kdWJ4fI 8yorZJNELO/Zy/5DSZ5rrOA6hy1CUPOkI3F18AuzjFQimUemOFVRqxvbNGWGfEL85KyM 11s39Z7ZlBXXIVuqvAyKgJXOjrf8nmFlsjNxgTcIy2Q7HYL8Cv6JDgRCnZEgvefJRHW/ f06Tu6OEOjqIFKjkde+N7H9f2GUSA5IUYzuxpDXpewI1DGsr7Ah+Katm6JH9b2xLrvOO Ka5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:to:from :arc-authentication-results; bh=LsqtmIrRhqof+p3lsnjCyC38zaFhItOZ2PtiEhe4jvU=; b=K7HGD9eGAFOXMkLEmMsYx3cFPwaOQPS968BDYRMFXX9nMb9gCbNG7JrHWenNGOlkQN d1GB4484HrIHtmrf6rSew3CGBobjaHLnjbaXAqizxN+BbEbETTcHFzXVjB74AnVk4aeL UpRtxAQ+bTfgI9PSi7WiE3AZeylryp/HmugVnYDs3OjhhC1fFhv4a1vIrN3TFrJzZNHK VHz9l/APlwf8esoPSwOUnQvu4+j0s5XjVpzk7LkY80CdNGbDVBEQueL9UqYI/BFgBJ51 0uNT7nRpN0kd+YawTd6Gz183Xbt4Jhi8CWMatwXJhYgdpXCEJ9/fNviSLAFmMrD9RPfh ybgA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h9si4378228pgq.683.2018.01.27.04.48.53; Sat, 27 Jan 2018 04:49:09 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752725AbeA0Ms1 (ORCPT + 99 others); Sat, 27 Jan 2018 07:48:27 -0500 Received: from mx2.suse.de ([195.135.220.15]:54525 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751620AbeA0MsY (ORCPT ); Sat, 27 Jan 2018 07:48:24 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 6A39EAF14; Sat, 27 Jan 2018 12:40:59 +0000 (UTC) From: Michal Suchanek To: Jens Axboe , Jonathan Corbet , Borislav Petkov , Tim Waugh , "David S. Miller" , "James E.J. Bottomley" , "Martin K. Petersen" , Michal Suchanek , Kees Cook , Christophe JAILLET , Thomas Gleixner , Greg Kroah-Hartman , Kate Stewart , Philippe Ombredanne , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-ide@vger.kernel.org, linux-scsi@vger.kernel.org Subject: [PATCH resend 6/6] cdrom: wait for drive to become ready Date: Fri, 26 Jan 2018 17:58:40 +0100 Message-Id: <42c05eb47f17a2942cb107b5ddb2a6bd402b76e7.1516985620.git.msuchanek@suse.de> X-Mailer: git-send-email 2.13.6 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When the drive closes it can take tens of seconds until the disc is analyzed. Wait for the drive to become ready or report an error. Signed-off-by: Michal Suchanek --- drivers/cdrom/cdrom.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c index 69e85c902373..9994441f5041 100644 --- a/drivers/cdrom/cdrom.c +++ b/drivers/cdrom/cdrom.c @@ -1087,6 +1087,15 @@ int open_for_common(struct cdrom_device_info *cdi, tracktype *tracks) } cd_dbg(CD_OPEN, "the tray is now closed\n"); } + /* the door should be closed now, check for the disc */ + if (ret == CDS_DRIVE_NOT_READY) { + int poll_res = poll_event_interruptible( + CDS_DRIVE_NOT_READY != + (ret = cdo->drive_status(cdi, CDSL_CURRENT)), + 500); + if (poll_res == -ERESTARTSYS) + return poll_res; + } if (ret != CDS_DISC_OK) return -ENOMEDIUM; } -- 2.13.6