From: Jan Kara Subject: [PATCH 0/3] Fix eject button handling for RO fs Date: Fri, 26 Jul 2013 00:28:10 +0200 Message-ID: <1374791293-19140-1-git-send-email-jack@suse.cz> Cc: Hui Wang , Tejun Heo , viro@zeniv.linux.org.uk, kzak@redhat.com To: linux-fsdevel@vger.kernel.org Return-path: Received: from cantor2.suse.de ([195.135.220.15]:35891 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756813Ab3GYW21 (ORCPT ); Thu, 25 Jul 2013 18:28:27 -0400 Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Hello, As Hui Wang reported, there is a problem with handling of eject button for read-write media (i.e. CD-RW & DVD-RW). Although these are mounted read-only, block layer thinks they are used read-write (unlike the case when the media is normal CD or DVD disk) and thus blocks the eject button. This appears inconsistent to users and as Hui reports it is a regression against pre-3.0 kernels. Tejun suggested we can always use read-only access when filesystem is going to be used read-only. With iso9660 this would work as it is always read-only. But for udf this doesn't work as it can be used read-write. Whether it is read-only or read-write depends on filesystem features so we cannot tell before reading the disk. The solution I've taken is that we return EACCES if we are asked to mount a filesystem which can be mounted only read-only without MS_RDONLY set (so far we just silently set the MS_RDONLY flag during mount). This is userspace visible change which is why I'm CCing more people than usual. But I'm convinced we should be fine for several reasons: 1) The behavior isn't new - when the media is read-only, userspace will already get EACCES when trying to mount it without MS_RDONLY set. 2) mount(8) retries with MS_RDONLY set when it gets EACCESS. 3) mount(2) manpage documents this behavior. If noone will object to this change, I'll push the patches via my tree to Linus. Honza