Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp4068942ybg; Fri, 25 Oct 2019 12:52:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqzLCj4V3eBWCuNbTqGuvr4U64ITHOdK08mF3LKjvtB08+Jst/LDn9PXS4sZnL4sKlUoVt55 X-Received: by 2002:aa7:c1cb:: with SMTP id d11mr5997748edp.40.1572033166607; Fri, 25 Oct 2019 12:52:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572033166; cv=none; d=google.com; s=arc-20160816; b=VDbdL2SrAXfs4oqOEmXO88D7dnRbUojfmO+JCuy3f9X2azIIAYcJu6/eg9F8V69Ypn 3Z7Xie6/RLQvNWmHU/jJIqL5QRz5TQxqXb9Pma1a5rfCsM6mxw3hfnMFBBZ6Se34+VDg GplfZTDPpvRtJPu6dS7r0+MYKxUW5aZ9ivHUV+XY5bHOqsJ+b0cvIFb4j5rHX654JmQy ToqfsxXq6juaIqaAa9ktOFUTFfT5v8RkqX71KBBH/GTykV2y3Q99Iu9etYztfVjKeNnx KGzUlNfApJeSKQ8O/A3ho2NyttDYupUXU4RuFbZci4kdEVNQNoBt8c4MW40+I08w14HF c7zw== 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=Z96bHOORIK18Fl3XmWV/WZRff2kmk0L838eNQf3aVUI=; b=MNV/FJVrmaiJXg1OhlnlSABAOxJ6n8Ow+n0QBDcm1WDgDA7k8GiZxZl4KYuQmXPBCu iMiX/8qetBOeBICczJkQf7CUBJ7BEeHTfUxdmExWMv+0FncW29EWqzzQi1NcpZeZ8mTa FycwVGpHK6MI+zhoXVl8WylUzVNVAynzNJhFNYDZayearEVrI+n3hHgzMzY3AOlQCGCl 0vljAVMSGeL3spUHWDe+p+E6EnLLBigsxKIjh7EBv7ypxOoIMdgyDAd2yB+OIbSS3PQc uhZBCU0bpPh9NU7CrPVE7hjSxBOOcZumONwynP65kb7k2sSdf7uEkjDkZF5MKHtkIYQr uSbQ== 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 g6si2126944eda.377.2019.10.25.12.52.22; Fri, 25 Oct 2019 12:52:46 -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 S2409244AbfJYLVv (ORCPT + 99 others); Fri, 25 Oct 2019 07:21:51 -0400 Received: from mx2.suse.de ([195.135.220.15]:56776 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726298AbfJYLVu (ORCPT ); Fri, 25 Oct 2019 07:21:50 -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 5885EB19E; Fri, 25 Oct 2019 11:21:48 +0000 (UTC) From: Michal Suchanek To: linux-scsi@vger.kernel.org Cc: Michal Suchanek , Christoph Hellwig , Matthew Wilcox , "Ewan D. Milne" , Jonathan Corbet , Jens Axboe , "James E.J. Bottomley" , "Martin K. Petersen" , Alexander Viro , "J. Bruce Fields" , Mauro Carvalho Chehab , Eric Biggers , Benjamin Coddington , Hannes Reinecke , Omar Sandoval , Ming Lei , Damien Le Moal , Bart Van Assche , Tejun Heo , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [PATCH v3 0/7] Fix cdrom autoclose Date: Fri, 25 Oct 2019 13:21:37 +0200 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. Link: https://lore.kernel.org/lkml/cover.1513263482.git.msuchanek@suse.de/ Link: https://lore.kernel.org/lkml/cover.1571834862.git.msuchanek@suse.de/ v3: - change the VMware workaround to use blacklist flag - use exported function instead of ioctl Michal Suchanek (7): 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 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 | 192 ++++++++++++++------------ drivers/scsi/scsi_devinfo.c | 15 +- drivers/scsi/sr.c | 60 ++++++-- fs/block_dev.c | 21 ++- include/linux/blkdev.h | 1 + include/linux/cdrom.h | 1 + include/scsi/scsi_devinfo.h | 7 +- 8 files changed, 191 insertions(+), 108 deletions(-) -- 2.23.0