diff options
Diffstat (limited to 'kernel/drivers/staging/lustre/lustre/mdc/mdc_request.c')
-rw-r--r-- | kernel/drivers/staging/lustre/lustre/mdc/mdc_request.c | 307 |
1 files changed, 57 insertions, 250 deletions
diff --git a/kernel/drivers/staging/lustre/lustre/mdc/mdc_request.c b/kernel/drivers/staging/lustre/lustre/mdc/mdc_request.c index f8ef5fe5e..16a5a10d3 100644 --- a/kernel/drivers/staging/lustre/lustre/mdc/mdc_request.c +++ b/kernel/drivers/staging/lustre/lustre/mdc/mdc_request.c @@ -53,35 +53,8 @@ #define REQUEST_MINOR 244 -struct mdc_renew_capa_args { - struct obd_capa *ra_oc; - renew_capa_cb_t ra_cb; -}; - static int mdc_cleanup(struct obd_device *obd); -static int mdc_unpack_capa(struct obd_export *exp, struct ptlrpc_request *req, - const struct req_msg_field *field, struct obd_capa **oc) -{ - struct lustre_capa *capa; - struct obd_capa *c; - - /* swabbed already in mdc_enqueue */ - capa = req_capsule_server_get(&req->rq_pill, field); - if (capa == NULL) - return -EPROTO; - - c = alloc_capa(CAPA_SITE_CLIENT); - if (IS_ERR(c)) { - CDEBUG(D_INFO, "alloc capa failed!\n"); - return PTR_ERR(c); - } else { - c->c_capa = *capa; - *oc = c; - return 0; - } -} - static inline int mdc_queue_wait(struct ptlrpc_request *req) { struct client_obd *cli = &req->rq_import->imp_obd->u.cli; @@ -100,23 +73,20 @@ static inline int mdc_queue_wait(struct ptlrpc_request *req) return rc; } -/* Helper that implements most of mdc_getstatus and signal_completed_replay. */ -/* XXX this should become mdc_get_info("key"), sending MDS_GET_INFO RPC */ -static int send_getstatus(struct obd_import *imp, struct lu_fid *rootfid, - struct obd_capa **pc, int level, int msg_flags) +static int mdc_getstatus(struct obd_export *exp, struct lu_fid *rootfid) { struct ptlrpc_request *req; struct mdt_body *body; int rc; - req = ptlrpc_request_alloc_pack(imp, &RQF_MDS_GETSTATUS, + req = ptlrpc_request_alloc_pack(class_exp2cliimp(exp), + &RQF_MDS_GETSTATUS, LUSTRE_MDS_VERSION, MDS_GETSTATUS); if (req == NULL) return -ENOMEM; - mdc_pack_body(req, NULL, NULL, 0, 0, -1, 0); - lustre_msg_add_flags(req->rq_reqmsg, msg_flags); - req->rq_send_state = level; + mdc_pack_body(req, NULL, 0, 0, -1, 0); + req->rq_send_state = LUSTRE_IMP_FULL; ptlrpc_request_set_replen(req); @@ -130,12 +100,6 @@ static int send_getstatus(struct obd_import *imp, struct lu_fid *rootfid, goto out; } - if (body->valid & OBD_MD_FLMDSCAPA) { - rc = mdc_unpack_capa(NULL, req, &RMF_CAPA1, pc); - if (rc) - goto out; - } - *rootfid = body->fid1; CDEBUG(D_NET, "root fid="DFID", last_committed=%llu\n", @@ -146,14 +110,6 @@ out: return rc; } -/* This should be mdc_get_info("rootfid") */ -static int mdc_getstatus(struct obd_export *exp, struct lu_fid *rootfid, - struct obd_capa **pc) -{ - return send_getstatus(class_exp2cliimp(exp), rootfid, pc, - LUSTRE_IMP_FULL, 0); -} - /* * This function now is known to always saying that it will receive 4 buffers * from server. Even for cases when acl_size and md_size is zero, RPC header @@ -203,14 +159,6 @@ static int mdc_getattr_common(struct obd_export *exp, return -EPROTO; } - if (body->valid & OBD_MD_FLMDSCAPA) { - struct lustre_capa *capa; - - capa = req_capsule_server_get(pill, &RMF_CAPA1); - if (capa == NULL) - return -EPROTO; - } - return 0; } @@ -230,16 +178,14 @@ static int mdc_getattr(struct obd_export *exp, struct md_op_data *op_data, if (req == NULL) return -ENOMEM; - mdc_set_capa_size(req, &RMF_CAPA1, op_data->op_capa1); - rc = ptlrpc_request_pack(req, LUSTRE_MDS_VERSION, MDS_GETATTR); if (rc) { ptlrpc_request_free(req); return rc; } - mdc_pack_body(req, &op_data->op_fid1, op_data->op_capa1, - op_data->op_valid, op_data->op_mode, -1, 0); + mdc_pack_body(req, &op_data->op_fid1, op_data->op_valid, + op_data->op_mode, -1, 0); req_capsule_set_size(&req->rq_pill, &RMF_MDT_MD, RCL_SERVER, op_data->op_mode); @@ -270,7 +216,6 @@ static int mdc_getattr_name(struct obd_export *exp, struct md_op_data *op_data, if (req == NULL) return -ENOMEM; - mdc_set_capa_size(req, &RMF_CAPA1, op_data->op_capa1); req_capsule_set_size(&req->rq_pill, &RMF_NAME, RCL_CLIENT, op_data->op_namelen + 1); @@ -280,9 +225,8 @@ static int mdc_getattr_name(struct obd_export *exp, struct md_op_data *op_data, return rc; } - mdc_pack_body(req, &op_data->op_fid1, op_data->op_capa1, - op_data->op_valid, op_data->op_mode, - op_data->op_suppgids[0], 0); + mdc_pack_body(req, &op_data->op_fid1, op_data->op_valid, + op_data->op_mode, op_data->op_suppgids[0], 0); if (op_data->op_name) { char *name = req_capsule_client_get(&req->rq_pill, &RMF_NAME); @@ -333,7 +277,7 @@ static int mdc_is_subdir(struct obd_export *exp, static int mdc_xattr_common(struct obd_export *exp, const struct req_format *fmt, const struct lu_fid *fid, - struct obd_capa *oc, int opcode, u64 valid, + int opcode, u64 valid, const char *xattr_name, const char *input, int input_size, int output_size, int flags, __u32 suppgid, struct ptlrpc_request **request) @@ -348,7 +292,6 @@ static int mdc_xattr_common(struct obd_export *exp, if (req == NULL) return -ENOMEM; - mdc_set_capa_size(req, &RMF_CAPA1, oc); if (xattr_name) { xattr_namelen = strlen(xattr_name) + 1; req_capsule_set_size(&req->rq_pill, &RMF_NAME, RCL_CLIENT, @@ -402,13 +345,12 @@ static int mdc_xattr_common(struct obd_export *exp, rec->sx_suppgid2 = -1; rec->sx_fid = *fid; rec->sx_valid = valid | OBD_MD_FLCTIME; - rec->sx_time = get_seconds(); + rec->sx_time = ktime_get_real_seconds(); rec->sx_size = output_size; rec->sx_flags = flags; - mdc_pack_capa(req, &RMF_CAPA1, oc); } else { - mdc_pack_body(req, fid, oc, valid, output_size, suppgid, flags); + mdc_pack_body(req, fid, valid, output_size, suppgid, flags); } if (xattr_name) { @@ -442,23 +384,24 @@ static int mdc_xattr_common(struct obd_export *exp, } static int mdc_setxattr(struct obd_export *exp, const struct lu_fid *fid, - struct obd_capa *oc, u64 valid, const char *xattr_name, - const char *input, int input_size, int output_size, - int flags, __u32 suppgid, struct ptlrpc_request **request) + u64 valid, const char *xattr_name, + const char *input, int input_size, int output_size, + int flags, __u32 suppgid, + struct ptlrpc_request **request) { return mdc_xattr_common(exp, &RQF_MDS_REINT_SETXATTR, - fid, oc, MDS_REINT, valid, xattr_name, + fid, MDS_REINT, valid, xattr_name, input, input_size, output_size, flags, suppgid, request); } static int mdc_getxattr(struct obd_export *exp, const struct lu_fid *fid, - struct obd_capa *oc, u64 valid, const char *xattr_name, - const char *input, int input_size, int output_size, - int flags, struct ptlrpc_request **request) + u64 valid, const char *xattr_name, + const char *input, int input_size, int output_size, + int flags, struct ptlrpc_request **request) { return mdc_xattr_common(exp, &RQF_MDS_GETXATTR, - fid, oc, MDS_GETXATTR, valid, xattr_name, + fid, MDS_GETXATTR, valid, xattr_name, input, input_size, output_size, flags, -1, request); } @@ -618,34 +561,9 @@ int mdc_get_lustre_md(struct obd_export *exp, struct ptlrpc_request *req, #endif } } - if (md->body->valid & OBD_MD_FLMDSCAPA) { - struct obd_capa *oc = NULL; - - rc = mdc_unpack_capa(NULL, req, &RMF_CAPA1, &oc); - if (rc) - goto out; - md->mds_capa = oc; - } - - if (md->body->valid & OBD_MD_FLOSSCAPA) { - struct obd_capa *oc = NULL; - - rc = mdc_unpack_capa(NULL, req, &RMF_CAPA2, &oc); - if (rc) - goto out; - md->oss_capa = oc; - } out: if (rc) { - if (md->oss_capa) { - capa_put(md->oss_capa); - md->oss_capa = NULL; - } - if (md->mds_capa) { - capa_put(md->mds_capa); - md->mds_capa = NULL; - } #ifdef CONFIG_FS_POSIX_ACL posix_acl_release(md->posix_acl); #endif @@ -867,7 +785,6 @@ static int mdc_close(struct obd_export *exp, struct md_op_data *op_data, int rc; int saved_rc = 0; - req_fmt = &RQF_MDS_CLOSE; if (op_data->op_bias & MDS_HSM_RELEASE) { req_fmt = &RQF_MDS_RELEASE_CLOSE; @@ -887,8 +804,6 @@ static int mdc_close(struct obd_export *exp, struct md_op_data *op_data, if (req == NULL) return -ENOMEM; - mdc_set_capa_size(req, &RMF_CAPA1, op_data->op_capa1); - rc = ptlrpc_request_pack(req, LUSTRE_MDS_VERSION, MDS_CLOSE); if (rc) { ptlrpc_request_free(req); @@ -989,7 +904,6 @@ static int mdc_done_writing(struct obd_export *exp, struct md_op_data *op_data, if (req == NULL) return -ENOMEM; - mdc_set_capa_size(req, &RMF_CAPA1, op_data->op_capa1); rc = ptlrpc_request_pack(req, LUSTRE_MDS_VERSION, MDS_DONE_WRITING); if (rc) { ptlrpc_request_free(req); @@ -1046,7 +960,6 @@ static int mdc_done_writing(struct obd_export *exp, struct md_op_data *op_data, return rc; } - static int mdc_readpage(struct obd_export *exp, struct md_op_data *op_data, struct page **pages, struct ptlrpc_request **request) { @@ -1066,8 +979,6 @@ restart_bulk: if (req == NULL) return -ENOMEM; - mdc_set_capa_size(req, &RMF_CAPA1, op_data->op_capa1); - rc = ptlrpc_request_pack(req, LUSTRE_MDS_VERSION, MDS_READPAGE); if (rc) { ptlrpc_request_free(req); @@ -1090,7 +1001,7 @@ restart_bulk: mdc_readdir_pack(req, op_data->op_offset, PAGE_CACHE_SIZE * op_data->op_npages, - &op_data->op_fid1, op_data->op_capa1); + &op_data->op_fid1); ptlrpc_request_set_replen(req); rc = ptlrpc_queue_wait(req); @@ -1201,8 +1112,8 @@ static int mdc_ioc_fid2path(struct obd_export *exp, struct getinfo_fid2path *gf) /* Key is KEY_FID2PATH + getinfo_fid2path description */ keylen = cfs_size_round(sizeof(KEY_FID2PATH)) + sizeof(*gf); - OBD_ALLOC(key, keylen); - if (key == NULL) + key = kzalloc(keylen, GFP_NOFS); + if (!key) return -ENOMEM; memcpy(key, KEY_FID2PATH, sizeof(KEY_FID2PATH)); memcpy(key + cfs_size_round(sizeof(KEY_FID2PATH)), gf, sizeof(*gf)); @@ -1234,7 +1145,7 @@ static int mdc_ioc_fid2path(struct obd_export *exp, struct getinfo_fid2path *gf) PFID(&gf->gf_fid), gf->gf_recno, gf->gf_linkno, gf->gf_path); out: - OBD_FREE(key, keylen); + kfree(key); return rc; } @@ -1253,7 +1164,7 @@ static int mdc_ioc_hsm_progress(struct obd_export *exp, goto out; } - mdc_pack_body(req, NULL, NULL, OBD_MD_FLRMTPERM, 0, 0, 0); + mdc_pack_body(req, NULL, OBD_MD_FLRMTPERM, 0, 0, 0); /* Copy hsm_progress struct */ req_hpk = req_capsule_client_get(&req->rq_pill, &RMF_MDS_HSM_PROGRESS); @@ -1288,7 +1199,7 @@ static int mdc_ioc_hsm_ct_register(struct obd_import *imp, __u32 archives) goto out; } - mdc_pack_body(req, NULL, NULL, OBD_MD_FLRMTPERM, 0, 0, 0); + mdc_pack_body(req, NULL, OBD_MD_FLRMTPERM, 0, 0, 0); /* Copy hsm_progress struct */ archive_mask = req_capsule_client_get(&req->rq_pill, @@ -1322,16 +1233,14 @@ static int mdc_ioc_hsm_current_action(struct obd_export *exp, if (req == NULL) return -ENOMEM; - mdc_set_capa_size(req, &RMF_CAPA1, op_data->op_capa1); - rc = ptlrpc_request_pack(req, LUSTRE_MDS_VERSION, MDS_HSM_ACTION); if (rc) { ptlrpc_request_free(req); return rc; } - mdc_pack_body(req, &op_data->op_fid1, op_data->op_capa1, - OBD_MD_FLRMTPERM, 0, op_data->op_suppgids[0], 0); + mdc_pack_body(req, &op_data->op_fid1, OBD_MD_FLRMTPERM, 0, + op_data->op_suppgids[0], 0); ptlrpc_request_set_replen(req); @@ -1366,7 +1275,7 @@ static int mdc_ioc_hsm_ct_unregister(struct obd_import *imp) goto out; } - mdc_pack_body(req, NULL, NULL, OBD_MD_FLRMTPERM, 0, 0, 0); + mdc_pack_body(req, NULL, OBD_MD_FLRMTPERM, 0, 0, 0); ptlrpc_request_set_replen(req); @@ -1390,16 +1299,14 @@ static int mdc_ioc_hsm_state_get(struct obd_export *exp, if (req == NULL) return -ENOMEM; - mdc_set_capa_size(req, &RMF_CAPA1, op_data->op_capa1); - rc = ptlrpc_request_pack(req, LUSTRE_MDS_VERSION, MDS_HSM_STATE_GET); if (rc != 0) { ptlrpc_request_free(req); return rc; } - mdc_pack_body(req, &op_data->op_fid1, op_data->op_capa1, - OBD_MD_FLRMTPERM, 0, op_data->op_suppgids[0], 0); + mdc_pack_body(req, &op_data->op_fid1, OBD_MD_FLRMTPERM, 0, + op_data->op_suppgids[0], 0); ptlrpc_request_set_replen(req); @@ -1433,16 +1340,14 @@ static int mdc_ioc_hsm_state_set(struct obd_export *exp, if (req == NULL) return -ENOMEM; - mdc_set_capa_size(req, &RMF_CAPA1, op_data->op_capa1); - rc = ptlrpc_request_pack(req, LUSTRE_MDS_VERSION, MDS_HSM_STATE_SET); if (rc) { ptlrpc_request_free(req); return rc; } - mdc_pack_body(req, &op_data->op_fid1, op_data->op_capa1, - OBD_MD_FLRMTPERM, 0, op_data->op_suppgids[0], 0); + mdc_pack_body(req, &op_data->op_fid1, OBD_MD_FLRMTPERM, 0, + op_data->op_suppgids[0], 0); /* Copy states */ req_hss = req_capsule_client_get(&req->rq_pill, &RMF_HSM_STATE_SET); @@ -1490,7 +1395,7 @@ static int mdc_ioc_hsm_request(struct obd_export *exp, return rc; } - mdc_pack_body(req, NULL, NULL, OBD_MD_FLRMTPERM, 0, 0, 0); + mdc_pack_body(req, NULL, OBD_MD_FLRMTPERM, 0, 0, 0); /* Copy hsm_request struct */ req_hr = req_capsule_client_get(&req->rq_pill, &RMF_MDS_HSM_REQUEST); @@ -1604,8 +1509,8 @@ static int mdc_changelog_send_thread(void *csdata) CDEBUG(D_CHANGELOG, "changelog to fp=%p start %llu\n", cs->cs_fp, cs->cs_startrec); - OBD_ALLOC(cs->cs_buf, KUC_CHANGELOG_MSG_MAXSIZE); - if (cs->cs_buf == NULL) { + cs->cs_buf = kzalloc(KUC_CHANGELOG_MSG_MAXSIZE, GFP_NOFS); + if (!cs->cs_buf) { rc = -ENOMEM; goto out; } @@ -1644,9 +1549,8 @@ out: llog_cat_close(NULL, llh); if (ctxt) llog_ctxt_put(ctxt); - if (cs->cs_buf) - OBD_FREE(cs->cs_buf, KUC_CHANGELOG_MSG_MAXSIZE); - OBD_FREE_PTR(cs); + kfree(cs->cs_buf); + kfree(cs); return rc; } @@ -1657,7 +1561,7 @@ static int mdc_ioc_changelog_send(struct obd_device *obd, int rc; /* Freed in mdc_changelog_send_thread */ - OBD_ALLOC_PTR(cs); + cs = kzalloc(sizeof(*cs), GFP_NOFS); if (!cs) return -ENOMEM; @@ -1679,7 +1583,7 @@ static int mdc_ioc_changelog_send(struct obd_device *obd, } CERROR("Failed to start changelog thread: %d\n", rc); - OBD_FREE_PTR(cs); + kfree(cs); return rc; } @@ -1800,9 +1704,6 @@ static int mdc_ioc_swap_layouts(struct obd_export *exp, return -ENOMEM; } - mdc_set_capa_size(req, &RMF_CAPA1, op_data->op_capa1); - mdc_set_capa_size(req, &RMF_CAPA2, op_data->op_capa2); - rc = mdc_prep_elc_req(exp, req, MDS_SWAP_LAYOUTS, &cancels, count); if (rc) { ptlrpc_request_free(req); @@ -1819,10 +1720,7 @@ static int mdc_ioc_swap_layouts(struct obd_export *exp, ptlrpc_request_set_replen(req); rc = ptlrpc_queue_wait(req); - if (rc) - goto out; -out: ptlrpc_req_finished(req); return rc; } @@ -1937,8 +1835,8 @@ static int mdc_iocontrol(unsigned int cmd, struct obd_export *exp, int len, struct if_quotactl *qctl = karg; struct obd_quotactl *oqctl; - OBD_ALLOC_PTR(oqctl); - if (oqctl == NULL) { + oqctl = kzalloc(sizeof(*oqctl), GFP_NOFS); + if (!oqctl) { rc = -ENOMEM; goto out; } @@ -1951,7 +1849,7 @@ static int mdc_iocontrol(unsigned int cmd, struct obd_export *exp, int len, qctl->obd_uuid = obd->u.cli.cl_target_uuid; } - OBD_FREE_PTR(oqctl); + kfree(oqctl); goto out; } case LL_IOC_GET_CONNECT_FLAGS: @@ -2094,7 +1992,6 @@ static int mdc_hsm_copytool_send(int len, void *val) { struct kuc_hdr *lh = (struct kuc_hdr *)val; struct hsm_action_list *hal = (struct hsm_action_list *)(lh + 1); - int rc; if (len < sizeof(*lh) + sizeof(*hal)) { CERROR("Short HSM message %d < %d\n", len, @@ -2115,9 +2012,7 @@ static int mdc_hsm_copytool_send(int len, void *val) lh->kuc_msglen, hal->hal_count, hal->hal_fsname); /* Broadcast to HSM listeners */ - rc = libcfs_kkuc_group_put(KUC_GRP_HSM, lh); - - return rc; + return libcfs_kkuc_group_put(KUC_GRP_HSM, lh); } /** @@ -2227,26 +2122,6 @@ static int mdc_get_info(const struct lu_env *env, struct obd_export *exp, default_easize = val; *default_easize = exp->exp_obd->u.cli.cl_default_mds_easize; return 0; - } else if (KEY_IS(KEY_MAX_COOKIESIZE)) { - int mdsize, *max_cookiesize; - - if (*vallen != sizeof(int)) - return -EINVAL; - mdsize = *(int *)val; - if (mdsize > exp->exp_obd->u.cli.cl_max_mds_cookiesize) - exp->exp_obd->u.cli.cl_max_mds_cookiesize = mdsize; - max_cookiesize = val; - *max_cookiesize = exp->exp_obd->u.cli.cl_max_mds_cookiesize; - return 0; - } else if (KEY_IS(KEY_DEFAULT_COOKIESIZE)) { - int *default_cookiesize; - - if (*vallen != sizeof(int)) - return -EINVAL; - default_cookiesize = val; - *default_cookiesize = - exp->exp_obd->u.cli.cl_default_mds_cookiesize; - return 0; } else if (KEY_IS(KEY_CONN_DATA)) { struct obd_import *imp = class_exp2cliimp(exp); struct obd_connect_data *data = val; @@ -2267,7 +2142,7 @@ static int mdc_get_info(const struct lu_env *env, struct obd_export *exp, } static int mdc_sync(struct obd_export *exp, const struct lu_fid *fid, - struct obd_capa *oc, struct ptlrpc_request **request) + struct ptlrpc_request **request) { struct ptlrpc_request *req; int rc; @@ -2277,15 +2152,13 @@ static int mdc_sync(struct obd_export *exp, const struct lu_fid *fid, if (req == NULL) return -ENOMEM; - mdc_set_capa_size(req, &RMF_CAPA1, oc); - rc = ptlrpc_request_pack(req, LUSTRE_MDS_VERSION, MDS_SYNC); if (rc) { ptlrpc_request_free(req); return rc; } - mdc_pack_body(req, fid, oc, 0, 0, -1, 0); + mdc_pack_body(req, fid, 0, 0, -1, 0); ptlrpc_request_set_replen(req); @@ -2430,14 +2303,14 @@ static int mdc_setup(struct obd_device *obd, struct lustre_cfg *cfg) struct lprocfs_static_vars lvars = { NULL }; int rc; - OBD_ALLOC(cli->cl_rpc_lock, sizeof(*cli->cl_rpc_lock)); + cli->cl_rpc_lock = kzalloc(sizeof(*cli->cl_rpc_lock), GFP_NOFS); if (!cli->cl_rpc_lock) return -ENOMEM; mdc_init_rpc_lock(cli->cl_rpc_lock); ptlrpcd_addref(); - OBD_ALLOC(cli->cl_close_lock, sizeof(*cli->cl_close_lock)); + cli->cl_close_lock = kzalloc(sizeof(*cli->cl_close_lock), GFP_NOFS); if (!cli->cl_close_lock) { rc = -ENOMEM; goto err_rpc_lock; @@ -2448,7 +2321,7 @@ static int mdc_setup(struct obd_device *obd, struct lustre_cfg *cfg) if (rc) goto err_close_lock; lprocfs_mdc_init_vars(&lvars); - lprocfs_obd_setup(obd, lvars.obd_vars); + lprocfs_obd_setup(obd, lvars.obd_vars, lvars.sysfs_vars); sptlrpc_lprocfs_cliobd_attach(obd); ptlrpc_lprocfs_register_obd(obd); @@ -2465,9 +2338,9 @@ static int mdc_setup(struct obd_device *obd, struct lustre_cfg *cfg) return rc; err_close_lock: - OBD_FREE(cli->cl_close_lock, sizeof(*cli->cl_close_lock)); + kfree(cli->cl_close_lock); err_rpc_lock: - OBD_FREE(cli->cl_rpc_lock, sizeof(*cli->cl_rpc_lock)); + kfree(cli->cl_rpc_lock); ptlrpcd_decref(); return rc; } @@ -2525,8 +2398,8 @@ static int mdc_cleanup(struct obd_device *obd) { struct client_obd *cli = &obd->u.cli; - OBD_FREE(cli->cl_rpc_lock, sizeof(*cli->cl_rpc_lock)); - OBD_FREE(cli->cl_close_lock, sizeof(*cli->cl_close_lock)); + kfree(cli->cl_rpc_lock); + kfree(cli->cl_close_lock); ptlrpcd_decref(); @@ -2551,11 +2424,9 @@ static int mdc_process_config(struct obd_device *obd, u32 len, void *buf) return rc; } - /* get remote permission for current user on fid */ static int mdc_get_remote_perm(struct obd_export *exp, const struct lu_fid *fid, - struct obd_capa *oc, __u32 suppgid, - struct ptlrpc_request **request) + __u32 suppgid, struct ptlrpc_request **request) { struct ptlrpc_request *req; int rc; @@ -2567,15 +2438,13 @@ static int mdc_get_remote_perm(struct obd_export *exp, const struct lu_fid *fid, if (req == NULL) return -ENOMEM; - mdc_set_capa_size(req, &RMF_CAPA1, oc); - rc = ptlrpc_request_pack(req, LUSTRE_MDS_VERSION, MDS_GETATTR); if (rc) { ptlrpc_request_free(req); return rc; } - mdc_pack_body(req, fid, oc, OBD_MD_FLRMTPERM, 0, suppgid, 0); + mdc_pack_body(req, fid, OBD_MD_FLRMTPERM, 0, suppgid, 0); req_capsule_set_size(&req->rq_pill, &RMF_ACL, RCL_SERVER, sizeof(struct mdt_remote_perm)); @@ -2590,66 +2459,6 @@ static int mdc_get_remote_perm(struct obd_export *exp, const struct lu_fid *fid, return rc; } -static int mdc_interpret_renew_capa(const struct lu_env *env, - struct ptlrpc_request *req, void *args, - int status) -{ - struct mdc_renew_capa_args *ra = args; - struct mdt_body *body = NULL; - struct lustre_capa *capa; - - if (status) { - capa = ERR_PTR(status); - goto out; - } - - body = req_capsule_server_get(&req->rq_pill, &RMF_MDT_BODY); - if (body == NULL) { - capa = ERR_PTR(-EFAULT); - goto out; - } - - if ((body->valid & OBD_MD_FLOSSCAPA) == 0) { - capa = ERR_PTR(-ENOENT); - goto out; - } - - capa = req_capsule_server_get(&req->rq_pill, &RMF_CAPA2); - if (!capa) { - capa = ERR_PTR(-EFAULT); - goto out; - } -out: - ra->ra_cb(ra->ra_oc, capa); - return 0; -} - -static int mdc_renew_capa(struct obd_export *exp, struct obd_capa *oc, - renew_capa_cb_t cb) -{ - struct ptlrpc_request *req; - struct mdc_renew_capa_args *ra; - - req = ptlrpc_request_alloc_pack(class_exp2cliimp(exp), &RQF_MDS_GETATTR, - LUSTRE_MDS_VERSION, MDS_GETATTR); - if (req == NULL) - return -ENOMEM; - - /* NB, OBD_MD_FLOSSCAPA is set here, but it doesn't necessarily mean the - * capa to renew is oss capa. - */ - mdc_pack_body(req, &oc->c_capa.lc_fid, oc, OBD_MD_FLOSSCAPA, 0, -1, 0); - ptlrpc_request_set_replen(req); - - CLASSERT(sizeof(*ra) <= sizeof(req->rq_async_args)); - ra = ptlrpc_req_async_args(req); - ra->ra_oc = oc; - ra->ra_cb = cb; - req->rq_interpret_reply = mdc_interpret_renew_capa; - ptlrpcd_add_req(req, PDL_POLICY_LOCAL, -1); - return 0; -} - static struct obd_ops mdc_obd_ops = { .o_owner = THIS_MODULE, .o_setup = mdc_setup, @@ -2701,8 +2510,6 @@ static struct md_ops mdc_md_ops = { .m_free_lustre_md = mdc_free_lustre_md, .m_set_open_replay_data = mdc_set_open_replay_data, .m_clear_open_replay_data = mdc_clear_open_replay_data, - .m_renew_capa = mdc_renew_capa, - .m_unpack_capa = mdc_unpack_capa, .m_get_remote_perm = mdc_get_remote_perm, .m_intent_getattr_async = mdc_intent_getattr_async, .m_revalidate_lock = mdc_revalidate_lock @@ -2714,7 +2521,7 @@ static int __init mdc_init(void) lprocfs_mdc_init_vars(&lvars); - return class_register_type(&mdc_obd_ops, &mdc_md_ops, lvars.module_vars, + return class_register_type(&mdc_obd_ops, &mdc_md_ops, LUSTRE_MDC_NAME, NULL); } |