[LU-3557] open(2) an existing file with O_RDONLY|O_CREAT fails with -EROFS, ro mounted client Created: 04/Jul/13  Updated: 04/Sep/13  Resolved: 17/Aug/13

Status: Resolved
Project: Lustre
Component/s: None
Affects Version/s: Lustre 2.4.0
Fix Version/s: Lustre 2.5.0

Type: Bug Priority: Minor
Reporter: Li Dongyang (Inactive) Assignee: Emoly Liu
Resolution: Fixed Votes: 0
Labels: patch

Severity: 3
Rank (Obsolete): 8959

 Description   

Currently with a read only mount, open(2) with O_RDONLY|O_CREAT will fail with -EROFS, no matter the file exists or not.
If the file is already there and we don't need to create the file, we should make the open work.
The gcc-fortran runtime tends to add O_CREAT flag when it's trying to open a file, this prevents us from using the fortran based apps.



 Comments   
Comment by Li Dongyang (Inactive) [ 04/Jul/13 ]

patch for master http://review.whamcloud.com/6893

Comment by Jodi Levi (Inactive) [ 11/Jul/13 ]

Emoly,
Could you have a look at this one?
Thank you!

Comment by Li Xi (Inactive) [ 05/Aug/13 ]

FYI, when opening a existed file on readonly ext3 file system, we will get following results.

open(existed_file, O_RDWR | O_CREAT) -> -EROFS
open(existed_file, O_CREAT) -> 0
open(existed_file, O_WRONLY | O_CREAT) -> -EROFS
open(existed_file, O_RDONLY | O_CREAT) -> 0

Obviously, opening a non-exist file will return EROFS no matter what the flag is.

Comment by Emoly Liu [ 17/Aug/13 ]

patch landed for 2.5

Comment by Shuichi Ihara (Inactive) [ 04/Sep/13 ]

backport patches http://review.whamcloud.com/#/c/7550/ for b2_1

Generated at Sat Feb 10 01:34:56 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.