Whamcloud - gitweb
LU-9452 ldlm: remove MSG_CONNECT_LIBCLIENT support 72/26972/9
authorAndreas Dilger <andreas.dilger@intel.com>
Fri, 5 May 2017 23:39:48 +0000 (17:39 -0600)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 24 Oct 2017 07:18:30 +0000 (07:18 +0000)
Remove old server code that handled liblustre client connections,
marked with MSG_CONNECT_LIBCLIENT and associated code checking for
exp_libclient.  Servers will now outright refuse connections from
liblustre clients with a clear message, rather than allowing the
connection and pretending to work.  Liblustre client support was
broken and removed years ago.

There are still some liblustre remnants in the code (e.g. blocked
lock handling for LDLM_FL_CANCEL_ON_BLOCK), but that has more
complex semantics and should be removed in a separate patch.

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Change-Id: Ifbea507e82d758f849db24094c5cc0a8003ebbe5
Reviewed-on: https://review.whamcloud.com/26972
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Ben Evans <bevans@cray.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
16 files changed:
lustre/include/cl_object.h
lustre/include/lustre_export.h
lustre/include/lustre_net.h
lustre/include/obd.h
lustre/include/uapi/linux/lustre/lustre_idl.h
lustre/include/uapi/linux/lustre/lustre_ver.h
lustre/ldlm/ldlm_lib.c
lustre/ldlm/ldlm_lockd.c
lustre/llite/glimpse.c
lustre/llite/lcommon_misc.c
lustre/lov/lov_pool.c
lustre/mdt/mdt_open.c
lustre/obdclass/cl_object.c
lustre/ofd/ofd_dlm.c
lustre/ptlrpc/import.c
lustre/tests/sanityn.sh

index 00bd414..69b2281 100644 (file)
@@ -703,7 +703,7 @@ enum cl_page_type {
 
         /** Transient page, the transient cl_page is used to bind a cl_page
          *  to vmpage which is not belonging to the same object of cl_page.
-         *  it is used in DirectIO, lockless IO and liblustre. */
+         *  it is used in DirectIO and lockless IO. */
         CPT_TRANSIENT,
 };
 
index 1de4b00..c9ae7ea 100644 (file)
@@ -246,38 +246,37 @@ struct obd_export {
         * protects exp_flags, exp_outstanding_replies and the change
         * of exp_imp_reverse
         */
-       spinlock_t                exp_lock;
+       spinlock_t              exp_lock;
        /** Compatibility flags for this export are embedded into
         *  exp_connect_data */
-       struct obd_connect_data   exp_connect_data;
-        enum obd_option           exp_flags;
-        unsigned long             exp_failed:1,
-                                  exp_in_recovery:1,
-                                  exp_disconnected:1,
-                                  exp_connecting:1,
-                                  /** VBR: export missed recovery */
-                                  exp_delayed:1,
-                                  /** VBR: failed version checking */
-                                  exp_vbr_failed:1,
-                                  exp_req_replay_needed:1,
-                                  exp_lock_replay_needed:1,
-                                  exp_need_sync:1,
-                                  exp_flvr_changed:1,
-                                  exp_flvr_adapt:1,
-                                  exp_libclient:1, /* liblustre client? */
-                                 /* if to swap nidtbl entries for 2.2 clients.
-                                  * Only used by the MGS to fix LU-1644. */
-                                 exp_need_mne_swab:1,
-                                 /* The export already got final replay ping
-                                  * request. */
-                                 exp_replay_done:1;
-        /* also protected by exp_lock */
-        enum lustre_sec_part      exp_sp_peer;
-        struct sptlrpc_flavor     exp_flvr;             /* current */
-        struct sptlrpc_flavor     exp_flvr_old[2];      /* about-to-expire */
-       time64_t                  exp_flvr_expire[2];   /* seconds */
-
-        /** protects exp_hp_rpcs */
+       struct obd_connect_data exp_connect_data;
+       enum obd_option         exp_flags;
+       unsigned long           exp_failed:1,
+                               exp_in_recovery:1,
+                               exp_disconnected:1,
+                               exp_connecting:1,
+                               /** VBR: export missed recovery */
+                               exp_delayed:1,
+                               /** VBR: failed version checking */
+                               exp_vbr_failed:1,
+                               exp_req_replay_needed:1,
+                               exp_lock_replay_needed:1,
+                               exp_need_sync:1,
+                               exp_flvr_changed:1,
+                               exp_flvr_adapt:1,
+                               /* if to swap nidtbl entries for 2.2 clients.
+                                * Only used by the MGS to fix LU-1644. */
+                               exp_need_mne_swab:1,
+                               /* The export already got final replay ping
+                                * request. */
+                               exp_replay_done:1;
+       /* also protected by exp_lock */
+       enum lustre_sec_part    exp_sp_peer;
+       struct sptlrpc_flavor   exp_flvr;               /* current */
+       struct sptlrpc_flavor   exp_flvr_old[2];        /* about-to-expire */
+       time64_t                exp_flvr_expire[2];     /* seconds */
+
+       /** protects exp_hp_rpcs */
        spinlock_t              exp_rpc_lock;
        struct list_head        exp_hp_rpcs;    /* (potential) HP RPCs */
        struct list_head        exp_reg_rpcs;  /* RPC being handled */
index 4b5806e..3325ad6 100644 (file)
@@ -2297,8 +2297,6 @@ void ptlrpc_stop_all_threads(struct ptlrpc_service *svc);
 
 int ptlrpc_start_threads(struct ptlrpc_service *svc);
 int ptlrpc_unregister_service(struct ptlrpc_service *service);
-int liblustre_check_services(void *arg);
-void ptlrpc_daemonize(char *name);
 int ptlrpc_service_health_check(struct ptlrpc_service *);
 void ptlrpc_server_drop_request(struct ptlrpc_request *req);
 void ptlrpc_request_change_export(struct ptlrpc_request *req,
index da748f9..61aafdd 100644 (file)
@@ -542,7 +542,7 @@ enum obd_notify_event {
 
 /*
  * Data structure used to pass obd_notify()-event to non-obd listeners (llite
- * and liblustre being main examples).
+ * being main example).
  */
 struct obd_notify_upcall {
        int (*onu_upcall)(struct obd_device *host, struct obd_device *watched,
index 58816a7..9d76020 100644 (file)
@@ -713,7 +713,7 @@ struct ptlrpc_body_v2 {
 #define MSG_CONNECT_RECOVERING  0x00000001
 #define MSG_CONNECT_RECONNECT   0x00000002
 #define MSG_CONNECT_REPLAYABLE  0x00000004
-//#define MSG_CONNECT_PEER        0x8
+/* #define MSG_CONNECT_PEER        0x00000008 removed 1.5 */
 #define MSG_CONNECT_LIBCLIENT   0x00000010
 #define MSG_CONNECT_INITIAL     0x00000020
 #define MSG_CONNECT_ASYNC       0x00000040
index 0557c2d..90aa25d 100644 (file)
 #define LUSTRE_VERSION_CODE                                            \
        OBD_OCD_VERSION(LUSTRE_MAJOR, LUSTRE_MINOR, LUSTRE_PATCH, LUSTRE_FIX)
 
-/* liblustre clients are only allowed to connect if their LUSTRE_FIX mismatches
- * by this amount (set in lustre/autoconf/lustre-version.ac). */
-#define LUSTRE_VERSION_ALLOWED_OFFSET OBD_OCD_VERSION(0, 0, 1, 32)
-
-#ifdef __KERNEL__
 /* If lustre version of client and servers it connects to differs by more
  * than this amount, client would issue a warning.
  * (set in lustre/autoconf/lustre-version.ac) */
 #define LUSTRE_VERSION_OFFSET_WARN OBD_OCD_VERSION(0, 4, 50, 0)
-#endif
 
 #endif
index 429bf4c..59bc608 100644 (file)
@@ -1046,32 +1046,17 @@ int target_handle_connect(struct ptlrpc_request *req)
         */
        if (!(data->ocd_connect_flags & OBD_CONNECT_FULL20))
                GOTO(out, rc = -EPROTO);
-#endif
 
+       /* Don't allow liblustre clients to connect.
+        * - testing was disabled in v2_2_50_0-61-g6a75d65
+        * - building was disabled in v2_5_58_0-28-g7277179
+        * - client code was deleted in v2_6_50_0-101-gcdfbc72,
+        * - clients were refused connect for version difference > 0.0.1.32  */
        if (lustre_msg_get_op_flags(req->rq_reqmsg) & MSG_CONNECT_LIBCLIENT) {
-               if (data->ocd_version < LUSTRE_VERSION_CODE -
-                                              LUSTRE_VERSION_ALLOWED_OFFSET ||
-                   data->ocd_version > LUSTRE_VERSION_CODE +
-                                              LUSTRE_VERSION_ALLOWED_OFFSET) {
-                       DEBUG_REQ(D_WARNING, req, "Refusing %s (%d.%d.%d.%d) "
-                                 "libclient connection attempt",
-                                 data->ocd_version < LUSTRE_VERSION_CODE ?
-                                 "old" : "new",
-                                 OBD_OCD_VERSION_MAJOR(data->ocd_version),
-                                 OBD_OCD_VERSION_MINOR(data->ocd_version),
-                                 OBD_OCD_VERSION_PATCH(data->ocd_version),
-                                 OBD_OCD_VERSION_FIX(data->ocd_version));
-                       data = req_capsule_server_sized_get(&req->rq_pill,
-                                                           &RMF_CONNECT_DATA,
-                                   offsetof(typeof(*data), ocd_version) +
-                                            sizeof(data->ocd_version));
-                       if (data) {
-                               data->ocd_connect_flags = OBD_CONNECT_VERSION;
-                               data->ocd_version = LUSTRE_VERSION_CODE;
-                       }
-                       GOTO(out, rc = -EPROTO);
-               }
+               DEBUG_REQ(D_WARNING, req, "Refusing libclient connection");
+               GOTO(out, rc = -EPROTO);
        }
+#endif
 
        /* Note: lw_client is needed in MDS-MDS failover during update log
         * processing, so we needs to allow lw_client to be connected at
@@ -1328,37 +1313,26 @@ dont_check_exports:
                spin_unlock(&export->exp_lock);
                CDEBUG(D_RPCTRACE, "%s: %s already connected at greater "
                       "or equal conn_cnt: %d >= %d\n",
-                       cluuid.uuid, libcfs_nid2str(req->rq_peer.nid),
-                       export->exp_conn_cnt,
-                       lustre_msg_get_conn_cnt(req->rq_reqmsg));
+                      cluuid.uuid, libcfs_nid2str(req->rq_peer.nid),
+                      export->exp_conn_cnt,
+                      lustre_msg_get_conn_cnt(req->rq_reqmsg));
 
-                GOTO(out, rc = -EALREADY);
-        }
-        LASSERT(lustre_msg_get_conn_cnt(req->rq_reqmsg) > 0);
-        export->exp_conn_cnt = lustre_msg_get_conn_cnt(req->rq_reqmsg);
-
-       /* Don't evict liblustre clients for not pinging. */
-        if (lustre_msg_get_op_flags(req->rq_reqmsg) & MSG_CONNECT_LIBCLIENT) {
-                export->exp_libclient = 1;
-               spin_unlock(&export->exp_lock);
-
-               spin_lock(&target->obd_dev_lock);
-               list_del_init(&export->exp_obd_chain_timed);
-               spin_unlock(&target->obd_dev_lock);
-       } else {
-               spin_unlock(&export->exp_lock);
+               GOTO(out, rc = -EALREADY);
        }
+       LASSERT(lustre_msg_get_conn_cnt(req->rq_reqmsg) > 0);
+       export->exp_conn_cnt = lustre_msg_get_conn_cnt(req->rq_reqmsg);
+       spin_unlock(&export->exp_lock);
 
-        if (export->exp_connection != NULL) {
+       if (export->exp_connection != NULL) {
                /* Check to see if connection came from another NID. */
-                if ((export->exp_connection->c_peer.nid != req->rq_peer.nid) &&
+               if ((export->exp_connection->c_peer.nid != req->rq_peer.nid) &&
                    !hlist_unhashed(&export->exp_nid_hash))
-                        cfs_hash_del(export->exp_obd->obd_nid_hash,
-                                     &export->exp_connection->c_peer.nid,
-                                     &export->exp_nid_hash);
+                       cfs_hash_del(export->exp_obd->obd_nid_hash,
+                                    &export->exp_connection->c_peer.nid,
+                                    &export->exp_nid_hash);
 
-                ptlrpc_connection_put(export->exp_connection);
-        }
+               ptlrpc_connection_put(export->exp_connection);
+       }
 
        export->exp_connection = ptlrpc_connection_get(req->rq_peer,
                                                       req->rq_self,
index 3e80cb2..0ef2535 100644 (file)
@@ -654,14 +654,7 @@ static int ldlm_handle_ast_error(struct ldlm_lock *lock,
        struct lnet_process_id peer = req->rq_import->imp_connection->c_peer;
 
        if (!req->rq_replied || (rc && rc != -EINVAL)) {
-               if (lock->l_export && lock->l_export->exp_libclient) {
-                       LDLM_DEBUG(lock,
-                                  "%s AST (req@%p x%llu) to liblustre client (nid %s) timeout, just cancelling lock",
-                                  ast_type, req, req->rq_xid,
-                                  libcfs_nid2str(peer.nid));
-                       ldlm_lock_cancel(lock);
-                       rc = -ERESTART;
-               } else if (ldlm_is_cancel(lock)) {
+               if (ldlm_is_cancel(lock)) {
                        LDLM_DEBUG(lock,
                                   "%s AST (req@%p x%llu) timeout from nid %s, but cancel was received (AST reply lost?)",
                                   ast_type, req, req->rq_xid,
@@ -1432,34 +1425,9 @@ existing_lock:
                                 ldlm_add_waiting_lock(lock);
                 }
         }
-        /* Make sure we never ever grant usual metadata locks to liblustre
-           clients */
-        if ((dlm_req->lock_desc.l_resource.lr_type == LDLM_PLAIN ||
-            dlm_req->lock_desc.l_resource.lr_type == LDLM_IBITS) &&
-             req->rq_export->exp_libclient) {
-               if (unlikely(!ldlm_is_cancel_on_block(lock) ||
-                             !(dlm_rep->lock_flags & LDLM_FL_CANCEL_ON_BLOCK))){
-                        CERROR("Granting sync lock to libclient. "
-                              "req fl %d, rep fl %d, lock fl %#llx\n",
-                               dlm_req->lock_flags, dlm_rep->lock_flags,
-                               lock->l_flags);
-                        LDLM_ERROR(lock, "sync lock");
-                       if (dlm_req->lock_flags & LDLM_FL_HAS_INTENT) {
-                               struct ldlm_intent *it;
-
-                               it = req_capsule_client_get(&req->rq_pill,
-                                                           &RMF_LDLM_INTENT);
-                               if (it != NULL) {
-                                       CERROR("This is intent %s (%llu)\n",
-                                              ldlm_it2str(it->opc), it->opc);
-                               }
-                       }
-                }
-        }
-
-        unlock_res_and_lock(lock);
+       unlock_res_and_lock(lock);
 
-        EXIT;
+       EXIT;
  out:
         req->rq_status = rc ?: err; /* return either error - bug 11190 */
         if (!req->rq_packed_final) {
index 166fff0..76bf3ee 100644 (file)
@@ -29,8 +29,7 @@
  * This file is part of Lustre, http://www.lustre.org/
  * Lustre is a trademark of Sun Microsystems, Inc.
  *
- * glimpse code shared between vvp and liblustre (and other Lustre clients in
- * the future).
+ * glimpse code used by vvp (and other Lustre clients in the future).
  *
  *   Author: Nikita Danilov <nikita.danilov@sun.com>
  *   Author: Oleg Drokin <oleg.drokin@sun.com>
index ced348a..970cbd4 100644 (file)
@@ -29,8 +29,7 @@
  * This file is part of Lustre, http://www.lustre.org/
  * Lustre is a trademark of Sun Microsystems, Inc.
  *
- * cl code shared between vvp and liblustre (and other Lustre clients in the
- * future).
+ * cl code used by vvp (and other Lustre clients in the future).
  *
  */
 #define DEBUG_SUBSYSTEM S_LLITE
index 08ecfde..f7000cd 100644 (file)
@@ -151,7 +151,6 @@ struct cfs_hash_ops pool_hash_operations = {
 };
 
 #ifdef CONFIG_PROC_FS
-/* ifdef needed for liblustre support */
 /*
  * pool /proc seq_file methods
  */
index e04c202..cd0d8b8 100644 (file)
@@ -1284,17 +1284,12 @@ int mdt_reint_open(struct mdt_thread_info *info, struct mdt_lock_handle *lhc)
                result = mdt_cross_open(info, rr->rr_fid2, rr->rr_fid1,
                                        ldlm_rep, create_flags);
                GOTO(out, result);
-       } else if (req_is_replay(req) ||
-           (req->rq_export->exp_libclient && create_flags & MDS_OPEN_HAS_EA)) {
-               /* This is a replay request or from liblustre with ea. */
+       } else if (req_is_replay(req)) {
                result = mdt_open_by_fid(info, ldlm_rep);
 
-               if (result != -ENOENT) {
-                       if (req->rq_export->exp_libclient &&
-                           create_flags & MDS_OPEN_HAS_EA)
-                               GOTO(out, result = 0);
+               if (result != -ENOENT)
                        GOTO(out, result);
-               }
+
                /* We didn't find the correct object, so we need to re-create it
                 * via a regular replay. */
                if (!(create_flags & MDS_OPEN_CREAT)) {
index 7f651bc..c125c3a 100644 (file)
@@ -550,19 +550,16 @@ EXPORT_SYMBOL(cl_site_stats_print);
 
 /**
  * The most efficient way is to store cl_env pointer in task specific
- * structures. On Linux, it wont' be easy to use task_struct->journal_info
- * because Lustre code may call into other fs which has certain assumptions
- * about journal_info. Currently following fields in task_struct are identified
- * can be used for this purpose:
- *  - cl_env: for liblustre.
- *  - tux_info: ony on RedHat kernel.
- *  - ...
+ * structures. On Linux, it isn't easy to use task_struct->journal_info
+ * because Lustre code may call into other fs during memory reclaim, which
+ * has certain assumptions about journal_info. There are not currently any
+ * fields in task_struct that can be used for this purpose.
  * \note As long as we use task_struct to store cl_env, we assume that once
  * called into Lustre, we'll never call into the other part of the kernel
  * which will use those fields in task_struct without explicitly exiting
  * Lustre.
  *
- * If there's no space in task_struct is available, hash will be used.
+ * Since there's no space in task_struct is available, hash will be used.
  * bz20044, bz22683.
  */
 
index c18ade0..80420ef 100644 (file)
@@ -138,7 +138,6 @@ static enum interval_iter ofd_intent_cb(struct interval_node *n, void *args)
 
        /* Find the 'victim' lock from this interval */
        list_for_each_entry(lck, &node->li_group, l_sl_policy) {
-
                victim_lock = LDLM_LOCK_GET(lck);
 
                /* the same policy group - every lock has the
index d1777b5..c31004a 100644 (file)
@@ -822,7 +822,6 @@ static int ptlrpc_connect_set_flags(struct obd_import *imp,
 
        spin_unlock(&imp->imp_lock);
 
-
        if (!warned && (ocd->ocd_connect_flags & OBD_CONNECT_VERSION) &&
            (ocd->ocd_version > LUSTRE_VERSION_CODE +
                                LUSTRE_VERSION_OFFSET_WARN ||
@@ -833,7 +832,7 @@ static int ptlrpc_connect_set_flags(struct obd_import *imp,
                const char *older = "older than client. "
                                    "Consider upgrading server";
                const char *newer = "newer than client. "
-                                   "Consider recompiling application";
+                                   "Consider upgrading client";
 
                LCONSOLE_WARN("Server %s version (%d.%d.%d.%d) "
                              "is much %s (%s)\n",
@@ -1304,14 +1303,15 @@ out:
                         if (request->rq_repmsg == NULL)
                                 RETURN(-EPROTO);
 
-                        ocd = req_capsule_server_get(&request->rq_pill,
-                                                     &RMF_CONNECT_DATA);
-                        if (ocd &&
-                            (ocd->ocd_connect_flags & OBD_CONNECT_VERSION) &&
-                            (ocd->ocd_version != LUSTRE_VERSION_CODE)) {
-                           /* Actually servers are only supposed to refuse
-                              connection from liblustre clients, so we should
-                              never see this from VFS context */
+                       ocd = req_capsule_server_get(&request->rq_pill,
+                                                    &RMF_CONNECT_DATA);
+                       /* Servers are not supposed to refuse connections from
+                        * clients based on version, only connection feature
+                        * flags.  We should never see this from llite, but it
+                        * may be useful for debugging in the future. */
+                       if (ocd &&
+                           (ocd->ocd_connect_flags & OBD_CONNECT_VERSION) &&
+                           (ocd->ocd_version != LUSTRE_VERSION_CODE)) {
                                 LCONSOLE_ERROR_MSG(0x16a, "Server %s version "
                                         "(%d.%d.%d.%d)"
                                         " refused connection from this client "
index 821cae9..29ba159 100755 (executable)
@@ -679,19 +679,7 @@ test_28() { # bug 9977
 }
 run_test 28 "read/write/truncate file with lost stripes"
 
-test_29() { # bug 10999
-       touch $DIR1/$tfile
-       #define OBD_FAIL_LDLM_GLIMPSE  0x30f
-       lctl set_param fail_loc=0x8000030f
-       ls -l $DIR2/$tfile &
-       usleep 500
-       dd if=/dev/zero of=$DIR1/$tfile bs=4k count=1
-       wait
-}
-#bug 11549 - permanently turn test off in b1_5
-run_test 29 "lock put race between glimpse and enqueue ========="
-
-test_30() { #bug #11110, LU-2523
+test_30() { #b=11110, LU-2523
        test_mkdir $DIR1/$tdir
        cp -f /bin/bash $DIR1/$tdir/bash
        /bin/sh -c 'sleep 1; rm -f $DIR2/$tdir/bash; cp /bin/bash $DIR2/$tdir' &
@@ -700,7 +688,6 @@ test_30() { #bug #11110, LU-2523
        wait
        true
 }
-
 run_test 30 "recreate file race"
 
 test_31a() {