We should only return -EROFS for read only mount if we really
need to create the file in question.
Defer the check to mdt_reint_open() instead of mdt_intent_opc().
Signed-off-by: Li Dongyang <dongyang.li@anu.edu.au>
Change-Id: I68f34ef7abbae934cfc3564a67ff70e5ab8a12b1
Reviewed-on: http://review.whamcloud.com/6893
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Li Xi <pkuelelixi@gmail.com>
Reviewed-by: Emoly Liu <emoly.liu@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
},
[MDT_IT_OCREAT] = {
.it_fmt = &RQF_LDLM_INTENT,
- .it_flags = MUTABOR,
+ /*
+ * OCREAT is not a MUTABOR request as if the file
+ * already exists.
+ * We do the extra check of OBD_CONNECT_RDONLY in
+ * mdt_reint_open() when we really need to create
+ * the object.
+ */
+ .it_flags = 0,
.it_act = mdt_intent_reint,
.it_reint = REINT_OPEN
},
}
if (!(create_flags & MDS_OPEN_CREAT))
GOTO(out_parent, result);
+ if (exp_connect_flags(req->rq_export) & OBD_CONNECT_RDONLY)
+ GOTO(out_parent, result = -EROFS);
*child_fid = *info->mti_rr.rr_fid2;
LASSERTF(fid_is_sane(child_fid), "fid="DFID"\n",
PFID(child_fid));