Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp848893ybg; Wed, 23 Oct 2019 06:46:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqyOXn5HvBo3AWlQyj25qZZ0JYTJozVU3vEv/l805JSPBYjQ/SV7z1V+JQ7Xb9zZEP60L5IA X-Received: by 2002:a17:906:58d:: with SMTP id 13mr32892659ejn.293.1571838361009; Wed, 23 Oct 2019 06:46:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571838361; cv=none; d=google.com; s=arc-20160816; b=dZCxhw4u/tJdjNZ5RR6OTN039JiKeAnY6yprCorBmt+dPN1+fl46xUwl0vQmduZDn0 a8zEvaTaGIFjY78MW8I4Lu19NDS0Id1HSwTnDjiZnumnBzsCZ5IC0oMH+oUB1u/OocgU argpUg/cAn57RKPVrhupdU2tEsi5a+dC0864PF5n8wYbhKar/s+CD7s0PccB0lLCuroN wpZJoXv1htg4gwb616DKYEHPBmvFKjbcLXD1jqnfvWUGqFjN53gxtdaud0E3bgb/9LbS W1hlCL0kFjVh0goetY/Wn5ksuS2fKFfZAWCarMZUJDarvi0ecGzgtOMxgc3jgXuiPgPn U9UQ== 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=DesRGD40XhcFcMVtm+G5eh64SQve+F6zHaumKOr0dTQ=; b=sEn6upuVQKasb7fy4q56Ps3s7k8Ua7g7ZrQsAXiK9fpgPt3FoDy5czi3NfLacENZUH btDPWqPYB92xJCx5NbYJgQzV82yLtcspZ0sN0u6yeobrLvSbMdaslZ2HXfO4b7760SvS mH9feLQ7l6PWiSS+UI3qOuBuVidy5dMsrCrPqLpplnj/YUTj4F5euqUHjnU3OQk+7qiI k6vitymeOkVQcIBhcQzkN/R79O2C26hiPYAFDklyvhLx+P4Z3HQ5NLzOWa0az0uw2mom 4f+qpSZ/hzqUbBfvyfQ1485/i3rxWVNmGF90hdDpyhbNzGHADF4lwOXmtBzcuViR3jxo Sw6g== 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 x25si2829035eju.357.2019.10.23.06.45.36; Wed, 23 Oct 2019 06:46:00 -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 S2391846AbfJWMxM (ORCPT + 99 others); Wed, 23 Oct 2019 08:53:12 -0400 Received: from mx2.suse.de ([195.135.220.15]:49240 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2390962AbfJWMxL (ORCPT ); Wed, 23 Oct 2019 08:53:11 -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 803CEB678; Wed, 23 Oct 2019 12:53:08 +0000 (UTC) From: Michal Suchanek To: linux-scsi@vger.kernel.org Cc: Michal Suchanek , Jonathan Corbet , Jens Axboe , "James E.J. Bottomley" , "Martin K. Petersen" , Alexander Viro , Mauro Carvalho Chehab , Eric Biggers , "J. Bruce Fields" , 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 v2 0/8] Fix cdrom autoclose. Date: Wed, 23 Oct 2019 14:52:39 +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 Link: https://lore.kernel.org/lkml/cover.1513263482.git.msuchanek@suse.de/ 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. Michal Suchanek (8): cdrom: add poll_event_interruptible cdrom: factor out common open_for_* code cdrom: wait for the tray to close cdrom: separate autoclose into an IOCTL docs: cdrom: Add autoclose IOCTL bdev: add open_finish. scsi: sr: workaround VMware ESXi cdrom emulation bug scsi: sr: wait for the medium to become ready Documentation/filesystems/locking.rst | 2 + Documentation/ioctl/cdrom.rst | 25 ++++ drivers/cdrom/cdrom.c | 188 ++++++++++++++------------ drivers/scsi/sr.c | 60 ++++++-- fs/block_dev.c | 21 ++- include/linux/blkdev.h | 1 + include/uapi/linux/cdrom.h | 1 + 7 files changed, 198 insertions(+), 100 deletions(-) -- 2.23.0