From: fanyong Date: Wed, 29 Nov 2006 13:57:54 +0000 (+0000) Subject: Fix BUG for mount permission: X-Git-Tag: v1_8_0_110~486^2~58 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=074fd0adec9e5ecb946d8b9784fd0108766336b2;p=fs%2Flustre-release.git Fix BUG for mount permission: (1) if client failed to identification, it should not reconnect endlessly. (2) client should check the connection error and return the value correctly. --- diff --git a/lustre/include/lustre_import.h b/lustre/include/lustre_import.h index f29ea11..466f33d 100644 --- a/lustre/include/lustre_import.h +++ b/lustre/include/lustre_import.h @@ -107,6 +107,7 @@ struct obd_import { __u32 imp_connect_op; struct obd_connect_data imp_connect_data; __u64 imp_connect_flags_orig; + int imp_connect_error; __u32 imp_msg_magic; diff --git a/lustre/mdc/mdc_request.c b/lustre/mdc/mdc_request.c index 27abf45..bb22de4 100644 --- a/lustre/mdc/mdc_request.c +++ b/lustre/mdc/mdc_request.c @@ -1189,8 +1189,13 @@ static int mdc_statfs(struct obd_device *obd, struct obd_statfs *osfs, rc = ptlrpc_queue_wait(req); - if (rc) + if (rc) { + /* check connection error first */ + if (obd->u.cli.cl_import->imp_connect_error) + rc = obd->u.cli.cl_import->imp_connect_error; + GOTO(out, rc); + } msfs = lustre_swab_repbuf(req, REPLY_REC_OFF, sizeof(*msfs), lustre_swab_obd_statfs); diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index a7ca30b..51b3293 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -1011,6 +1011,9 @@ static int mdt_connect(struct mdt_thread_info *info) LASSERT(req->rq_export != NULL); info->mti_mdt = mdt_dev(req->rq_export->exp_obd->obd_lu_dev); rc = mdt_init_idmap(info); + if (rc != 0) + /* if mdt_init_idmap failed, revocation for connect */ + obd_disconnect(class_export_get(req->rq_export)); } else rc = err_serious(rc); return rc; diff --git a/lustre/mdt/mdt_idmap.c b/lustre/mdt/mdt_idmap.c index 0a22e4a..a5c32c8 100644 --- a/lustre/mdt/mdt_idmap.c +++ b/lustre/mdt/mdt_idmap.c @@ -145,7 +145,7 @@ int mdt_init_idmap(struct mdt_thread_info *info) if (req->rq_auth_uid == INVALID_UID) { CERROR("client %s -> target %s null sec is used, " "user not authenticated!\n", client, obd->obd_name); - RETURN(-EPERM); + RETURN(-EACCES); } #endif diff --git a/lustre/ptlrpc/client.c b/lustre/ptlrpc/client.c index 0f94d29..d184980 100644 --- a/lustre/ptlrpc/client.c +++ b/lustre/ptlrpc/client.c @@ -674,6 +674,7 @@ static int after_reply(struct ptlrpc_request *req) } rc = ptlrpc_check_status(req); + imp->imp_connect_error = rc; /* Either we've been evicted, or the server has failed for * some reason. Try to reconnect, and if that fails, punt to the diff --git a/lustre/ptlrpc/import.c b/lustre/ptlrpc/import.c index 4b60f96..84775b9 100644 --- a/lustre/ptlrpc/import.c +++ b/lustre/ptlrpc/import.c @@ -745,8 +745,12 @@ finish: if (aa->pcaa_initial_connect && !imp->imp_initial_recov) ptlrpc_deactivate_import(imp); - if (imp->imp_recon_bk && imp->imp_last_recon) { - /* Give up trying to reconnect */ + if ((imp->imp_recon_bk && imp->imp_last_recon) || + (rc == -EACCES)) { + /* + * Give up trying to reconnect + * EACCES means client has no permission for connection + */ imp->imp_obd->obd_no_recov = 1; ptlrpc_deactivate_import(imp); }