Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp4813827ybc; Tue, 26 Nov 2019 15:17:26 -0800 (PST) X-Google-Smtp-Source: APXvYqyk+YXxwtuWwh2kiKVsErhzjyxj0yPAKZigqyA3l2mvxLUghCvy68FCz3rrulALpu7bWt4K X-Received: by 2002:a17:906:8591:: with SMTP id v17mr46617041ejx.185.1574810246188; Tue, 26 Nov 2019 15:17:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574810246; cv=none; d=google.com; s=arc-20160816; b=fidAjuDTpv2RKfp9Onz0gCvZSHhFZnmGIitofy76OwtY808tjPC+iEAwBwtH4viGEz 0W2xyBfNA8tfqhKQnCH3sJKEZ3SZ8w3vrG5onOWiO0lHLb98YPyN6Pi7kiP6xnoSbOkw 8AqeWOmn6/BBf4hKQ3sOGKHuq6aZayZ2AXRNaBhXIzK43yI90c2IYPRYwdnBzBdxkUr7 BnL9BshbrImN4Vd7F3SSmP+j0pDXMWmwKaQjEw6CnFlpNewrxULk8NphFX9N5/5xg8+M 8zcgcX6o/CcVDx3IJAmK5+JUpLZpZ3fg2wfV4vTp1eryuCWxAz4UY1j4DlMK6ogw0ALk eLWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=xSdUXjteBaphnHhRVYPIlnexJspIHTPfIj7oTmOOWqw=; b=RMmo8sUVy+klX8vu7H1BRH7iPr+Vyasye0IfuL05u/PJbIg9f1i2X9THbrl3yaYJYm 6M1K/X0AxZumhmI5OcJW5jMuetoHNuahA0QHfdhZZrM8gkpQV29Swfx9/HcXwguhE5Gs i+qJEb0W3FBB2+rXCippgiCldnCAQdIzZPtpEdqzccX2YXZRy37dkzlJbuqfu6LVhqMB EQJfrvW3H1+MG+wZO5an3YmTxyEZHajjpzO2fEXyW1chJfZuJx3egj47Vcd/PmISgQ1o ya+cDZxPgNSu+z+jNzQs1WGStOWAjI0pIl+Nw+6dKZirMf3Lo/ZdxicNBgWI9ZuhocYS 5nUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=ykizGoPo; 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 n19si1032185edb.312.2019.11.26.15.17.01; Tue, 26 Nov 2019 15:17:26 -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; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=ykizGoPo; 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 S1726571AbfKZXNi (ORCPT + 99 others); Tue, 26 Nov 2019 18:13:38 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:36265 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726957AbfKZXNh (ORCPT ); Tue, 26 Nov 2019 18:13:37 -0500 Received: by mail-pf1-f194.google.com with SMTP id b19so9966708pfd.3 for ; Tue, 26 Nov 2019 15:13:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=xSdUXjteBaphnHhRVYPIlnexJspIHTPfIj7oTmOOWqw=; b=ykizGoPowPRvzlrjQj+ToVpf+pjLi7FwSGkw5E+soY/g/azPWXFYfuqR0kJiysIeyg aJpTkvd2bF6O743iR2cOQQwYnAuczqhVJx/2FazepSYURNSfGC31qu0XRnlW050VuPdO 1C5g2JstnKnP3eHJHNI3qfY/5wQV/gqj9+GiN/uC0lU5AYNcheWvWQ9VnQZMs933NXRj U8gMr85pLeYWLzaqtKk08Rp5c8+WVIQNziQreEPSROTGq9Ji2kiXxp+1+7PzNs/0H8XL 04cQEkjtEuK/p8EsZh1hYh1yaIh7odJwI4ENbg9KCoKMuQsfPT5JSPzZvQuF1ZIsc0L1 9sSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=xSdUXjteBaphnHhRVYPIlnexJspIHTPfIj7oTmOOWqw=; b=LVPZGiLl5OxhmP8g8xVddZ2thy7xEeuzHYII3rOl6vozSSDjCZRzloIliLo1o/isaH bSBvvBrx/SJnMdcrXA3AmlC/HdzPJg16KO2TVazBKNEU6WwAi8KTLzqtmM1MqYRyQQhk cQSFO7oeS8MDglmbJiMHqQw+SlRsHgU7PW5N7EYW3m2iIGrVS7cYgcUe/jdxsmhZMwYT 8TE3tguc6W5f/gdZjYv1jCEz6q6pt72vUGD+HUMG3wCmQNj/TEvhTjM0YxKVAY5Z4V9q kCd5ee46kXR8hFt2UNUPxCVCQ1rnEZ9RHKz5yUoIb3KPB0eXkaanKJtBkK6v5uNwc2jO tcvg== X-Gm-Message-State: APjAAAVOjtS/EA3wMzWmsgfIMl1L6b/wExx9JGky/+Nu9jUyM/75j8hV JVmNf1RWNUX+a4Gqp8u1Uhf9Mw== X-Received: by 2002:a62:528d:: with SMTP id g135mr44527972pfb.172.1574810016976; Tue, 26 Nov 2019 15:13:36 -0800 (PST) Received: from [192.168.1.188] ([66.219.217.79]) by smtp.gmail.com with ESMTPSA id o14sm14606693pfp.5.2019.11.26.15.13.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Nov 2019 15:13:35 -0800 (PST) Subject: Re: [PATCH v4 rebase 00/10] Fix cdrom autoclose To: =?UTF-8?Q?Michal_Such=c3=a1nek?= Cc: linux-scsi@vger.kernel.org, linux-block@vger.kernel.org, Jonathan Corbet , "James E.J. Bottomley" , "Martin K. Petersen" , Alexander Viro , Eric Biggers , "J. Bruce Fields" , Mauro Carvalho Chehab , Benjamin Coddington , Ming Lei , Chaitanya Kulkarni , Bart Van Assche , Damien Le Moal , Hou Tao , Pavel Begunkov , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Jan Kara , Hannes Reinecke , "Ewan D. Milne" , Christoph Hellwig , Matthew Wilcox References: <20191126202151.GY11661@kitsune.suse.cz> From: Jens Axboe Message-ID: <08bcfd0a-7433-2fa4-9ca2-ea008836b747@kernel.dk> Date: Tue, 26 Nov 2019 16:13:32 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <20191126202151.GY11661@kitsune.suse.cz> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/26/19 1:21 PM, Michal Suchánek wrote: > On Tue, Nov 26, 2019 at 01:01:42PM -0700, Jens Axboe wrote: >> On 11/26/19 12:54 PM, Michal Suchanek wrote: >>> Hello, >>> >>> there is cdrom autoclose feature that is supposed to close the tray, >>> wait for the disc to become ready, and then open the device. >>> >>> This used to work in ancient times. Then in old times there was a hack >>> in util-linux which worked around the breakage which probably resulted >>> from switching to scsi emulation. >>> >>> Currently util-linux maintainer refuses to merge another hack on the >>> basis that kernel still has the feature so it should be fixed there. >>> The code needs not be replicated in every userspace utility like mount >>> or dd which has no business knowing which devices are CD-roms and where >>> the autoclose setting is in the kernel. >>> >>> This is rebase on top of current master. >>> >>> Also it seems that most people think that this is fix for WMware because >>> there is one patch dealing with WMware. >> >> I think the main complaint with this is that it's kind of a stretch to >> add core functionality for a device type that's barely being >> manufactured anymore and is mostly used in a virtualized fashion. I >> think it you could fix this without 10 patches of churn and without >> adding a new ->open() addition to fops, then people would be a lot more >> receptive to the idea of improving cdrom auto-close. > > I see no way to do that cleanly. > > There are two open modes for cdrom devices - blocking and > non-blocking. > > In blocking mode open() should analyze the medium so that it's ready > when it returns. In non-blocking mode it should return immediately so > long as you can talk to the device. > > When waiting in open() with locks held the processes trying to open > the device are locked out regradless of the mode they use. > > The only way to solve this is to pretend that the device is open and > do the wait afterwards with the device unlocked. How is this any different from an open on a file that needs to bring in meta data on a busy rotating device, which can also take seconds? -- Jens Axboe