EXIT;
}
-int mdt_getstatus(struct tgt_session_info *tsi)
+static int mdt_getstatus(struct tgt_session_info *tsi)
{
struct mdt_thread_info *info = tsi2mdt_info(tsi);
struct mdt_device *mdt = info->mti_mdt;
return rc;
}
-int mdt_statfs(struct tgt_session_info *tsi)
+static int mdt_statfs(struct tgt_session_info *tsi)
{
struct ptlrpc_request *req = tgt_ses_req(tsi);
struct mdt_thread_info *info = tsi2mdt_info(tsi);
return rc;
}
-int mdt_attr_get_pfid(struct mdt_thread_info *info,
- struct mdt_object *o, struct lu_fid *pfid)
+static int mdt_attr_get_pfid(struct mdt_thread_info *info,
+ struct mdt_object *o, struct lu_fid *pfid)
{
struct lu_buf *buf = &info->mti_buf;
struct link_ea_header *leh;
RETURN(rc);
}
-int mdt_getattr(struct tgt_session_info *tsi)
+static int mdt_getattr(struct tgt_session_info *tsi)
{
struct mdt_thread_info *info = tsi2mdt_info(tsi);
struct mdt_object *obj = info->mti_object;
struct req_capsule *pill = info->mti_pill;
struct mdt_body *reqbody;
struct mdt_body *repbody;
- mode_t mode;
int rc, rc2;
ENTRY;
LASSERT(obj != NULL);
LASSERT(lu_object_assert_exists(&obj->mot_obj));
- mode = lu_object_attr(&obj->mot_obj);
-
/* Readlink */
if (reqbody->valid & OBD_MD_LINKNAME) {
/* No easy way to know how long is the symlink, but it cannot
return rc;
}
-int mdt_is_subdir(struct tgt_session_info *tsi)
+static int mdt_is_subdir(struct tgt_session_info *tsi)
{
struct mdt_thread_info *info = tsi2mdt_info(tsi);
struct mdt_object *o = info->mti_object;
RETURN(rc);
}
-int mdt_swap_layouts(struct tgt_session_info *tsi)
+static int mdt_swap_layouts(struct tgt_session_info *tsi)
{
struct mdt_thread_info *info;
struct ptlrpc_request *req = tgt_ses_req(tsi);
struct lu_name *lname = NULL;
struct mdt_lock_handle *lhp = NULL;
struct ldlm_lock *lock;
- struct ldlm_res_id *res_id;
- int is_resent;
- int ma_need = 0;
- int rc;
-
- ENTRY;
-
- is_resent = lustre_handle_is_used(&lhc->mlh_reg_lh);
- LASSERT(ergo(is_resent,
- lustre_msg_get_flags(req->rq_reqmsg) & MSG_RESENT));
+ bool is_resent;
+ bool try_layout;
+ int ma_need = 0;
+ int rc;
+ ENTRY;
- LASSERT(parent != NULL);
+ is_resent = lustre_handle_is_used(&lhc->mlh_reg_lh);
+ LASSERT(ergo(is_resent,
+ lustre_msg_get_flags(req->rq_reqmsg) & MSG_RESENT));
- lname = &info->mti_name;
- mdt_name_unpack(info->mti_pill, &RMF_NAME, lname, MNF_FIX_ANON);
+ LASSERT(parent != NULL);
- if (!info->mti_cross_ref) {
- /*
- * XXX: Check for anonymous name is for getattr by fid
- * (OBD_CONNECT_ATTRFID), otherwise do not allow empty name,
- * that is the name must contain at least one character and
- * the terminating '\0'.
- */
- if (!lu_name_is_valid(lname)) {
- reqbody = req_capsule_client_get(info->mti_pill,
- &RMF_MDT_BODY);
- if (unlikely(reqbody == NULL))
- RETURN(err_serious(-EFAULT));
-
- if (unlikely(!fid_is_sane(&reqbody->fid2)))
- RETURN(err_serious(-EINVAL));
-
- CDEBUG(D_INODE, "getattr with lock for "DFID"/"DFID", "
- "ldlm_rep = %p\n",
- PFID(mdt_object_fid(parent)),
- PFID(&reqbody->fid2), ldlm_rep);
+ if (info->mti_cross_ref) {
+ /* Only getattr on the child. Parent is on another node. */
+ mdt_set_disposition(info, ldlm_rep,
+ DISP_LOOKUP_EXECD | DISP_LOOKUP_POS);
+ child = parent;
+ CDEBUG(D_INODE, "partial getattr_name child_fid = "DFID", "
+ "ldlm_rep = %p\n",
+ PFID(mdt_object_fid(child)), ldlm_rep);
+
+ if (is_resent) {
+ /* Do not take lock for resent case. */
+ lock = ldlm_handle2lock(&lhc->mlh_reg_lh);
+ LASSERTF(lock != NULL, "Invalid lock handle "LPX64"\n",
+ lhc->mlh_reg_lh.cookie);
+ LASSERT(fid_res_name_eq(mdt_object_fid(child),
+ &lock->l_resource->lr_name));
+ LDLM_LOCK_PUT(lock);
} else {
- CDEBUG(D_INODE, "getattr with lock for "DFID"/"DNAME", "
- "ldlm_rep = %p\n", PFID(mdt_object_fid(parent)),
- PNAME(lname), ldlm_rep);
- }
- }
-
- mdt_set_disposition(info, ldlm_rep, DISP_LOOKUP_EXECD);
-
- if (unlikely(!mdt_object_exists(parent)) && lu_name_is_valid(lname)) {
- LU_OBJECT_DEBUG(D_INODE, info->mti_env,
- &parent->mot_obj,
- "Parent doesn't exist!\n");
- RETURN(-ESTALE);
- } else if (!info->mti_cross_ref) {
- LASSERTF(!mdt_object_remote(parent),
- "Parent "DFID" is on remote server\n",
- PFID(mdt_object_fid(parent)));
- }
-
- if (lu_name_is_valid(lname)) {
- rc = mdt_raw_lookup(info, parent, lname, ldlm_rep);
- if (rc != 0) {
- if (rc > 0)
- rc = 0;
- RETURN(rc);
- }
- }
-
- if (info->mti_cross_ref) {
- /* Only getattr on the child. Parent is on another node. */
- mdt_set_disposition(info, ldlm_rep, DISP_LOOKUP_POS);
- child = parent;
- CDEBUG(D_INODE, "partial getattr_name child_fid = "DFID", "
- "ldlm_rep=%p\n", PFID(mdt_object_fid(child)), ldlm_rep);
-
- if (is_resent) {
- /* Do not take lock for resent case. */
- lock = ldlm_handle2lock(&lhc->mlh_reg_lh);
- LASSERTF(lock != NULL, "Invalid lock handle "LPX64"\n",
- lhc->mlh_reg_lh.cookie);
- LASSERT(fid_res_name_eq(mdt_object_fid(child),
- &lock->l_resource->lr_name));
- LDLM_LOCK_PUT(lock);
- rc = 0;
- } else {
mdt_lock_handle_init(lhc);
mdt_lock_reg_init(lhc, LCK_PR);
rc = mdt_object_lock(info, child, lhc, child_bits,
MDT_LOCAL_LOCK);
+ if (rc < 0)
+ RETURN(rc);
}
- if (rc == 0) {
- /* Finally, we can get attr for child. */
- if (!mdt_object_exists(child)) {
- LU_OBJECT_DEBUG(D_INFO, info->mti_env,
- &child->mot_obj,
- "remote object doesn't exist.\n");
- mdt_object_unlock(info, child, lhc, 1);
- RETURN(-ENOENT);
- }
- mdt_set_capainfo(info, 0, mdt_object_fid(child),
- BYPASS_CAPA);
- rc = mdt_getattr_internal(info, child, 0);
- if (unlikely(rc != 0))
- mdt_object_unlock(info, child, lhc, 1);
- }
+ /* Finally, we can get attr for child. */
+ if (!mdt_object_exists(child)) {
+ LU_OBJECT_DEBUG(D_INFO, info->mti_env,
+ &child->mot_obj,
+ "remote object doesn't exist.\n");
+ mdt_object_unlock(info, child, lhc, 1);
+ RETURN(-ENOENT);
+ }
+
+ mdt_set_capainfo(info, 0, mdt_object_fid(child), BYPASS_CAPA);
+ rc = mdt_getattr_internal(info, child, 0);
+ if (unlikely(rc != 0))
+ mdt_object_unlock(info, child, lhc, 1);
+
RETURN(rc);
}
+ lname = &info->mti_name;
+ mdt_name_unpack(info->mti_pill, &RMF_NAME, lname, MNF_FIX_ANON);
+
+ if (lu_name_is_valid(lname)) {
+ CDEBUG(D_INODE, "getattr with lock for "DFID"/"DNAME", "
+ "ldlm_rep = %p\n", PFID(mdt_object_fid(parent)),
+ PNAME(lname), ldlm_rep);
+ } else {
+ reqbody = req_capsule_client_get(info->mti_pill, &RMF_MDT_BODY);
+ if (unlikely(reqbody == NULL))
+ RETURN(err_serious(-EPROTO));
+
+ *child_fid = reqbody->fid2;
+
+ if (unlikely(!fid_is_sane(child_fid)))
+ RETURN(err_serious(-EINVAL));
+
+ CDEBUG(D_INODE, "getattr with lock for "DFID"/"DFID", "
+ "ldlm_rep = %p\n",
+ PFID(mdt_object_fid(parent)),
+ PFID(&reqbody->fid2), ldlm_rep);
+ }
+
+ mdt_set_disposition(info, ldlm_rep, DISP_LOOKUP_EXECD);
+
+ if (unlikely(!mdt_object_exists(parent)) && lu_name_is_valid(lname)) {
+ LU_OBJECT_DEBUG(D_INODE, info->mti_env,
+ &parent->mot_obj,
+ "Parent doesn't exist!\n");
+ RETURN(-ESTALE);
+ }
+
+ if (mdt_object_remote(parent)) {
+ CERROR("%s: parent "DFID" is on remote target\n",
+ mdt_obd_name(info->mti_mdt),
+ PFID(mdt_object_fid(parent)));
+ RETURN(-EIO);
+ }
+
if (lu_name_is_valid(lname)) {
+ rc = mdt_raw_lookup(info, parent, lname, ldlm_rep);
+ if (rc != 0) {
+ if (rc > 0)
+ rc = 0;
+ RETURN(rc);
+ }
+
/* step 1: lock parent only if parent is a directory */
if (S_ISDIR(lu_object_attr(&parent->mot_obj))) {
lhp = &info->mti_lh[MDT_LH_PARENT];
fid_zero(child_fid);
rc = mdo_lookup(info->mti_env, next, lname, child_fid,
&info->mti_spec);
+ if (rc == -ENOENT)
+ mdt_set_disposition(info, ldlm_rep, DISP_LOOKUP_NEG);
- if (rc != 0) {
- if (rc == -ENOENT)
- mdt_set_disposition(info, ldlm_rep,
- DISP_LOOKUP_NEG);
- GOTO(out_parent, rc);
- } else
- mdt_set_disposition(info, ldlm_rep, DISP_LOOKUP_POS);
- } else {
- *child_fid = reqbody->fid2;
- mdt_set_disposition(info, ldlm_rep, DISP_LOOKUP_POS);
- }
+ if (rc != 0)
+ GOTO(out_parent, rc);
+ }
+
+ mdt_set_disposition(info, ldlm_rep, DISP_LOOKUP_POS);
/*
*step 3: find the child object by fid & lock it.
LASSERTF(lock != NULL, "Invalid lock handle "LPX64"\n",
lhc->mlh_reg_lh.cookie);
- res_id = &lock->l_resource->lr_name;
if (!fid_res_name_eq(mdt_object_fid(child),
&lock->l_resource->lr_name)) {
LASSERTF(fid_res_name_eq(mdt_object_fid(parent),
GOTO(relock, 0);
}
LDLM_LOCK_PUT(lock);
- rc = 0;
} else {
- bool try_layout = false;
-
relock:
OBD_FAIL_TIMEOUT(OBD_FAIL_MDS_RESEND, obd_timeout*2);
mdt_lock_handle_init(lhc);
mdt_lock_reg_init(lhc, LCK_PR);
+ try_layout = false;
if (!mdt_object_exists(child)) {
LU_OBJECT_DEBUG(D_INODE, info->mti_env,
mdt_object_unlock(info, child, lhc, 1);
} else if (lock) {
/* Debugging code. */
- res_id = &lock->l_resource->lr_name;
LDLM_DEBUG(lock, "Returning lock to client");
LASSERTF(fid_res_name_eq(mdt_object_fid(child),
&lock->l_resource->lr_name),
}
/* normal handler: should release the child lock */
-int mdt_getattr_name(struct tgt_session_info *tsi)
+static int mdt_getattr_name(struct tgt_session_info *tsi)
{
struct mdt_thread_info *info = tsi2mdt_info(tsi);
struct mdt_lock_handle *lhc = &info->mti_lh[MDT_LH_CHILD];
static int mdt_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
void *karg, void *uarg);
-int mdt_set_info(struct tgt_session_info *tsi)
+static int mdt_set_info(struct tgt_session_info *tsi)
{
struct ptlrpc_request *req = tgt_ses_req(tsi);
char *key;
RETURN(rc);
}
-int mdt_readpage(struct tgt_session_info *tsi)
+static int mdt_readpage(struct tgt_session_info *tsi)
{
struct mdt_thread_info *info = mdt_th_info(tsi->tsi_env);
struct mdt_object *object = mdt_obj(tsi->tsi_corpus);
return opc;
}
-int mdt_reint(struct tgt_session_info *tsi)
+static int mdt_reint(struct tgt_session_info *tsi)
{
long opc;
int rc;
RETURN(rc);
}
-int mdt_sync(struct tgt_session_info *tsi)
+static int mdt_sync(struct tgt_session_info *tsi)
{
struct ptlrpc_request *req = tgt_ses_req(tsi);
struct req_capsule *pill = tsi->tsi_pill;
* Handle quota control requests to consult current usage/limit, but also
* to configure quota enforcement
*/
-int mdt_quotactl(struct tgt_session_info *tsi)
+static int mdt_quotactl(struct tgt_session_info *tsi)
{
struct obd_export *exp = tsi->tsi_exp;
struct req_capsule *pill = tsi->tsi_pill;
/*
* sec context handlers
*/
-int mdt_sec_ctx_handle(struct tgt_session_info *tsi)
+static int mdt_sec_ctx_handle(struct tgt_session_info *tsi)
{
int rc;
/*
* quota request handlers
*/
-int mdt_quota_dqacq(struct tgt_session_info *tsi)
+static int mdt_quota_dqacq(struct tgt_session_info *tsi)
{
struct mdt_device *mdt = mdt_exp2dev(tsi->tsi_exp);
struct lu_device *qmt = mdt->mdt_qmt_dev;
RETURN(rc);
}
-int mdt_object_lock_internal(struct mdt_thread_info *info, struct mdt_object *o,
- struct mdt_lock_handle *lh, __u64 ibits,
- bool nonblock, int locality)
+static int
+mdt_object_lock_internal(struct mdt_thread_info *info, struct mdt_object *o,
+ struct mdt_lock_handle *lh, __u64 ibits,
+ bool nonblock, int locality)
{
int rc;
ENTRY;
return mti;
}
-int mdt_tgt_connect(struct tgt_session_info *tsi)
+static int mdt_tgt_connect(struct tgt_session_info *tsi)
{
struct ptlrpc_request *req = tgt_ses_req(tsi);
int rc;
}
};
-int mdt_intent_lock_replace(struct mdt_thread_info *info,
- struct ldlm_lock **lockp,
- struct ldlm_lock *new_lock,
- struct mdt_lock_handle *lh,
- __u64 flags)
+static int
+mdt_intent_lock_replace(struct mdt_thread_info *info, struct ldlm_lock **lockp,
+ struct ldlm_lock *new_lock, struct mdt_lock_handle *lh,
+ __u64 flags)
{
struct ptlrpc_request *req = mdt_info_req(info);
struct ldlm_lock *lock = *lockp;
struct ldlm_lock *new_lock = NULL;
__u64 child_bits;
struct ldlm_reply *ldlm_rep;
- struct ptlrpc_request *req;
struct mdt_body *reqbody;
struct mdt_body *repbody;
int rc, rc2;
if (rc)
GOTO(out_shrink, rc);
- req = info->mti_pill->rc_req;
ldlm_rep = req_capsule_server_get(info->mti_pill, &RMF_DLM_REP);
mdt_set_disposition(info, ldlm_rep, DISP_IT_EXECD);
static void mdt_stack_pre_fini(const struct lu_env *env,
struct mdt_device *m, struct lu_device *top)
{
- struct obd_device *obd;
struct lustre_cfg_bufs *bufs;
struct lustre_cfg *lcfg;
struct mdt_thread_info *info;
LASSERT(m->mdt_child_exp);
LASSERT(m->mdt_child_exp->exp_obd);
- obd = m->mdt_child_exp->exp_obd;
/* process cleanup, pass mdt obd name to get obd umount flags */
/* XXX: this is needed because all layers are referenced by
EXIT;
}
-int mdt_postrecov(const struct lu_env *, struct mdt_device *);
+static int mdt_postrecov(const struct lu_env *, struct mdt_device *);
static int mdt_init0(const struct lu_env *env, struct mdt_device *m,
struct lu_device_type *ldt, struct lustre_cfg *cfg)
RETURN(rc);
}
-int mdt_postrecov(const struct lu_env *env, struct mdt_device *mdt)
+static int mdt_postrecov(const struct lu_env *env, struct mdt_device *mdt)
{
struct lu_device *ld = md2lu_dev(mdt->mdt_child);
int rc;
RETURN(rc);
}
-int mdt_obd_postrecov(struct obd_device *obd)
+static int mdt_obd_postrecov(struct obd_device *obd)
{
struct lu_env env;
int rc;