Whamcloud - gitweb
LU-9010 ptlrpc: Change static defines to use macro for gss_svc_upcall.c
[fs/lustre-release.git] / lustre / ptlrpc / gss / gss_svc_upcall.c
index 93d0f6a..1789649 100644 (file)
@@ -71,7 +71,7 @@
 
 #define GSS_SVC_UPCALL_TIMEOUT  (20)
 
-static spinlock_t __ctx_index_lock;
+static DEFINE_SPINLOCK(__ctx_index_lock);
 static __u64 __ctx_index;
 
 __u64 gss_get_next_ctx_index(void)
@@ -857,6 +857,13 @@ int gss_svc_upcall_install_rvs_ctx(struct obd_import *imp,
                break;
        case LUSTRE_SP_CLI:
                rsci.ctx.gsc_usr_root = 1;
+               break;
+       case LUSTRE_SP_MGS:
+               /* by convention, all 3 set to 1 means MGS */
+               rsci.ctx.gsc_usr_mds = 1;
+               rsci.ctx.gsc_usr_oss = 1;
+               rsci.ctx.gsc_usr_root = 1;
+               break;
        default:
                break;
        }
@@ -946,7 +953,11 @@ int gss_svc_upcall_handle_init(struct ptlrpc_request *req,
 
        memset(&rsikey, 0, sizeof(rsikey));
        rsikey.lustre_svc = lustre_svc;
-       rsikey.nid = (__u64) req->rq_peer.nid;
+       /* In case of MR, rq_peer is not the NID from which request is received,
+        * but primary NID of peer.
+        * So we need rq_source, which contains the NID actually in use.
+        */
+       rsikey.nid = (__u64) req->rq_source.nid;
        nodemap_test_nid(req->rq_peer.nid, rsikey.nm_name,
                         sizeof(rsikey.nm_name));
 
@@ -1150,7 +1161,6 @@ int __init gss_init_svc_upcall(void)
 {
        int     i, rc;
 
-       spin_lock_init(&__ctx_index_lock);
        /*
         * this helps reducing context index confliction. after server reboot,
         * conflicting request from clients might be filtered out by initial