Original prcessing for open by fidi gnored the case of OST-objects
to be created because of re-exporting by NFS or O_LOV_DELAY_CREATE
flags, then MDD failed to find useful stripe EA to create releated
OST-objects.
Rename mdt_open_anon_by_fid() to mdt_open_by_fid_lock() to make it
more match the real use cases.
Signed-off-by: Fan Yong <yong.fan@whamcloud.com>
Change-Id: I3c0e4791f6f74fa6b365d41a8e550dba518b39cc
Reviewed-on: http://review.whamcloud.com/3537
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Lai Siyao <laisiyao@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
-int mdt_open_anon_by_fid(struct mdt_thread_info *info,
- struct ldlm_reply *rep,
- struct mdt_lock_handle *lhc)
+int mdt_open_by_fid_lock(struct mdt_thread_info *info, struct ldlm_reply *rep,
+ struct mdt_lock_handle *lhc)
{
const struct lu_env *env = info->mti_env;
struct mdt_device *mdt = info->mti_mdt;
{
const struct lu_env *env = info->mti_env;
struct mdt_device *mdt = info->mti_mdt;
- if (md_should_create(flags)) {
+ if (md_should_create(flags) && !(flags & MDS_OPEN_HAS_EA)) {
if (!lu_fid_eq(rr->rr_fid1, rr->rr_fid2)) {
parent = mdt_object_find(env, mdt, rr->rr_fid1);
if (IS_ERR(parent)) {
if (!lu_fid_eq(rr->rr_fid1, rr->rr_fid2)) {
parent = mdt_object_find(env, mdt, rr->rr_fid1);
if (IS_ERR(parent)) {
PFID(rr->rr_fid2), create_flags,
ma->ma_attr.la_mode, msg_flags);
PFID(rr->rr_fid2), create_flags,
ma->ma_attr.la_mode, msg_flags);
- if ((create_flags & MDS_OPEN_BY_FID) || req_is_replay(req) ||
+ if (req_is_replay(req) ||
(req->rq_export->exp_libclient && create_flags & MDS_OPEN_HAS_EA)) {
/* This is a replay request or from liblustre with ea. */
result = mdt_open_by_fid(info, ldlm_rep);
(req->rq_export->exp_libclient && create_flags & MDS_OPEN_HAS_EA)) {
/* This is a replay request or from liblustre with ea. */
result = mdt_open_by_fid(info, ldlm_rep);
}
/* We didn't find the correct object, so we need to re-create it
* via a regular replay. */
}
/* We didn't find the correct object, so we need to re-create it
* via a regular replay. */
- if (!(create_flags & (MDS_OPEN_CREAT | MDS_OPEN_BY_FID))) {
+ if (!(create_flags & MDS_OPEN_CREAT)) {
DEBUG_REQ(D_ERROR, req,
"OPEN & CREAT not in open replay/by_fid.");
GOTO(out, result = -EFAULT);
}
DEBUG_REQ(D_ERROR, req,
"OPEN & CREAT not in open replay/by_fid.");
GOTO(out, result = -EFAULT);
}
- CDEBUG(D_INFO, "No object, continue as regular open.\n");
- } else if (rr->rr_namelen == 0 && !info->mti_cross_ref &&
- create_flags & MDS_OPEN_LOCK) {
- result = mdt_open_anon_by_fid(info, ldlm_rep, lhc);
- GOTO(out, result);
+ CDEBUG(D_INFO, "No object(1), continue as regular open.\n");
+ } else if ((rr->rr_namelen == 0 && !info->mti_cross_ref &&
+ create_flags & MDS_OPEN_LOCK) ||
+ (create_flags & MDS_OPEN_BY_FID)) {
+ result = mdt_open_by_fid_lock(info, ldlm_rep, lhc);
+ if (result != -ENOENT && !(create_flags & MDS_OPEN_CREAT))
+ GOTO(out, result);
+ if (unlikely(rr->rr_namelen == 0))
+ GOTO(out, result = -EINVAL);
+ CDEBUG(D_INFO, "No object(2), continue as regular open.\n");
}
if (OBD_FAIL_CHECK(OBD_FAIL_MDS_OPEN_PACK))
}
if (OBD_FAIL_CHECK(OBD_FAIL_MDS_OPEN_PACK))