X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Ffld%2Ffld_handler.c;h=84d90cea0491cfe6187fe9d1eec1e93b7c74c8a4;hb=da430ce6173149b4bafcad71ea1d650d54ea39c0;hp=7fe5d7e882287c3a09083684c2b130ff09a2a4b5;hpb=79d06b6fac3d18f2e5755a940e8afa42e70f3ba2;p=fs%2Flustre-release.git diff --git a/lustre/fld/fld_handler.c b/lustre/fld/fld_handler.c index 7fe5d7e..84d90ce 100644 --- a/lustre/fld/fld_handler.c +++ b/lustre/fld/fld_handler.c @@ -136,38 +136,37 @@ EXPORT_SYMBOL(fld_server_create); * sequence controller node (MDT0). All other MDT[1...N] and client * cache fld entries, but this cache is not persistent. */ - int fld_server_lookup(const struct lu_env *env, struct lu_server_fld *fld, seqno_t seq, struct lu_seq_range *range) { - struct lu_seq_range *erange; - struct fld_thread_info *info; - int rc; - ENTRY; + struct lu_seq_range *erange; + struct fld_thread_info *info; + int rc; + ENTRY; info = lu_context_key_get(&env->le_ctx, &fld_thread_key); LASSERT(info != NULL); erange = &info->fti_lrange; - /* Lookup it in the cache. */ - rc = fld_cache_lookup(fld->lsf_cache, seq, erange); - if (rc == 0) { - if (unlikely(erange->lsr_flags != range->lsr_flags) && - range->lsr_flags != -1) { - CERROR("FLD cache found a range "DRANGE" doesn't " - "match the requested flag %x\n", - PRANGE(erange), range->lsr_flags); - RETURN(-EIO); - } - *range = *erange; - RETURN(0); - } + /* Lookup it in the cache. */ + rc = fld_cache_lookup(fld->lsf_cache, seq, erange); + if (rc == 0) { + if (unlikely(fld_range_type(erange) != fld_range_type(range) && + !fld_range_is_any(range))) { + CERROR("%s: FLD cache range "DRANGE" does not match" + "requested flag %x: rc = %d\n", fld->lsf_name, + PRANGE(erange), range->lsr_flags, -EIO); + RETURN(-EIO); + } + *range = *erange; + RETURN(0); + } if (fld->lsf_obj) { /* On server side, all entries should be in cache. * If we can not find it in cache, just return error */ - CERROR("%s: Can not found the seq "LPX64"\n", - fld->lsf_name, seq); + CERROR("%s: Cannot find sequence "LPX64": rc = %d\n", + fld->lsf_name, seq, -EIO); RETURN(-EIO); } else { LASSERT(fld->lsf_control_exp); @@ -245,15 +244,16 @@ static int fld_req_handle(struct ptlrpc_request *req, !(exp_connect_flags(exp) & OBD_CONNECT_MDS_MDS) && !(exp_connect_flags(exp) & OBD_CONNECT_LIGHTWEIGHT) && !exp->exp_libclient) - out->lsr_flags = LU_SEQ_RANGE_MDT; + fld_range_set_mdt(out); rc = fld_server_handle(lu_site2seq(site)->ss_server_fld, req->rq_svc_thread->t_env, *opc, out, info); - } else + } else { rc = err_serious(-EPROTO); + } - RETURN(rc); + RETURN(rc); } static void fld_thread_info_init(struct ptlrpc_request *req, @@ -382,12 +382,11 @@ static void fld_server_proc_fini(struct lu_server_fld *fld) int fld_server_init(const struct lu_env *env, struct lu_server_fld *fld, struct dt_device *dt, const char *prefix, int mds_node_id, - __u32 lsr_flags) + int type) { - int cache_size, cache_threshold; - struct lu_seq_range range; - int rc; - ENTRY; + int cache_size, cache_threshold; + int rc; + ENTRY; snprintf(fld->lsf_name, sizeof(fld->lsf_name), "srv-%s", prefix); @@ -407,12 +406,13 @@ int fld_server_init(const struct lu_env *env, struct lu_server_fld *fld, GOTO(out, rc); } - if (!mds_node_id && lsr_flags == LU_SEQ_RANGE_MDT) { + if (!mds_node_id && type == LU_SEQ_RANGE_MDT) { rc = fld_index_init(env, fld, dt); if (rc) GOTO(out, rc); - } else + } else { fld->lsf_obj = NULL; + } rc = fld_server_proc_init(fld); if (rc) @@ -420,16 +420,8 @@ int fld_server_init(const struct lu_env *env, struct lu_server_fld *fld, fld->lsf_control_exp = NULL; - if (lsr_flags == LU_SEQ_RANGE_MDT) { - /* Insert reserved sequence of "ROOT" and ".lustre" - * into fld cache. */ - range.lsr_start = FID_SEQ_LOCAL_FILE; - range.lsr_end = FID_SEQ_DOT_LUSTRE + 1; - range.lsr_index = 0; - range.lsr_flags = lsr_flags; - fld_cache_insert(fld->lsf_cache, &range); - } - EXIT; + GOTO(out, rc); + out: if (rc) fld_server_fini(env, fld);