From aab5f64a1271936772882c6e6df4ef39a0a55ab5 Mon Sep 17 00:00:00 2001 From: yury Date: Thu, 21 Sep 2006 15:43:31 +0000 Subject: [PATCH] - improvements in error messages --- lustre/fid/fid_handler.c | 22 +++++++++++----------- lustre/fid/fid_request.c | 10 +++++----- lustre/fid/fid_store.c | 7 ++++--- lustre/fid/lproc_fid.c | 32 +++++++++++++++++++------------- lustre/fld/fld_index.c | 4 ++-- lustre/fld/fld_request.c | 5 +++-- lustre/mdt/mdt_handler.c | 13 ++++++++----- 7 files changed, 52 insertions(+), 41 deletions(-) diff --git a/lustre/fid/fid_handler.c b/lustre/fid/fid_handler.c index 8bbe086..4a797e1 100644 --- a/lustre/fid/fid_handler.c +++ b/lustre/fid/fid_handler.c @@ -87,7 +87,7 @@ int seq_server_set_cli(struct lu_server_seq *seq, rc = seq_client_alloc_super(cli, ctx); if (rc) { up(&seq->lss_sem); - CERROR("can't allocate super-sequence, " + CERROR("Can't allocate super-sequence, " "rc %d\n", rc); RETURN(rc); } @@ -100,7 +100,7 @@ int seq_server_set_cli(struct lu_server_seq *seq, /* save init seq to backing store. */ rc = seq_store_write(seq, ctx); if (rc) { - CERROR("can't write sequence state, " + CERROR("Can't write sequence state, " "rc = %d\n", rc); } } @@ -132,13 +132,13 @@ static int __seq_server_alloc_super(struct lu_server_seq *seq, *out = *in; } else { if (range_space(space) < seq->lss_super_width) { - CWARN("sequences space is going to exhaust soon. " + CWARN("Sequences space is going to exhaust soon. " "Can allocate only "LPU64" sequences\n", range_space(space)); *out = *space; space->lr_start = space->lr_end; } else if (range_is_exhausted(space)) { - CERROR("sequences space is exhausted\n"); + CERROR("Sequences space is exhausted\n"); RETURN(-ENOSPC); } else { range_alloc(out, space, seq->lss_super_width); @@ -147,7 +147,7 @@ static int __seq_server_alloc_super(struct lu_server_seq *seq, rc = seq_store_write(seq, ctx); if (rc) { - CERROR("can't save state, rc = %d\n", + CERROR("Can't save state, rc = %d\n", rc); RETURN(rc); } @@ -221,13 +221,13 @@ static int __seq_server_alloc_meta(struct lu_server_seq *seq, */ if (range_is_exhausted(super)) { if (!seq->lss_cli) { - CERROR("no seq-controller client is setup\n"); + CERROR("No seq-controller client is setup\n"); RETURN(-EOPNOTSUPP); } rc = seq_client_alloc_super(seq->lss_cli, ctx); if (rc) { - CERROR("can't allocate new super-sequence, " + CERROR("Can't allocate new super-sequence, " "rc %d\n", rc); RETURN(rc); } @@ -241,7 +241,7 @@ static int __seq_server_alloc_meta(struct lu_server_seq *seq, rc = seq_store_write(seq, ctx); if (rc) { - CERROR("can't save state, rc = %d\n", + CERROR("Can't save state, rc = %d\n", rc); } @@ -279,7 +279,7 @@ static int seq_server_handle(struct lu_site *site, switch (opc) { case SEQ_ALLOC_META: if (!site->ls_server_seq) { - CERROR("sequence-server is not " + CERROR("Sequence-server is not " "initialized\n"); RETURN(-EINVAL); } @@ -288,7 +288,7 @@ static int seq_server_handle(struct lu_site *site, break; case SEQ_ALLOC_SUPER: if (!site->ls_control_seq) { - CERROR("sequence-controller is not " + CERROR("Sequence-controller is not " "initialized\n"); RETURN(-EINVAL); } @@ -443,7 +443,7 @@ static int seq_server_proc_init(struct lu_server_seq *seq) rc = lprocfs_add_vars(seq->lss_proc_dir, seq_server_proc_list, seq); if (rc) { - CERROR("can't init sequence manager " + CERROR("Can't init sequence manager " "proc, rc %d\n", rc); GOTO(out_cleanup, rc); } diff --git a/lustre/fid/fid_request.c b/lustre/fid/fid_request.c index 47b1201..d078bc9 100644 --- a/lustre/fid/fid_request.c +++ b/lustre/fid/fid_request.c @@ -98,13 +98,13 @@ static int seq_client_rpc(struct lu_client_seq *seq, *range = *out; if (!range_is_sane(range)) { - CERROR("invalid seq range obtained from server: " + CERROR("Invalid seq range obtained from server: " DRANGE"\n", PRANGE(range)); GOTO(out_req, rc = -EINVAL); } if (range_is_exhausted(range)) { - CERROR("seq range obtained from server is exhausted: " + CERROR("Seq range obtained from server is exhausted: " DRANGE"]\n", PRANGE(range)); GOTO(out_req, rc = -EINVAL); } @@ -208,7 +208,7 @@ static int __seq_client_alloc_seq(struct lu_client_seq *seq, seqno_t *seqnr) if (range_space(&seq->lcs_range) == 0) { rc = __seq_client_alloc_meta(seq, NULL); if (rc) { - CERROR("can't allocate new meta-sequence, " + CERROR("Can't allocate new meta-sequence, " "rc %d\n", rc); RETURN(rc); } @@ -254,7 +254,7 @@ int seq_client_alloc_fid(struct lu_client_seq *seq, struct lu_fid *fid) * or sequence is exhausted and should be switched. */ rc = __seq_client_alloc_seq(seq, &seqnr); if (rc) { - CERROR("can't allocate new sequence, " + CERROR("Can't allocate new sequence, " "rc %d\n", rc); GOTO(out, rc); } @@ -306,7 +306,7 @@ static int seq_client_proc_init(struct lu_client_seq *seq) rc = lprocfs_add_vars(seq->lcs_proc_dir, seq_client_proc_list, seq); if (rc) { - CERROR("can't init sequence manager " + CERROR("Can't init sequence manager " "proc, rc %d\n", rc); GOTO(out_cleanup, rc); } diff --git a/lustre/fid/fid_store.c b/lustre/fid/fid_store.c index dd2e8cb..0a7356c 100644 --- a/lustre/fid/fid_store.c +++ b/lustre/fid/fid_store.c @@ -123,7 +123,7 @@ int seq_store_read(struct lu_server_seq *seq, range_le_to_cpu(&seq->lss_space, &info->sti_record.ssr_space); range_le_to_cpu(&seq->lss_super, &info->sti_record.ssr_super); - CDEBUG(D_INFO|D_WARNING, "read %s ranges: space - "DRANGE", super " + CDEBUG(D_INFO|D_WARNING, "Read %s ranges: space - "DRANGE", super " "- "DRANGE"\n", (seq->lss_type == LUSTRE_SEQ_SERVER ? "server" : "controller"), PRANGE(&seq->lss_space), PRANGE(&seq->lss_super)); @@ -131,7 +131,8 @@ int seq_store_read(struct lu_server_seq *seq, } else if (rc == 0) { rc = -ENODATA; } else if (rc >= 0) { - CERROR("read only %d bytes of %d\n", rc, sizeof(info->sti_record)); + CERROR("Read only %d bytes of %d\n", rc, + sizeof(info->sti_record)); rc = -EIO; } @@ -156,7 +157,7 @@ int seq_store_init(struct lu_server_seq *seq, seq->lss_obj = dt_obj; rc = 0; } else { - CERROR("cannot find \"seq\" obj %d\n", + CERROR("Can't find \"seq\" obj %d\n", (int)PTR_ERR(dt_obj)); rc = PTR_ERR(dt_obj); } diff --git a/lustre/fid/lproc_fid.c b/lustre/fid/lproc_fid.c index 7295b42..ac56ce3 100644 --- a/lustre/fid/lproc_fid.c +++ b/lustre/fid/lproc_fid.c @@ -68,7 +68,7 @@ seq_proc_write_common(struct file *file, const char *buffer, /* did not match 2 values */ if (rc != 2 || !range_is_sane(&tmp) || range_is_zero(&tmp)) { - CERROR("can't parse input string or input is not correct\n"); + CERROR("Can't parse input string or input is not correct\n"); RETURN(-EINVAL); } @@ -107,8 +107,9 @@ seq_proc_write_space(struct file *file, const char *buffer, rc = seq_proc_write_common(file, buffer, count, data, &seq->lss_space); if (rc == 0) { - CDEBUG(D_WARNING, "SEQ-MGR(srv): sequences space has " - "changed to "DRANGE"\n", PRANGE(&seq->lss_space)); + CDEBUG(D_WARNING, "%s: sequences space has " + "changed to "DRANGE"\n", seq->lss_name, + PRANGE(&seq->lss_space)); } up(&seq->lss_sem); @@ -149,8 +150,9 @@ seq_proc_write_super(struct file *file, const char *buffer, data, &seq->lss_super); if (rc == 0) { - CDEBUG(D_WARNING, "SEQ-MGR(srv): super-sequence has " - "changed to "DRANGE"\n", PRANGE(&seq->lss_super)); + CDEBUG(D_WARNING, "%s: super-sequence has " + "changed to "DRANGE"\n", seq->lss_name, + PRANGE(&seq->lss_super)); } up(&seq->lss_sem); @@ -218,8 +220,9 @@ seq_proc_write_super_width(struct file *file, const char *buffer, seq->lss_super_width = val; if (rc == 0) { - CDEBUG(D_WARNING, "SEQ-MGR(srv): super-sequence width " - "has changed to "LPU64"\n", seq->lss_super_width); + CDEBUG(D_WARNING, "%s: super-sequence width " + "has changed to "LPU64"\n", seq->lss_name, + seq->lss_super_width); } up(&seq->lss_sem); @@ -264,8 +267,9 @@ seq_proc_write_meta_width(struct file *file, const char *buffer, seq->lss_meta_width = val; if (rc == 0) { - CDEBUG(D_WARNING, "SEQ-MGR(srv): meta-sequence width " - "has changed to "LPU64"\n", seq->lss_meta_width); + CDEBUG(D_WARNING, "%s: meta-sequence width " + "has changed to "LPU64"\n", seq->lss_name, + seq->lss_meta_width); } } @@ -306,8 +310,9 @@ seq_proc_write_range(struct file *file, const char *buffer, data, &seq->lcs_range); if (rc == 0) { - CDEBUG(D_WARNING, "SEQ-MGR(cli): range has changed to " - DRANGE"\n", PRANGE(&seq->lcs_range)); + CDEBUG(D_WARNING, "%s: range has changed to " + DRANGE"\n", seq->lcs_name, + PRANGE(&seq->lcs_range)); } up(&seq->lcs_sem); @@ -353,8 +358,9 @@ seq_proc_write_seq_width(struct file *file, const char *buffer, seq->lcs_width = val; if (rc == 0) { - CDEBUG(D_WARNING, "SEQ-MGR(cli): sequence width " - "has changed to "LPU64"\n", seq->lcs_width); + CDEBUG(D_WARNING, "%s: sequence width " + "has changed to "LPU64"\n", seq->lcs_name, + seq->lcs_width); } } diff --git a/lustre/fld/fld_index.c b/lustre/fld/fld_index.c index 31d8dfa..07f6652 100644 --- a/lustre/fld/fld_index.c +++ b/lustre/fld/fld_index.c @@ -180,10 +180,10 @@ int fld_index_init(struct lu_server_fld *fld, if (rc == 0) LASSERT(dt_obj->do_index_ops != NULL); else - CERROR("\"%s\" is not an index!\n", + CERROR("File \"%s\" is not an index!\n", fld_index_name); } else { - CERROR("cannot find \"%s\" obj %d\n", + CERROR("Can't find \"%s\" obj %d\n", fld_index_name, (int)PTR_ERR(dt_obj)); rc = PTR_ERR(dt_obj); } diff --git a/lustre/fld/fld_request.c b/lustre/fld/fld_request.c index b5a9bd9..9fb6cd0 100644 --- a/lustre/fld/fld_request.c +++ b/lustre/fld/fld_request.c @@ -224,8 +224,7 @@ static int fld_client_proc_init(struct lu_client_fld *fld) rc = lprocfs_add_vars(fld->lcf_proc_dir, fld_client_proc_list, fld); if (rc) { - CERROR("can't init FLD " - "proc, rc %d\n", rc); + CERROR("Can't init FLD proc, rc %d\n", rc); GOTO(out_cleanup, rc); } @@ -439,6 +438,8 @@ int fld_client_create(struct lu_client_fld *fld, * cache errors. --umka */ fld_cache_insert(fld->lcf_cache, seq, mds); + } else { + CERROR("Can't create FLD entry, rc %d\n", rc); } RETURN(rc); } diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index 3316297..62c87c5 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -1439,6 +1439,10 @@ static int mdt_req_handle(struct mdt_thread_info *info, * correct actions like it is done in target_send_reply_msg(). */ if (h->mh_fail_id != 0) { + /* + * Set to info->mti_fail_id to handler fail_id, it will be used + * later, and better than use default fail_id. + */ info->mti_fail_id = h->mh_fail_id; if (OBD_FAIL_CHECK(h->mh_fail_id)) RETURN(0); @@ -1480,11 +1484,10 @@ static int mdt_req_handle(struct mdt_thread_info *info, */ rc = h->mh_act(info); /* - * XXX result value is unconditionally shoved into ->rq_status - * (original code sometimes placed error code into ->rq_status, and - * sometimes returned it to the - * caller). ptlrpc_server_handle_request() doesn't check return value - * anyway. + * XXX result value is unconditionally shoved into ->rq_status (original + * code sometimes placed error code into ->rq_status, and sometimes + * returned it to the caller). ptlrpc_server_handle_request() doesn't + * check return value anyway. */ req->rq_status = rc; rc = 0; -- 1.8.3.1