Whamcloud - gitweb
Fix BUG for mount permission:
authorfanyong <fanyong>
Wed, 29 Nov 2006 13:57:54 +0000 (13:57 +0000)
committerfanyong <fanyong>
Wed, 29 Nov 2006 13:57:54 +0000 (13:57 +0000)
(1) if client failed to identification, it should not reconnect endlessly.
(2) client should check the connection error and return the value correctly.

lustre/include/lustre_import.h
lustre/mdc/mdc_request.c
lustre/mdt/mdt_handler.c
lustre/mdt/mdt_idmap.c
lustre/ptlrpc/client.c
lustre/ptlrpc/import.c

index f29ea11..466f33d 100644 (file)
@@ -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;
 
index 27abf45..bb22de4 100644 (file)
@@ -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);
index a7ca30b..51b3293 100644 (file)
@@ -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;
index 0a22e4a..a5c32c8 100644 (file)
@@ -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
 
index 0f94d29..d184980 100644 (file)
@@ -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
index 4b60f96..84775b9 100644 (file)
@@ -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);
                 }