Bug 200649 - man-pages: mount(2) does not document EROFS
Summary: man-pages: mount(2) does not document EROFS
Status: RESOLVED CODE_FIX
Alias: None
Product: Documentation
Classification: Unclassified
Component: man-pages (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: documentation_man-pages@kernel-bugs.osdl.org
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-07-25 09:50 UTC by Harry Mallon
Modified: 2018-11-05 09:21 UTC (History)
1 user (show)

See Also:
Kernel Version:
Subsystem:
Regression: No
Bisected commit-id:


Attachments

Description Harry Mallon 2018-07-25 09:50:13 UTC
The man pages for mount(...) GLibC function do not document when a EROFS might be recieved.

When mounting without READONLY flag:
I have a UDF formatted disk which returns EACCESS as it is read only.
I have a VFat formatted disk (with hardware write protect turned on) which returns EROFS.

I think a line should be added to the man pages to cover EROFS, but I am not sure on the detail of when it would happen.
Comment 1 Michael Kerrisk 2018-11-05 08:45:52 UTC
Investigating some background details:

https://bugs.launchpad.net/ubuntu/+source/linux/+bug/278954
is relevant, I think. It seems that different filesystems return EROFS or EACCES in the case where one attempts to mount a filesystem read-write and that filesystem has been marked read-only.

grepping for ERORFS and EACCES in the various super.c files in the kernel source shows various cases where these errors can occur for different filesystems
Comment 2 Michael Kerrisk 2018-11-05 09:18:49 UTC
So, in mount(2) there was already a sentence under EACCES about read-only filesystems. I extended the text, so that it now reads:

       EACCES Mounting a read-only filesystem was attempted without  giv‐
              ing the MS_RDONLY flag.

              The  file  system  may  be  read-only  for various reasons,
              including: it resides on a read-only optical  disk;  it  is
              resides  on  a  device with a physical switch that has been
              set to mark the device read-only; the filesystem  implemen‐
              tation  was compiled with read-only support; or errors were
              detected when initially mounting the filesystem, so that it
              was  marked  read-only and can't be remounted as read-write
              (until the errors are fixed).

              Some filesystems instead  return  the  error  EROFS  on  an
              attempt to mount a read-only filesystem.

And I added the following entry for EROFS:

       EROFS  Mounting a read-only filesystem was attempted without  giv‐
              ing the MS_RDONLY flag.  See EACCES, above.

I'll close this bug now. Please reopen if you think something is still lacking.

Thanks for the bug report!
Comment 3 Harry Mallon 2018-11-05 09:21:51 UTC
Sounds great Michael, thanks!

Note You need to log in before you can comment on or make changes to this bug.