}
}
#ifdef CONFIG_FS_POSIX_ACL
- else if (exp->exp_connect_flags & OBD_CONNECT_ACL) {
+ else if (exp_connect_flags(exp) & OBD_CONNECT_ACL) {
const struct lu_env *env = info->mti_env;
struct md_object *next = mdt_object_child(o);
struct lu_buf *buf = &info->mti_buf;
}
#endif
- if (info->mti_mdt->mdt_opts.mo_mds_capa &&
- exp->exp_connect_flags & OBD_CONNECT_MDS_CAPA) {
+ if (info->mti_mdt->mdt_opts.mo_mds_capa &&
+ exp_connect_flags(exp) & OBD_CONNECT_MDS_CAPA) {
struct lustre_capa *capa;
capa = req_capsule_server_get(info->mti_pill, &RMF_CAPA1);
RETURN(rc);
repbody->valid |= OBD_MD_FLMDSCAPA;
}
- if (info->mti_mdt->mdt_opts.mo_oss_capa &&
- exp->exp_connect_flags & OBD_CONNECT_OSS_CAPA &&
- S_ISREG(lu_object_attr(&o->mot_obj.mo_lu))) {
+ if (info->mti_mdt->mdt_opts.mo_oss_capa &&
+ exp_connect_flags(exp) & OBD_CONNECT_OSS_CAPA &&
+ S_ISREG(lu_object_attr(&o->mot_obj.mo_lu))) {
struct lustre_capa *capa;
capa = req_capsule_server_get(info->mti_pill, &RMF_CAPA2);
* If we are following a symlink, don't open; and do not return open
* handle for special nodes as client required.
*/
- if (islnk || (!isreg && !isdir &&
- (req->rq_export->exp_connect_flags & OBD_CONNECT_NODEVOH))) {
- lustre_msg_set_transno(req->rq_repmsg, 0);
- RETURN(0);
- }
+ if (islnk || (!isreg && !isdir &&
+ (exp_connect_flags(req->rq_export) & OBD_CONNECT_NODEVOH))) {
+ lustre_msg_set_transno(req->rq_repmsg, 0);
+ RETURN(0);
+ }
/*
* We need to return the existing object's fid back, so it is done here,
mdt_export_evict(exp);
RETURN_EXIT;
}
- rc = mdt_object_exists(child);
- if (rc > 0) {
-
- mdt_set_capainfo(info, 1, rr->rr_fid2, BYPASS_CAPA);
- rc = mdt_attr_get_complex(info, child, ma);
- if (rc == 0)
- rc = mdt_finish_open(info, parent, child,
- flags, 1, ldlm_rep);
- } else if (rc < 0) {
- /* the child object was created on remote server */
- repbody->fid1 = *rr->rr_fid2;
- repbody->valid |= (OBD_MD_FLID | OBD_MD_MDS);
- rc = 0;
- } else if (rc == 0) {
- /* the child does not exist, we should do regular open */
- mdt_object_put(env, parent);
- mdt_object_put(env, child);
- GOTO(regular_open, 0);
- }
+
+ if (unlikely(mdt_object_remote(child))) {
+ /* the child object was created on remote server */
+ if (!mdt_is_dne_client(exp)) {
+ /* Return -EIO for old client */
+ mdt_object_put(env, parent);
+ mdt_object_put(env, child);
+ GOTO(out, rc = -EIO);
+ }
+ repbody->fid1 = *rr->rr_fid2;
+ repbody->valid |= (OBD_MD_FLID | OBD_MD_MDS);
+ rc = 0;
+ } else {
+ if (mdt_object_exists(child)) {
+ mdt_set_capainfo(info, 1, rr->rr_fid2,
+ BYPASS_CAPA);
+ rc = mdt_attr_get_complex(info, child, ma);
+ if (rc == 0)
+ rc = mdt_finish_open(info, parent,
+ child, flags,
+ 1, ldlm_rep);
+ } else {
+ /* the child does not exist, we should do
+ * regular open */
+ mdt_object_put(env, parent);
+ mdt_object_put(env, child);
+ GOTO(regular_open, 0);
+ }
+ }
mdt_object_put(env, parent);
mdt_object_put(env, child);
GOTO(out, rc);
if (IS_ERR(o))
RETURN(rc = PTR_ERR(o));
- rc = mdt_object_exists(o);
- if (rc > 0) {
- mdt_set_disposition(info, rep, (DISP_IT_EXECD |
- DISP_LOOKUP_EXECD |
- DISP_LOOKUP_POS));
-
- rc = mdt_attr_get_complex(info, o, ma);
- if (rc == 0)
- rc = mdt_finish_open(info, NULL, o, flags, 0, rep);
- } else if (rc == 0) {
- rc = -ENOENT;
- } else {
+ if (unlikely(mdt_object_remote(o))) {
/* the child object was created on remote server */
struct mdt_body *repbody;
+
+ mdt_set_disposition(info, rep, (DISP_IT_EXECD |
+ DISP_LOOKUP_EXECD |
+ DISP_LOOKUP_POS));
repbody = req_capsule_server_get(info->mti_pill, &RMF_MDT_BODY);
repbody->fid1 = *rr->rr_fid2;
repbody->valid |= (OBD_MD_FLID | OBD_MD_MDS);
rc = 0;
- }
+ } else {
+ if (mdt_object_exists(o)) {
+ mdt_set_disposition(info, rep, (DISP_IT_EXECD |
+ DISP_LOOKUP_EXECD |
+ DISP_LOOKUP_POS));
+
+ rc = mdt_attr_get_complex(info, o, ma);
+ if (rc == 0)
+ rc = mdt_finish_open(info, NULL, o, flags, 0,
+ rep);
+ } else {
+ rc = -ENOENT;
+ }
+ }
mdt_object_put(info->mti_env, o);
RETURN(rc);
if (IS_ERR(o))
RETURN(rc = PTR_ERR(o));
- rc = mdt_object_exists(o);
- if (rc == 0) {
- mdt_set_disposition(info, rep, (DISP_LOOKUP_EXECD |
- DISP_LOOKUP_NEG));
- GOTO(out, rc = -ENOENT);
- } else if (rc < 0) {
- CERROR("NFS remote open shouldn't happen.\n");
- GOTO(out, rc);
- }
- mdt_set_disposition(info, rep, (DISP_IT_EXECD |
- DISP_LOOKUP_EXECD));
+ if (mdt_object_remote(o)) {
+ CDEBUG(D_INFO, "%s: "DFID" is on remote MDT.\n",
+ info->mti_mdt->mdt_md_dev.md_lu_dev.ld_obd->obd_name,
+ PFID(rr->rr_fid2));
+ GOTO(out, rc = -EREMOTE);
+ } else if (!mdt_object_exists(o)) {
+ mdt_set_disposition(info, rep, (DISP_LOOKUP_EXECD |
+ DISP_LOOKUP_NEG));
+ GOTO(out, rc = -ENOENT);
+ }
+
+ mdt_set_disposition(info, rep, (DISP_IT_EXECD | DISP_LOOKUP_EXECD));
rc = mdt_attr_get_complex(info, o, ma);
if (rc)
if (IS_ERR(o))
RETURN(rc = PTR_ERR(o));
- rc = mdt_object_exists(o);
- if (rc > 0) {
- /* Do permission check for cross-open. */
- rc = mo_permission(info->mti_env, NULL, mdt_object_child(o),
- NULL, flags | MDS_OPEN_CROSS);
- if (rc)
- goto out;
-
- mdt_set_capainfo(info, 0, fid, BYPASS_CAPA);
- rc = mdt_attr_get_complex(info, o, ma);
- if (rc == 0)
- rc = mdt_finish_open(info, NULL, o, flags, 0, rep);
- } else if (rc == 0) {
- /*
- * Something is wrong here. lookup was positive but there is
- * no object!
- */
- CERROR("Cross-ref object doesn't exist!\n");
- rc = -EFAULT;
- } else {
- /* Something is wrong here, the object is on another MDS! */
- CERROR("The object isn't on this server! FLD error?\n");
- LU_OBJECT_DEBUG(D_WARNING, info->mti_env,
- &o->mot_obj.mo_lu,
- "Object isn't on this server! FLD error?\n");
-
+ if (mdt_object_remote(o)) {
+ /* Something is wrong here, the object is on another MDS! */
+ CERROR("%s: "DFID" isn't on this server!: rc = %d\n",
+ mdt_obd_name(info->mti_mdt), PFID(fid), -EFAULT);
+ LU_OBJECT_DEBUG(D_WARNING, info->mti_env,
+ &o->mot_obj.mo_lu,
+ "Object isn't on this server! FLD error?\n");
rc = -EFAULT;
+ } else {
+ if (mdt_object_exists(o)) {
+ /* Do permission check for cross-open. */
+ rc = mo_permission(info->mti_env, NULL,
+ mdt_object_child(o),
+ NULL, flags | MDS_OPEN_CROSS);
+ if (rc)
+ goto out;
+
+ mdt_set_capainfo(info, 0, fid, BYPASS_CAPA);
+ rc = mdt_attr_get_complex(info, o, ma);
+ if (rc == 0)
+ rc = mdt_finish_open(info, NULL, o, flags, 0,
+ rep);
+ } else {
+ /*
+ * Something is wrong here. lookup was positive but
+ * there is no object!
+ */
+ CERROR("%s: "DFID" doesn't exist!: rc = %d\n",
+ mdt_obd_name(info->mti_mdt), PFID(fid), -EFAULT);
+ rc = -EFAULT;
+ }
}
-
out:
mdt_object_put(info->mti_env, o);
RETURN(rc);
PFID(rr->rr_fid1), rr->rr_name,
PFID(rr->rr_fid2), create_flags,
ma->ma_attr.la_mode, msg_flags);
-
- if (req_is_replay(req) ||
+ if (info->mti_cross_ref) {
+ /* This is cross-ref open */
+ mdt_set_disposition(info, ldlm_rep,
+ (DISP_IT_EXECD | DISP_LOOKUP_EXECD |
+ DISP_LOOKUP_POS));
+ result = mdt_cross_open(info, rr->rr_fid1, ldlm_rep,
+ create_flags);
+ GOTO(out, result);
+ } else 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);
GOTO(out, result = -EFAULT);
}
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) ||
+ } else if ((rr->rr_namelen == 0 && 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))
+ if ((result != -ENOENT && !(create_flags & MDS_OPEN_CREAT)) &&
+ result != -EREMOTE)
GOTO(out, result);
if (unlikely(rr->rr_namelen == 0))
GOTO(out, result = -EINVAL);
mdt_set_disposition(info, ldlm_rep,
(DISP_IT_EXECD | DISP_LOOKUP_EXECD));
- if (info->mti_cross_ref) {
- /* This is cross-ref open */
- mdt_set_disposition(info, ldlm_rep, DISP_LOOKUP_POS);
- result = mdt_cross_open(info, rr->rr_fid1, ldlm_rep,
- create_flags);
- GOTO(out, result);
- }
-
lh = &info->mti_lh[MDT_LH_PARENT];
mdt_lock_pdo_init(lh, (create_flags & MDS_OPEN_CREAT) ?
LCK_PW : LCK_PR, rr->rr_name, rr->rr_namelen);
}
created = 1;
} else {
- /* We have to get attr & LOV EA, HSM bits for this object */
- ma->ma_need |= MA_HSM;
- result = mdt_attr_get_complex(info, child, ma);
/*
* The object is on remote node, return its FID for remote open.
*/
- if (result == -EREMOTE) {
+ if (mdt_object_remote(child)) {
/*
* Check if this lock already was sent to client and
* this is resent case. For resent case do not take lock
else
result = -EREMOTE;
GOTO(out_child, result);
- }
+ } else {
+ if (mdt_object_exists(child)) {
+ /* We have to get attr & LOV EA & HSM for this
+ * object */
+ ma->ma_need |= MA_HSM;
+ result = mdt_attr_get_complex(info, child, ma);
+ } else {
+ /*object non-exist!!!*/
+ LBUG();
+ }
+ }
}
LASSERT(!lustre_handle_is_used(&lhc->mlh_reg_lh));