Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp3503305ybc; Thu, 21 Nov 2019 09:15:49 -0800 (PST) X-Google-Smtp-Source: APXvYqwkzqRDhAr8KXHtl1pW6guCkleTFrWV1LZzGJK4CP2jmqcprvozf1o4KTnM/Xk1fR489npl X-Received: by 2002:a17:906:b74c:: with SMTP id fx12mr14489423ejb.324.1574356549534; Thu, 21 Nov 2019 09:15:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574356549; cv=none; d=google.com; s=arc-20160816; b=zMgcWR7q7GhkElH3ET29i34F86hKoy2c97zJDeNKUDLw6vqlbYdh/0Z/ZmBQArjf9P 1Rlxt+hlHHlp0XtwWVO/SnSbs8mbLED06oMIo8ohAaFWlGiM05gi1F+MfyuVwauBpTuv xesm9xG4U1T/av5hHWPH9jm0DQTkZaiBnPDWIafn2ei1KU7Vd0fa3Hupj0vzNIgvtepK IZwHScKQFUWvnu5PL5RddgGajMlgxU1q0q11n+DV5HXUuR5FKhoB3/Cl8ahKW9w+aA6x d9ETm2IUQrqCyIZh+ybeMcBfu7tZfYwfpBOugNGZHv7VfjbpO7CDBIj72l/EyMbup+Ks Zi2w== 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:mime-version :message-id:date:subject:cc:to:from; bh=B0Xff2Fb5gsCkXhEjHVlhjos5Ufts/bLrtoPhj62DLw=; b=d3bh4kZlIaCT3ehjKjJyAHiNrIBM9L9XFQQnQf6D9EbtV97u7OsOYeXWeCTAc/PUcr tJb3g+CIJNvmFltlNHccixDNzndj8pbpivDpZCjvC4UCVgYm8kiRrP7HT7PN2e+nJgXs 5jd5HegpA+Z48qH7HJztstsSrpgJhurlWm/ciPiUCoyxLrB7SsQwuLtjVVCYBti1i41C gy7xgFkSK0oNQTemydjQQ/UtLDgcxQA42qoKC/1tSMzzNq9VNfqE6yyDMExO8wdnZMrP v/ud+0xKHe0OugphyEpOCAdlf5Le8X5lxXRliPiaj8MH/za9UMJNdxUAKr/mFqXgsR8F Ct8g== 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 a3si2097665ejy.247.2019.11.21.09.15.24; Thu, 21 Nov 2019 09:15:49 -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 S1727007AbfKURN3 (ORCPT + 99 others); Thu, 21 Nov 2019 12:13:29 -0500 Received: from mx2.suse.de ([195.135.220.15]:53954 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726279AbfKURN2 (ORCPT ); Thu, 21 Nov 2019 12:13:28 -0500 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 831E4B27B; Thu, 21 Nov 2019 17:13:26 +0000 (UTC) From: Michal Suchanek To: linux-scsi@vger.kernel.org, linux-block@vger.kernel.org Cc: Michal Suchanek , Jonathan Corbet , Jens Axboe , "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 Subject: [PATCH v4 00/10] Fix cdrom autoclose Date: Thu, 21 Nov 2019 18:13:07 +0100 Message-Id: X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. v3: - change the VMware workaround to use blacklist flag - use exported function instead of ioctl v4: - fix crash reported by kernel test robot - fix the debug message logic while refactoring cdrom_open - move repeated code out of __blkdev_get Link: https://lore.kernel.org/lkml/cover.1571834862.git.msuchanek@suse.de/ Link: https://lore.kernel.org/lkml/cover.1513263482.git.msuchanek@suse.de/ Michal Suchanek (10): cdrom: add poll_event_interruptible cdrom: factor out common open_for_* code cdrom: wait for the tray to close cdrom: export autoclose logic as a separate function cdrom: unify log messages. bdev: reset first_open when looping in __blkget_dev bdev: separate parts of __blkdev_get as helper functions bdev: add open_finish scsi: blacklist: add VMware ESXi cdrom - broken tray emulation scsi: sr: wait for the medium to become ready Documentation/filesystems/locking.rst | 2 + drivers/cdrom/cdrom.c | 471 +++++++++++++------------- drivers/scsi/scsi_devinfo.c | 15 +- drivers/scsi/sr.c | 60 +++- fs/block_dev.c | 80 +++-- include/linux/blkdev.h | 1 + include/linux/cdrom.h | 1 + include/scsi/scsi_devinfo.h | 7 +- 8 files changed, 360 insertions(+), 277 deletions(-) -- 2.23.0