diff --git a/lustre/fid/fid_handler.c b/lustre/fid/fid_handler.c index 32a4db2..220c829 100644 --- a/lustre/fid/fid_handler.c +++ b/lustre/fid/fid_handler.c @@ -339,7 +339,8 @@ static int seq_req_handle(struct ptlrpc_request *req, __u32 *opc; ENTRY; - LASSERT(!(lustre_msg_get_flags(req->rq_reqmsg) & MSG_REPLAY)); + /* need commit cb and reconstruct ? */ +// LASSERT(!(lustre_msg_get_flags(req->rq_reqmsg) & MSG_REPLAY)); site = req->rq_export->exp_obd->obd_lu_dev->ld_site; LASSERT(site != NULL); @@ -401,9 +402,9 @@ static int seq_handle(struct ptlrpc_request *req) seq_thread_info_init(req, info); rc = seq_req_handle(req, env, info); - /* XXX: we don't need replay but MDT assign transno in any case, - * remove it manually before reply*/ - lustre_msg_set_transno(req->rq_repmsg, 0); + /* we don't want a reply but want to be sure updates on disk + * before use it */ + lustre_msg_set_transno(req->rq_repmsg, req->rq_transno); seq_thread_info_fini(info); return rc; diff --git a/lustre/fid/fid_request.c b/lustre/fid/fid_request.c index 813fa5c..f8a7f42 100644 --- a/lustre/fid/fid_request.c +++ b/lustre/fid/fid_request.c @@ -57,17 +57,38 @@ #include #include #include -/* mdc RPC locks */ -#include #include "fid_internal.h" +struct seq_async_args { + struct lu_seq_range *saa_out; + long saa_done; + cfs_waitq_t saa_wq; +}; + +/* XXX */ +#define seq_timeout 0 + +static void seq_commit_cb(struct ptlrpc_request *req) +{ + struct seq_async_args *args = req->rq_cb_data; + struct lu_seq_range *out; + ENTRY; + + out = req_capsule_server_get(&req->rq_pill, &RMF_SEQ_RANGE); + *args->saa_out = *out; + args->saa_done = 1; + cfs_waitq_signal(&args->saa_wq); +} + static int seq_client_rpc(struct lu_client_seq *seq, struct lu_seq_range *output, __u32 opc, const char *opcname) { struct obd_export *exp = seq->lcs_exp; struct ptlrpc_request *req; - struct lu_seq_range *out, *in; + struct lu_seq_range *in; + struct seq_async_args args; + struct l_wait_info lwi = { 0 }; __u32 *op; int rc; ENTRY; @@ -107,17 +128,25 @@ static int seq_client_rpc(struct lu_client_seq *seq, "unknown opcode %u\n, opc", opc); } - ptlrpc_at_set_req_timeout(req); + ptlrpc_at_set_req_timeout(req); - mdc_get_rpc_lock(exp->exp_obd->u.cli.cl_rpc_lock, NULL); - rc = ptlrpc_queue_wait(req); - mdc_put_rpc_lock(exp->exp_obd->u.cli.cl_rpc_lock, NULL); + cfs_waitq_init(&args.saa_wq); + args.saa_out = output; + args.saa_done = 0; - if (rc) - GOTO(out_req, rc); + req->rq_cb_data = &args; + req->rq_commit_cb = seq_commit_cb; + + rc = ptlrpcd_add_req(req, PSCOPE_OTHER); + if (rc) + GOTO(out_req, rc); - out = req_capsule_server_get(&req->rq_pill, &RMF_SEQ_RANGE); - *output = *out; +// lwi = LWI_TIMEOUT(cfs_timeout_cap(cfs_time_seconds(seq_timeout)), +// NULL, NULL); + /* need timeout ? */ + rc = l_wait_event(args.saa_wq, args.saa_done != 0, &lwi); + if (rc) + GOTO(out_req, rc); if (!range_is_sane(output)) { CERROR("%s: Invalid range received from server: " @@ -136,7 +165,6 @@ static int seq_client_rpc(struct lu_client_seq *seq, EXIT; out_req: - ptlrpc_req_finished(req); return rc; } diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index 7dad8f9..c40cfd2 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -1654,6 +1654,20 @@ void ll_update_inode(struct inode *inode, struct lustre_md *md) struct ll_sb_info *sbi = ll_i2sbi(inode); LASSERT ((lsm != NULL) == ((body->valid & OBD_MD_FLEASIZE) != 0)); + if (body->valid & OBD_MD_FLTYPE) { + if ((!S_ISDIR(inode->i_mode) && S_ISDIR(body->mode)) || + (S_ISDIR(inode->i_mode) && !S_ISDIR(body->mode))) { +// if ((inode->i_mode & S_IFMT) != (body->mode & S_IFMT)) { + CERROR("ino %p->%lu type is %s but server reply has %s " + "type (%o and %o). FID "DFID"\n", inode, inode->i_ino, + S_ISDIR(inode->i_mode) ? "directory" :"file", + S_ISDIR(body->mode) ? "directory" : "file", + inode->i_mode & S_IFMT, body->mode & S_IFMT, + PFID(&lli->lli_fid)); + LBUG(); + } + } + if (lsm != NULL) { LASSERT(S_ISREG(inode->i_mode));