Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp1055167ybg; Wed, 23 Oct 2019 09:41:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqxKb5MzyYBDtvcL7dmLdFerEmZq0Zltbgh4FRwW/gq1D0TJDxjvGj9lKcS67TxsDCnkVPSX X-Received: by 2002:a17:906:35cb:: with SMTP id p11mr34399360ejb.128.1571848901805; Wed, 23 Oct 2019 09:41:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571848901; cv=none; d=google.com; s=arc-20160816; b=Komu7L5nqpfvM5b3mvwkaNRXuwqulAOY41iLu1VkYrLoEJkl/qnvDHBD7guAdeDRAV KIxjc7dlICbi91fkDffjALvs1E2alQxmoNwVYVXsIvgRT4hraZ2Vm6bD/4kgzv7p2MWA MmozvY5c+Z/Imh+na8dKDnESVCSpztUhDPPEdEQevaRd9eO9NXdT/5DZNRMf9fOXtlJ9 /JggxQMpLQBNJoNqj5tiCBYu+YEzNlADFUeST0nKvmvNYCkYBuIhJZ0x+DboIL2bNyFc kUklE6/ydM5olFdhLE4oQe3vxGODC1gCoy7yOHR7jJvd8go4++6Oa5dT6lqmsCrLvie1 aIHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=6CqrGuOXKFTIc52/YNhGN3nU/SCmqcocAh9Z7PKHOlw=; b=GFBztPg4ifpvgcY/p44lOTjQ5C1Mi+s4qB6sy0E1jKuuiEPP+aJ9yqyw42VEEiHvYq 5MvgZXQbU2AuCCXmI5wgRY7wZDF6BPfEP8lCltkc3eMpqHiyY43zv0ES2LN/DBfYzjRR gLLy1s8eMnfvzTp77s0CcdS8DZj/4RKURyh2d/CI4BXcXqNYyJ/tDWs5nkD9PpojN65t FkWvtMjMa6pAVdILC7GpjGEThP7Fk4wNUcY+CI2xyZwUO8+s6SiCpLGL8RXhYNbpWf9p 8o7ukP7QGdHD8gcBAgL5UEJU08aFi6YroTR0upQ3UJpiRZtFp1wlQhJt0XUrRUuiOxA7 vK5A== 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 j2si14966234edt.108.2019.10.23.09.41.17; Wed, 23 Oct 2019 09:41:41 -0700 (PDT) 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 S2405237AbfJWMTa (ORCPT + 99 others); Wed, 23 Oct 2019 08:19:30 -0400 Received: from mx2.suse.de ([195.135.220.15]:55594 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726636AbfJWMT3 (ORCPT ); Wed, 23 Oct 2019 08:19:29 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 615F3AD1A; Wed, 23 Oct 2019 12:19:27 +0000 (UTC) Date: Wed, 23 Oct 2019 14:19:24 +0200 From: Michal =?iso-8859-1?Q?Such=E1nek?= To: Bart Van Assche Cc: "corbet@lwn.net" , "linux-kernel@vger.kernel.org" , "linux-ide@vger.kernel.org" , "keescook@chromium.org" , "tglx@linutronix.de" , "martin.petersen@oracle.com" , "axboe@kernel.dk" , "linux-scsi@vger.kernel.org" , "kstewart@linuxfoundation.org" , "pombredanne@nexb.com" , "bp@alien8.de" , "gregkh@linuxfoundation.org" , "jejb@linux.vnet.ibm.com" , "christophe.jaillet@wanadoo.fr" , "davem@davemloft.net" , "linux-doc@vger.kernel.org" , "tim@cyberelk.net" Subject: Re: [PATCH resend 3/6] cdrom: wait for tray to close Message-ID: <20191023121924.GD938@kitsune.suse.cz> References: <03915a2e64f50ec04ea6d8e6f80e36ecf16e4f0f.1516985620.git.msuchanek@suse.de> <1517245546.2687.17.camel@wdc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1517245546.2687.17.camel@wdc.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 29, 2018 at 05:05:47PM +0000, Bart Van Assche wrote: > On Fri, 2018-01-26 at 17:58 +0100, Michal Suchanek wrote: > > +static int cdrom_tray_close(struct cdrom_device_info *cdi) > > +{ > > + int ret; > > + > > + ret = cdi->ops->tray_move(cdi, 0); > > + if (ret || !cdi->ops->drive_status) > > + return ret; > > + > > + return poll_event_interruptible(CDS_TRAY_OPEN != > > + cdi->ops->drive_status(cdi, CDSL_CURRENT), 500); > > +} > > + > > static > > int open_for_common(struct cdrom_device_info *cdi, tracktype *tracks) > > { > > @@ -1048,7 +1062,9 @@ int open_for_common(struct cdrom_device_info *cdi, tracktype *tracks) > > if (CDROM_CAN(CDC_CLOSE_TRAY) && > > cdi->options & CDO_AUTO_CLOSE) { > > cd_dbg(CD_OPEN, "trying to close the tray\n"); > > - ret = cdo->tray_move(cdi, 0); > > + ret = cdrom_tray_close(cdi); > > + if (ret == -ERESTARTSYS) > > + return ret; > > if (ret) { > > cd_dbg(CD_OPEN, "bummer. tried to close the tray but failed.\n"); > > /* Ignore the error from the low > > @@ -2312,7 +2328,8 @@ static int cdrom_ioctl_closetray(struct cdrom_device_info *cdi) > > > > if (!CDROM_CAN(CDC_CLOSE_TRAY)) > > return -ENOSYS; > > - return cdi->ops->tray_move(cdi, 0); > > + > > + return cdrom_tray_close(cdi); > > } > > So this patch changes code that does not wait into code that potentially waits > forever? Sorry but I don't think that's ideal. Please make sure that after a > certain time (a few seconds?) the loop finishes. Unfortunately, a few seconds is NOT sufficinet. I have no idea what is the upper bound on the time it can take to close the tray taking into account all hardware implementations like media changers. For the usual desktop units it takes tens of seconds so you would need to wait minutes to give some headroom - basically near-eternity. Thanks Michal