Skip to content

Fix eject button handling for RO fs

Jan Kara linux-fsdevel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3isofs: Refuse RW mount of the filesystem instead of making it ROfs/isofs/inode.c+5 -111 reply
2/3udf: Standardize return values in mount sequencefs/udf/super.c+183 -1170 replies
3/3udf: Refuse RW mount of the filesystem instead of making it ROfs/udf/super.c+24 -180 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/3] Fix eject button handling for RO fs

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