From: Jan Kara Subject: Re: [PATCH] vfs: try to unblock evpoll if mounted filesystem is RDONLY Date: Thu, 25 Jul 2013 19:27:23 +0200 Message-ID: <20130725172723.GA18011@quack.suse.cz> References: <1373248974-3272-1-git-send-email-jason77.wang@gmail.com> <20130723154555.GC18458@mtj.dyndns.org> <20130723214844.GA25333@quack.suse.cz> <51EFA7A8.4010401@canonical.com> <20130724183931.GB27307@quack.suse.cz> <51F09A50.4040805@canonical.com> <20130725100358.GC9388@quack.suse.cz> <20130725153335.GG26107@mtj.dyndns.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Jan Kara , Hui Wang , viro@zeniv.linux.org.uk, kay.sievers@vrfy.org, jaxboe@fusionio.com, linux-fsdevel@vger.kernel.org To: Tejun Heo Return-path: Received: from cantor2.suse.de ([195.135.220.15]:55152 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755980Ab3GYR1a (ORCPT ); Thu, 25 Jul 2013 13:27:30 -0400 Content-Disposition: inline In-Reply-To: <20130725153335.GG26107@mtj.dyndns.org> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Thu 25-07-13 11:33:35, Tejun Heo wrote: > Hello, Jan. > > On Thu, Jul 25, 2013 at 12:03:58PM +0200, Jan Kara wrote: > > When we are asked to RW mount in case filesystem cannot really do RW, we > > return -EROFS instead of silently falling back to RO mount. Userspace > > mount(8) command will try again with MS_RDONLY set so things should still > > work OK and the problems with eject button would be solved. I'll try to > > code that up. > > Hmmm.... while it is neat, it is very visible to userland and I'm a > bit concerned that we might break some obscure tool which isn't using > the standard mount. Not sure about udf but for iso9660, which is > vastly more common anyway, just always setting MS_RDONLY seems like > the better solution. Well, the trick is that if the media is not writeable, mount without MS_RDONLY will fail even currently (tried that in practice, also see the check in blkdev_get_by_path()). So such tool should handle that case even currently. The only somewhat realistic case I'm aware of is if someone uses UDF on e.g. USB stick, it is created so that Linux doesn't support writing to it, and then some tool would be mounting it directly via syscall and would not handle the read-only media case right. But I don't find this likely so I think it would be worth trying out this approach before we try playing tricks with dropping write access... Hmm? Honza -- Jan Kara SUSE Labs, CR