Whamcloud - gitweb
LU-5560 obd: reserve connection flag OBD_CONNECT2_FILE_SECCTX 70/19970/8
authorJohn L. Hammond <john.hammond@intel.com>
Thu, 11 Feb 2016 19:22:02 +0000 (13:22 -0600)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 14 Jun 2016 03:53:51 +0000 (03:53 +0000)
The connection flag OBD_CONNECT2_FILE_SECCTX will be set (in
ocd_connect_flags2) if an MDT supports setting the file security
context at create time.

This patch is ported from the following one:
Lustre-commit: f0f79ede2105dd40665bd8b60c2c5f274290ab57
Lustre-change: http://review.whamcloud.com/18420

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Signed-off-by: Sebastien Buisson <sbuisson@ddn.com>
Intel-bug-id: LDEV-236
Change-Id: Ib79ef50bbcd68baa624ece109fa204dfd7f8b128
Reviewed-on: http://review.whamcloud.com/19970
Reviewed-by: Fan Yong <fan.yong@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
16 files changed:
lustre/include/lustre/lustre_idl.h
lustre/include/lustre_import.h
lustre/include/obd_class.h
lustre/ldlm/ldlm_lib.c
lustre/llite/llite_lib.c
lustre/mdt/mdt_handler.c
lustre/mgs/mgs_handler.c
lustre/obdclass/lprocfs_status.c
lustre/obdecho/echo.c
lustre/ofd/ofd_obd.c
lustre/osp/lwp_dev.c
lustre/osp/osp_dev.c
lustre/ptlrpc/import.c
lustre/ptlrpc/wiretest.c
lustre/utils/wirecheck.c
lustre/utils/wiretest.c

index be0fc4a..ee739cc 100644 (file)
@@ -1250,6 +1250,9 @@ struct ptlrpc_body_v2 {
 #define OBD_CONNECT_BULK_MBITS  0x2000000000000000ULL
 #define OBD_CONNECT_OBDOPACK    0x4000000000000000ULL /* compact OUT obdo */
 #define OBD_CONNECT_FLAGS2      0x8000000000000000ULL /* second flags word */
+/* ocd_connect_flags2 flags */
+#define OBD_CONNECT2_FILE_SECCTX       0x1ULL /* set file security context at create */
+
 /* XXX README XXX:
  * Please DO NOT add flag values here before first ensuring that this same
  * flag value is not in use on some other branch.  Please clear any such
@@ -1297,7 +1300,10 @@ struct ptlrpc_body_v2 {
                                OBD_CONNECT_DIR_STRIPE | \
                                OBD_CONNECT_BULK_MBITS | \
                                OBD_CONNECT_MULTIMODRPCS | \
-                               OBD_CONNECT_SUBTREE)
+                               OBD_CONNECT_SUBTREE | \
+                               OBD_CONNECT_FLAGS2)
+
+#define MDT_CONNECT_SUPPORTED2 OBD_CONNECT2_FILE_SECCTX
 
 #define OST_CONNECT_SUPPORTED  (OBD_CONNECT_SRVLOCK | OBD_CONNECT_GRANT | \
                                 OBD_CONNECT_REQPORTAL | OBD_CONNECT_VERSION | \
@@ -1318,12 +1324,18 @@ struct ptlrpc_body_v2 {
                                OBD_CONNECT_PINGLESS | OBD_CONNECT_LFSCK | \
                                OBD_CONNECT_BULK_MBITS | \
                                OBD_CONNECT_GRANT_PARAM)
-#define ECHO_CONNECT_SUPPORTED (0)
+#define OST_CONNECT_SUPPORTED2 0
+
+#define ECHO_CONNECT_SUPPORTED 0
+#define ECHO_CONNECT_SUPPORTED2 0
+
 #define MGS_CONNECT_SUPPORTED  (OBD_CONNECT_VERSION | OBD_CONNECT_AT | \
                                OBD_CONNECT_FULL20 | OBD_CONNECT_IMP_RECOV | \
                                OBD_CONNECT_MNE_SWAB | OBD_CONNECT_PINGLESS |\
                                OBD_CONNECT_BULK_MBITS)
 
+#define MGS_CONNECT_SUPPORTED2 0
+
 /* Features required for this version of the client to work with server */
 #define CLIENT_CONNECT_MDT_REQD (OBD_CONNECT_IBITS | OBD_CONNECT_FID | \
                                  OBD_CONNECT_FULL20)
index 6bc308d..4b419ba 100644 (file)
@@ -312,16 +312,19 @@ struct obd_import {
                                  imp_connect_tried:1,
                                  /* connected but not FULL yet */
                                  imp_connected:1;
-        __u32                     imp_connect_op;
-        struct obd_connect_data   imp_connect_data;
-        __u64                     imp_connect_flags_orig;
-        int                       imp_connect_error;
-
-        __u32                     imp_msg_magic;
-        __u32                     imp_msghdr_flags;       /* adjusted based on server capability */
-
-        struct imp_at             imp_at;                 /* adaptive timeout data */
-        time_t                    imp_last_reply_time;    /* for health check */
+       __u32                     imp_connect_op;
+       struct obd_connect_data   imp_connect_data;
+       __u64                     imp_connect_flags_orig;
+       __u64                     imp_connect_flags2_orig;
+       int                       imp_connect_error;
+
+       __u32                     imp_msg_magic;
+                                 /* adjusted based on server capability */
+       __u32                     imp_msghdr_flags;
+
+                                 /* adaptive timeout data */
+       struct imp_at             imp_at;
+       time_t                    imp_last_reply_time;    /* for health check */
 };
 
 /* import.c */
index 39ecf6b..386b2e6 100644 (file)
@@ -101,7 +101,8 @@ char *obd_export_nid2str(struct obd_export *exp);
 
 int obd_export_evict_by_nid(struct obd_device *obd, const char *nid);
 int obd_export_evict_by_uuid(struct obd_device *obd, const char *uuid);
-int obd_connect_flags2str(char *page, int count, __u64 flags, char *sep);
+int obd_connect_flags2str(char *page, int count, __u64 flags, __u64 flags2,
+                         const char *sep);
 
 int obd_zombie_impexp_init(void);
 void obd_zombie_impexp_stop(void);
index 928913c..aeeee64 100644 (file)
@@ -537,65 +537,66 @@ int client_connect_import(const struct lu_env *env,
        bool                    is_mdc = false;
        ENTRY;
 
-        *exp = NULL;
+       *exp = NULL;
        down_write(&cli->cl_sem);
        if (cli->cl_conn_count > 0)
                 GOTO(out_sem, rc = -EALREADY);
 
-        rc = class_connect(&conn, obd, cluuid);
-        if (rc)
-                GOTO(out_sem, rc);
+       rc = class_connect(&conn, obd, cluuid);
+       if (rc)
+               GOTO(out_sem, rc);
 
-        cli->cl_conn_count++;
-        *exp = class_conn2export(&conn);
+       cli->cl_conn_count++;
+       *exp = class_conn2export(&conn);
 
-        LASSERT(obd->obd_namespace);
+       LASSERT(obd->obd_namespace);
 
-        imp->imp_dlm_handle = conn;
-        rc = ptlrpc_init_import(imp);
-        if (rc != 0)
-                GOTO(out_ldlm, rc);
+       imp->imp_dlm_handle = conn;
+       rc = ptlrpc_init_import(imp);
+       if (rc != 0)
+               GOTO(out_ldlm, rc);
 
-        ocd = &imp->imp_connect_data;
-        if (data) {
-                *ocd = *data;
+       ocd = &imp->imp_connect_data;
+       if (data) {
+               *ocd = *data;
                is_mdc = strncmp(imp->imp_obd->obd_type->typ_name,
                                 LUSTRE_MDC_NAME, 3) == 0;
                if (is_mdc)
                        data->ocd_connect_flags |= OBD_CONNECT_MULTIMODRPCS;
-                imp->imp_connect_flags_orig = data->ocd_connect_flags;
-        }
+               imp->imp_connect_flags_orig = data->ocd_connect_flags;
+               imp->imp_connect_flags2_orig = data->ocd_connect_flags2;
+       }
 
-        rc = ptlrpc_connect_import(imp);
-        if (rc != 0) {
+       rc = ptlrpc_connect_import(imp);
+       if (rc != 0) {
                if (data && is_mdc)
                        data->ocd_connect_flags &= ~OBD_CONNECT_MULTIMODRPCS;
-                LASSERT (imp->imp_state == LUSTRE_IMP_DISCON);
-                GOTO(out_ldlm, rc);
-        }
+               LASSERT(imp->imp_state == LUSTRE_IMP_DISCON);
+               GOTO(out_ldlm, rc);
+       }
        LASSERT(*exp != NULL && (*exp)->exp_connection);
 
-        if (data) {
-                LASSERTF((ocd->ocd_connect_flags & data->ocd_connect_flags) ==
-                         ocd->ocd_connect_flags, "old "LPX64", new "LPX64"\n",
-                         data->ocd_connect_flags, ocd->ocd_connect_flags);
-                data->ocd_connect_flags = ocd->ocd_connect_flags;
+       if (data) {
+               LASSERTF((ocd->ocd_connect_flags & data->ocd_connect_flags) ==
+                        ocd->ocd_connect_flags, "old "LPX64", new "LPX64"\n",
+                        data->ocd_connect_flags, ocd->ocd_connect_flags);
+               data->ocd_connect_flags = ocd->ocd_connect_flags;
                /* clear the flag as it was not set and is not known
                 * by upper layers */
                if (is_mdc)
                        data->ocd_connect_flags &= ~OBD_CONNECT_MULTIMODRPCS;
-        }
+       }
 
-        ptlrpc_pinger_add_import(imp);
+       ptlrpc_pinger_add_import(imp);
 
-        EXIT;
+       EXIT;
 
-        if (rc) {
+       if (rc) {
 out_ldlm:
-                cli->cl_conn_count--;
-                class_disconnect(*exp);
-                *exp = NULL;
-        }
+               cli->cl_conn_count--;
+               class_disconnect(*exp);
+               *exp = NULL;
+       }
 out_sem:
        up_write(&cli->cl_sem);
 
index d3feef1..710cbcb 100644 (file)
@@ -210,7 +210,10 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt,
                                  OBD_CONNECT_OPEN_BY_FID |
                                  OBD_CONNECT_DIR_STRIPE |
                                  OBD_CONNECT_BULK_MBITS |
-                                 OBD_CONNECT_SUBTREE;
+                                 OBD_CONNECT_SUBTREE |
+                                 OBD_CONNECT_FLAGS2;
+
+       data->ocd_connect_flags2 = 0;
 
 #ifdef HAVE_LRU_RESIZE_SUPPORT
         if (sbi->ll_flags & LL_SBI_LRU_RESIZE)
@@ -296,7 +299,7 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt,
 
                OBD_ALLOC_WAIT(buf, PAGE_CACHE_SIZE);
                obd_connect_flags2str(buf, PAGE_CACHE_SIZE,
-                                     valid ^ CLIENT_CONNECT_MDT_REQD, ",");
+                                     valid ^ CLIENT_CONNECT_MDT_REQD, 0, ",");
                LCONSOLE_ERROR_MSG(0x170, "Server %s does not support "
                                   "feature(s) needed for correct operation "
                                   "of this client (%s). Please upgrade "
@@ -400,38 +403,40 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt,
                                  OBD_CONNECT_PINGLESS | OBD_CONNECT_LFSCK |
                                  OBD_CONNECT_BULK_MBITS;
 
+       data->ocd_connect_flags2 = 0;
+
        if (!OBD_FAIL_CHECK(OBD_FAIL_OSC_CONNECT_GRANT_PARAM))
                data->ocd_connect_flags |= OBD_CONNECT_GRANT_PARAM;
 
-        if (!OBD_FAIL_CHECK(OBD_FAIL_OSC_CONNECT_CKSUM)) {
-                /* OBD_CONNECT_CKSUM should always be set, even if checksums are
-                 * disabled by default, because it can still be enabled on the
-                 * fly via /proc. As a consequence, we still need to come to an
-                 * agreement on the supported algorithms at connect time */
-                data->ocd_connect_flags |= OBD_CONNECT_CKSUM;
+       if (!OBD_FAIL_CHECK(OBD_FAIL_OSC_CONNECT_CKSUM)) {
+               /* OBD_CONNECT_CKSUM should always be set, even if checksums are
+                * disabled by default, because it can still be enabled on the
+                * fly via /proc. As a consequence, we still need to come to an
+                * agreement on the supported algorithms at connect time */
+               data->ocd_connect_flags |= OBD_CONNECT_CKSUM;
 
                if (OBD_FAIL_CHECK(OBD_FAIL_OSC_CKSUM_ADLER_ONLY))
                        data->ocd_cksum_types = OBD_CKSUM_ADLER;
                else
                        data->ocd_cksum_types = cksum_types_supported_client();
-        }
+       }
 
 #ifdef HAVE_LRU_RESIZE_SUPPORT
-        data->ocd_connect_flags |= OBD_CONNECT_LRU_RESIZE;
+       data->ocd_connect_flags |= OBD_CONNECT_LRU_RESIZE;
 #endif
-        if (sbi->ll_flags & LL_SBI_RMT_CLIENT)
-                data->ocd_connect_flags |= OBD_CONNECT_RMT_CLIENT_FORCE;
+       if (sbi->ll_flags & LL_SBI_RMT_CLIENT)
+               data->ocd_connect_flags |= OBD_CONNECT_RMT_CLIENT_FORCE;
 
        /* always ping even if server suppress_pings */
        if (sbi->ll_flags & LL_SBI_ALWAYS_PING)
                data->ocd_connect_flags &= ~OBD_CONNECT_PINGLESS;
 
-        CDEBUG(D_RPCTRACE, "ocd_connect_flags: "LPX64" ocd_version: %d "
-               "ocd_grant: %d\n", data->ocd_connect_flags,
-               data->ocd_version, data->ocd_grant);
+       CDEBUG(D_RPCTRACE, "ocd_connect_flags: "LPX64" ocd_version: %d "
+              "ocd_grant: %d\n", data->ocd_connect_flags,
+              data->ocd_version, data->ocd_grant);
 
-        obd->obd_upcall.onu_owner = &sbi->ll_lco;
-        obd->obd_upcall.onu_upcall = cl_ocd_update;
+       obd->obd_upcall.onu_owner = &sbi->ll_lco;
+       obd->obd_upcall.onu_upcall = cl_ocd_update;
 
        data->ocd_brw_size = DT_MAX_BRW_SIZE;
 
@@ -482,7 +487,7 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt,
 
        sb->s_op = &lustre_super_operations;
 #if THREAD_SIZE >= 8192 /*b=17630*/
-        sb->s_export_op = &lustre_export_operations;
+       sb->s_export_op = &lustre_export_operations;
 #endif
 
        /* make root inode
@@ -518,38 +523,38 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt,
                GOTO(out_lock_cn_cb, err);
        }
 
-        LASSERT(fid_is_sane(&sbi->ll_root_fid));
+       LASSERT(fid_is_sane(&sbi->ll_root_fid));
        root = ll_iget(sb, cl_fid_build_ino(&sbi->ll_root_fid,
                                            sbi->ll_flags & LL_SBI_32BIT_API),
                       &lmd);
-        md_free_lustre_md(sbi->ll_md_exp, &lmd);
-        ptlrpc_req_finished(request);
+       md_free_lustre_md(sbi->ll_md_exp, &lmd);
+       ptlrpc_req_finished(request);
 
        if (IS_ERR(root)) {
 #ifdef CONFIG_FS_POSIX_ACL
-                if (lmd.posix_acl) {
-                        posix_acl_release(lmd.posix_acl);
-                        lmd.posix_acl = NULL;
-                }
+               if (lmd.posix_acl) {
+                       posix_acl_release(lmd.posix_acl);
+                       lmd.posix_acl = NULL;
+               }
 #endif
-                err = IS_ERR(root) ? PTR_ERR(root) : -EBADF;
-                root = NULL;
-                CERROR("lustre_lite: bad iget4 for root\n");
-                GOTO(out_root, err);
-        }
+               err = IS_ERR(root) ? PTR_ERR(root) : -EBADF;
+               root = NULL;
+               CERROR("lustre_lite: bad iget4 for root\n");
+               GOTO(out_root, err);
+       }
 
 #ifdef CONFIG_FS_POSIX_ACL
-        if (sbi->ll_flags & LL_SBI_RMT_CLIENT) {
-                rct_init(&sbi->ll_rct);
-                et_init(&sbi->ll_et);
-        }
+       if (sbi->ll_flags & LL_SBI_RMT_CLIENT) {
+               rct_init(&sbi->ll_rct);
+               et_init(&sbi->ll_et);
+       }
 #endif
 
-        checksum = sbi->ll_flags & LL_SBI_CHECKSUM;
-        err = obd_set_info_async(NULL, sbi->ll_dt_exp, sizeof(KEY_CHECKSUM),
-                                 KEY_CHECKSUM, sizeof(checksum), &checksum,
-                                 NULL);
-        cl_sb_init(sb);
+       checksum = sbi->ll_flags & LL_SBI_CHECKSUM;
+       err = obd_set_info_async(NULL, sbi->ll_dt_exp, sizeof(KEY_CHECKSUM),
+                                KEY_CHECKSUM, sizeof(checksum), &checksum,
+                                NULL);
+       cl_sb_init(sb);
 
        err = obd_set_info_async(NULL, sbi->ll_dt_exp, sizeof(KEY_CACHE_SET),
                                 KEY_CACHE_SET, sizeof(*sbi->ll_cache),
@@ -565,21 +570,21 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt,
        sb->s_root->d_op = &ll_d_ops;
 #endif
 
-        sbi->ll_sdev_orig = sb->s_dev;
+       sbi->ll_sdev_orig = sb->s_dev;
 
-        /* We set sb->s_dev equal on all lustre clients in order to support
-         * NFS export clustering.  NFSD requires that the FSID be the same
-         * on all clients. */
-        /* s_dev is also used in lt_compare() to compare two fs, but that is
-         * only a node-local comparison. */
-        uuid = obd_get_uuid(sbi->ll_md_exp);
+       /* We set sb->s_dev equal on all lustre clients in order to support
+        * NFS export clustering.  NFSD requires that the FSID be the same
+        * on all clients. */
+       /* s_dev is also used in lt_compare() to compare two fs, but that is
+        * only a node-local comparison. */
+       uuid = obd_get_uuid(sbi->ll_md_exp);
        if (uuid != NULL)
                sb->s_dev = get_uuid2int(uuid->uuid, strlen(uuid->uuid));
 
-        if (data != NULL)
-                OBD_FREE_PTR(data);
-        if (osfs != NULL)
-                OBD_FREE_PTR(osfs);
+       if (data != NULL)
+               OBD_FREE_PTR(data);
+       if (osfs != NULL)
+               OBD_FREE_PTR(osfs);
        if (proc_lustre_fs_root != NULL) {
                err = lprocfs_register_mountpoint(proc_lustre_fs_root, sb,
                                                  dt, md);
@@ -590,26 +595,26 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt,
                }
        }
 
-        RETURN(err);
+       RETURN(err);
 out_root:
-        if (root)
-                iput(root);
+       if (root)
+               iput(root);
 out_lock_cn_cb:
        obd_fid_fini(sbi->ll_dt_exp->exp_obd);
 out_dt:
-        obd_disconnect(sbi->ll_dt_exp);
-        sbi->ll_dt_exp = NULL;
+       obd_disconnect(sbi->ll_dt_exp);
+       sbi->ll_dt_exp = NULL;
 out_md_fid:
        obd_fid_fini(sbi->ll_md_exp->exp_obd);
 out_md:
-        obd_disconnect(sbi->ll_md_exp);
-        sbi->ll_md_exp = NULL;
+       obd_disconnect(sbi->ll_md_exp);
+       sbi->ll_md_exp = NULL;
 out:
-        if (data != NULL)
-                OBD_FREE_PTR(data);
-        if (osfs != NULL)
-                OBD_FREE_PTR(osfs);
-        return err;
+       if (data != NULL)
+               OBD_FREE_PTR(data);
+       if (osfs != NULL)
+               OBD_FREE_PTR(osfs);
+       return err;
 }
 
 int ll_get_max_mdsize(struct ll_sb_info *sbi, int *lmmsize)
index d9cc115..a977d29 100644 (file)
@@ -5071,6 +5071,7 @@ static int mdt_connect_internal(struct obd_export *exp,
        LASSERT(data != NULL);
 
        data->ocd_connect_flags &= MDT_CONNECT_SUPPORTED;
+       data->ocd_connect_flags2 &= MDT_CONNECT_SUPPORTED2;
        data->ocd_ibits_known &= MDS_INODELOCK_FULL;
 
        if (!(data->ocd_connect_flags & OBD_CONNECT_MDS_MDS) &&
index d59a49b..b6aaca3 100644 (file)
@@ -1497,6 +1497,7 @@ static int mgs_obd_connect(const struct lu_env *env, struct obd_export **exp,
 
        if (data != NULL) {
                data->ocd_connect_flags &= MGS_CONNECT_SUPPORTED;
+               data->ocd_connect_flags2 &= MGS_CONNECT_SUPPORTED2;
                data->ocd_version = LUSTRE_VERSION_CODE;
                lexp->exp_connect_data = *data;
        }
@@ -1525,6 +1526,7 @@ static int mgs_obd_reconnect(const struct lu_env *env, struct obd_export *exp,
 
        if (data != NULL) {
                data->ocd_connect_flags &= MGS_CONNECT_SUPPORTED;
+               data->ocd_connect_flags2 &= MGS_CONNECT_SUPPORTED2;
                data->ocd_version = LUSTRE_VERSION_CODE;
                exp->exp_connect_data = *data;
        }
index 650fc05..fce0bb1 100644 (file)
@@ -599,6 +599,7 @@ static void obd_import_flags2str(struct obd_import *imp, struct seq_file *m)
 #undef flag2str
 
 static const char *obd_connect_names[] = {
+       /* flags names  */
        "read_only",
        "lov_index",
        "connect_from_mds",
@@ -663,41 +664,81 @@ static const char *obd_connect_names[] = {
        "bulk_mbits",
        "compact_obdo",
        "second_flags",
+       /* flags2 names */
+       "file_secctx",
        NULL
 };
 
-static void obd_connect_seq_flags2str(struct seq_file *m, __u64 flags, char *sep)
+static void obd_connect_seq_flags2str(struct seq_file *m, __u64 flags,
+                                     __u64 flags2, const char *sep)
 {
        bool first = true;
-       __u64 mask = 1;
+       __u64 mask;
        int i;
 
-       for (i = 0; obd_connect_names[i] != NULL; i++, mask <<= 1) {
+       for (i = 0, mask = 1; i < 64; i++, mask <<= 1) {
                if (flags & mask) {
                        seq_printf(m, "%s%s",
                                   first ? "" : sep, obd_connect_names[i]);
                        first = false;
                }
        }
-       if (flags & ~(mask - 1))
+
+       if (flags & ~(mask - 1)) {
                seq_printf(m, "%sunknown_"LPX64,
                           first ? "" : sep, flags & ~(mask - 1));
+               first = false;
+       }
+
+       if (!(flags & OBD_CONNECT_FLAGS2) || flags2 == 0)
+               return;
+
+       for (i = 64, mask = 1; obd_connect_names[i] != NULL; i++, mask <<= 1) {
+               if (flags2 & mask) {
+                       seq_printf(m, "%s%s",
+                                  first ? "" : sep, obd_connect_names[i]);
+                       first = false;
+               }
+       }
+
+       if (flags2 & ~(mask - 1)) {
+               seq_printf(m, "%sunknown2_"LPX64,
+                          first ? "" : sep, flags2 & ~(mask - 1));
+               first = false;
+       }
 }
 
-int obd_connect_flags2str(char *page, int count, __u64 flags, char *sep)
+int obd_connect_flags2str(char *page, int count, __u64 flags, __u64 flags2,
+                         const char *sep)
 {
-       __u64 mask = 1;
+       __u64 mask;
        int i, ret = 0;
 
-       for (i = 0; obd_connect_names[i] != NULL; i++, mask <<= 1) {
+       for (i = 0, mask = 1; i < 64; i++, mask <<= 1) {
                if (flags & mask)
                        ret += snprintf(page + ret, count - ret, "%s%s",
                                        ret ? sep : "", obd_connect_names[i]);
        }
+
        if (flags & ~(mask - 1))
                ret += snprintf(page + ret, count - ret,
                                "%sunknown_"LPX64,
                                ret ? sep : "", flags & ~(mask - 1));
+
+       if (!(flags & OBD_CONNECT_FLAGS2) || flags2 == 0)
+               return ret;
+
+       for (i = 64, mask = 1; obd_connect_names[i] != NULL; i++, mask <<= 1) {
+               if (flags2 & mask)
+                       ret += snprintf(page + ret, count - ret, "%s%s",
+                                       ret ? sep : "", obd_connect_names[i]);
+       }
+
+       if (flags2 & ~(mask - 1))
+               ret += snprintf(page + ret, count - ret,
+                               "%sunknown2_"LPX64,
+                               ret ? sep : "", flags2 & ~(mask - 1));
+
        return ret;
 }
 EXPORT_SYMBOL(obd_connect_flags2str);
@@ -784,6 +825,7 @@ int lprocfs_import_seq_show(struct seq_file *m, void *data)
                   obd2cli_tgt(obd),
                   ptlrpc_import_state_name(imp->imp_state));
        obd_connect_seq_flags2str(m, imp->imp_connect_data.ocd_connect_flags,
+                                 imp->imp_connect_data.ocd_connect_flags2,
                                  ", ");
        seq_printf(m, " ]\n");
        obd_connect_data_seqprint(m, ocd);
@@ -989,11 +1031,14 @@ int lprocfs_connect_flags_seq_show(struct seq_file *m, void *data)
 {
        struct obd_device *obd = data;
        __u64 flags;
+       __u64 flags2;
 
        LPROCFS_CLIMP_CHECK(obd);
        flags = obd->u.cli.cl_import->imp_connect_data.ocd_connect_flags;
+       flags2 = obd->u.cli.cl_import->imp_connect_data.ocd_connect_flags2;
        seq_printf(m, "flags="LPX64"\n", flags);
-       obd_connect_seq_flags2str(m, flags, "\n");
+       seq_printf(m, "flags2="LPX64"\n", flags2);
+       obd_connect_seq_flags2str(m, flags, flags2, "\n");
        seq_printf(m, "\n");
        LPROCFS_CLIMP_EXIT(obd);
        return 0;
index 587d580..65842d1 100644 (file)
@@ -68,18 +68,19 @@ static int echo_connect(const struct lu_env *env,
                         struct obd_uuid *cluuid, struct obd_connect_data *data,
                         void *localdata)
 {
-        struct lustre_handle conn = { 0 };
-        int rc;
-
-        data->ocd_connect_flags &= ECHO_CONNECT_SUPPORTED;
-        rc = class_connect(&conn, obd, cluuid);
-        if (rc) {
-                CERROR("can't connect %d\n", rc);
-                return rc;
-        }
-        *exp = class_conn2export(&conn);
+       struct lustre_handle conn = { 0 };
+       int rc;
+
+       data->ocd_connect_flags &= ECHO_CONNECT_SUPPORTED;
+       data->ocd_connect_flags2 &= ECHO_CONNECT_SUPPORTED2;
+       rc = class_connect(&conn, obd, cluuid);
+       if (rc) {
+               CERROR("can't connect %d\n", rc);
+               return rc;
+       }
+       *exp = class_conn2export(&conn);
 
-        return 0;
+       return 0;
 }
 
 static int echo_disconnect(struct obd_export *exp)
index a8b9567..0613449 100644 (file)
@@ -164,6 +164,7 @@ static int ofd_parse_connect_data(const struct lu_env *env,
        fed->fed_group = data->ocd_group;
 
        data->ocd_connect_flags &= OST_CONNECT_SUPPORTED;
+       data->ocd_connect_flags2 &= OST_CONNECT_SUPPORTED2;
        data->ocd_version = LUSTRE_VERSION_CODE;
 
        /* Kindly make sure the SKIP_ORPHAN flag is from MDS. */
index 403f385..568bbfd 100644 (file)
@@ -513,6 +513,7 @@ static int lwp_obd_connect(const struct lu_env *env, struct obd_export **exp,
 
        ocd->ocd_version = LUSTRE_VERSION_CODE;
        imp->imp_connect_flags_orig = ocd->ocd_connect_flags;
+       imp->imp_connect_flags2_orig = ocd->ocd_connect_flags2;
 
        rc = ptlrpc_connect_import(imp);
        if (rc != 0) {
index 510e310..505e484 100644 (file)
@@ -1429,10 +1429,10 @@ static int osp_obd_connect(const struct lu_env *env, struct obd_export **exp,
        *ocd = *data;
 
        imp->imp_connect_flags_orig = ocd->ocd_connect_flags;
+       imp->imp_connect_flags2_orig = ocd->ocd_connect_flags2;
 
        ocd->ocd_version = LUSTRE_VERSION_CODE;
        ocd->ocd_index = data->ocd_index;
-       imp->imp_connect_flags_orig = ocd->ocd_connect_flags;
 
        rc = ptlrpc_connect_import(imp);
        if (rc) {
index 94e5908..5ac3837 100644 (file)
@@ -647,19 +647,19 @@ static int ptlrpc_first_transno(struct obd_import *imp, __u64 *transno)
  */
 int ptlrpc_connect_import(struct obd_import *imp)
 {
-        struct obd_device *obd = imp->imp_obd;
-        int initial_connect = 0;
-        int set_transno = 0;
-        __u64 committed_before_reconnect = 0;
-        struct ptlrpc_request *request;
-        char *bufs[] = { NULL,
-                         obd2cli_tgt(imp->imp_obd),
-                         obd->obd_uuid.uuid,
-                         (char *)&imp->imp_dlm_handle,
-                         (char *)&imp->imp_connect_data };
-        struct ptlrpc_connect_async_args *aa;
-        int rc;
-        ENTRY;
+       struct obd_device *obd = imp->imp_obd;
+       int initial_connect = 0;
+       int set_transno = 0;
+       __u64 committed_before_reconnect = 0;
+       struct ptlrpc_request *request;
+       char *bufs[] = { NULL,
+                        obd2cli_tgt(imp->imp_obd),
+                        obd->obd_uuid.uuid,
+                        (char *)&imp->imp_dlm_handle,
+                        (char *)&imp->imp_connect_data };
+       struct ptlrpc_connect_async_args *aa;
+       int rc;
+       ENTRY;
 
        spin_lock(&imp->imp_lock);
        if (imp->imp_state == LUSTRE_IMP_CLOSED) {
@@ -677,91 +677,92 @@ int ptlrpc_connect_import(struct obd_import *imp)
                RETURN(-EALREADY);
        }
 
-        IMPORT_SET_STATE_NOLOCK(imp, LUSTRE_IMP_CONNECTING);
+       IMPORT_SET_STATE_NOLOCK(imp, LUSTRE_IMP_CONNECTING);
 
-        imp->imp_conn_cnt++;
-        imp->imp_resend_replay = 0;
+       imp->imp_conn_cnt++;
+       imp->imp_resend_replay = 0;
 
-        if (!lustre_handle_is_used(&imp->imp_remote_handle))
-                initial_connect = 1;
-        else
-                committed_before_reconnect = imp->imp_peer_committed_transno;
+       if (!lustre_handle_is_used(&imp->imp_remote_handle))
+               initial_connect = 1;
+       else
+               committed_before_reconnect = imp->imp_peer_committed_transno;
 
-        set_transno = ptlrpc_first_transno(imp,
-                                           &imp->imp_connect_data.ocd_transno);
+       set_transno = ptlrpc_first_transno(imp,
+                                          &imp->imp_connect_data.ocd_transno);
        spin_unlock(&imp->imp_lock);
 
-        rc = import_select_connection(imp);
-        if (rc)
-                GOTO(out, rc);
+       rc = import_select_connection(imp);
+       if (rc)
+               GOTO(out, rc);
 
        rc = sptlrpc_import_sec_adapt(imp, NULL, NULL);
-        if (rc)
-                GOTO(out, rc);
+       if (rc)
+               GOTO(out, rc);
 
-        /* Reset connect flags to the originally requested flags, in case
-         * the server is updated on-the-fly we will get the new features. */
-        imp->imp_connect_data.ocd_connect_flags = imp->imp_connect_flags_orig;
+       /* Reset connect flags to the originally requested flags, in case
+        * the server is updated on-the-fly we will get the new features. */
+       imp->imp_connect_data.ocd_connect_flags = imp->imp_connect_flags_orig;
+       imp->imp_connect_data.ocd_connect_flags2 = imp->imp_connect_flags2_orig;
        /* Reset ocd_version each time so the server knows the exact versions */
        imp->imp_connect_data.ocd_version = LUSTRE_VERSION_CODE;
-        imp->imp_msghdr_flags &= ~MSGHDR_AT_SUPPORT;
-        imp->imp_msghdr_flags &= ~MSGHDR_CKSUM_INCOMPAT18;
-
-        rc = obd_reconnect(NULL, imp->imp_obd->obd_self_export, obd,
-                           &obd->obd_uuid, &imp->imp_connect_data, NULL);
-        if (rc)
-                GOTO(out, rc);
-
-        request = ptlrpc_request_alloc(imp, &RQF_MDS_CONNECT);
-        if (request == NULL)
-                GOTO(out, rc = -ENOMEM);
-
-        rc = ptlrpc_request_bufs_pack(request, LUSTRE_OBD_VERSION,
-                                      imp->imp_connect_op, bufs, NULL);
-        if (rc) {
-                ptlrpc_request_free(request);
-                GOTO(out, rc);
-        }
+       imp->imp_msghdr_flags &= ~MSGHDR_AT_SUPPORT;
+       imp->imp_msghdr_flags &= ~MSGHDR_CKSUM_INCOMPAT18;
+
+       rc = obd_reconnect(NULL, imp->imp_obd->obd_self_export, obd,
+                          &obd->obd_uuid, &imp->imp_connect_data, NULL);
+       if (rc)
+               GOTO(out, rc);
+
+       request = ptlrpc_request_alloc(imp, &RQF_MDS_CONNECT);
+       if (request == NULL)
+               GOTO(out, rc = -ENOMEM);
 
-        /* Report the rpc service time to the server so that it knows how long
-         * to wait for clients to join recovery */
-        lustre_msg_set_service_time(request->rq_reqmsg,
-                                    at_timeout2est(request->rq_timeout));
-
-        /* The amount of time we give the server to process the connect req.
-         * import_select_connection will increase the net latency on
-         * repeated reconnect attempts to cover slow networks.
-         * We override/ignore the server rpc completion estimate here,
-         * which may be large if this is a reconnect attempt */
-        request->rq_timeout = INITIAL_CONNECT_TIMEOUT;
-        lustre_msg_set_timeout(request->rq_reqmsg, request->rq_timeout);
-
-        request->rq_no_resend = request->rq_no_delay = 1;
-        request->rq_send_state = LUSTRE_IMP_CONNECTING;
-        /* Allow a slightly larger reply for future growth compatibility */
-        req_capsule_set_size(&request->rq_pill, &RMF_CONNECT_DATA, RCL_SERVER,
-                             sizeof(struct obd_connect_data)+16*sizeof(__u64));
-        ptlrpc_request_set_replen(request);
-        request->rq_interpret_reply = ptlrpc_connect_interpret;
-
-        CLASSERT(sizeof (*aa) <= sizeof (request->rq_async_args));
-        aa = ptlrpc_req_async_args(request);
-        memset(aa, 0, sizeof *aa);
-
-        aa->pcaa_peer_committed = committed_before_reconnect;
-        aa->pcaa_initial_connect = initial_connect;
-
-        if (aa->pcaa_initial_connect) {
+       rc = ptlrpc_request_bufs_pack(request, LUSTRE_OBD_VERSION,
+                                     imp->imp_connect_op, bufs, NULL);
+       if (rc) {
+               ptlrpc_request_free(request);
+               GOTO(out, rc);
+       }
+
+       /* Report the rpc service time to the server so that it knows how long
+        * to wait for clients to join recovery */
+       lustre_msg_set_service_time(request->rq_reqmsg,
+                                   at_timeout2est(request->rq_timeout));
+
+       /* The amount of time we give the server to process the connect req.
+        * import_select_connection will increase the net latency on
+        * repeated reconnect attempts to cover slow networks.
+        * We override/ignore the server rpc completion estimate here,
+        * which may be large if this is a reconnect attempt */
+       request->rq_timeout = INITIAL_CONNECT_TIMEOUT;
+       lustre_msg_set_timeout(request->rq_reqmsg, request->rq_timeout);
+
+       request->rq_no_resend = request->rq_no_delay = 1;
+       request->rq_send_state = LUSTRE_IMP_CONNECTING;
+       /* Allow a slightly larger reply for future growth compatibility */
+       req_capsule_set_size(&request->rq_pill, &RMF_CONNECT_DATA, RCL_SERVER,
+                            sizeof(struct obd_connect_data)+16*sizeof(__u64));
+       ptlrpc_request_set_replen(request);
+       request->rq_interpret_reply = ptlrpc_connect_interpret;
+
+       CLASSERT(sizeof(*aa) <= sizeof(request->rq_async_args));
+       aa = ptlrpc_req_async_args(request);
+       memset(aa, 0, sizeof *aa);
+
+       aa->pcaa_peer_committed = committed_before_reconnect;
+       aa->pcaa_initial_connect = initial_connect;
+
+       if (aa->pcaa_initial_connect) {
                spin_lock(&imp->imp_lock);
                imp->imp_replayable = 1;
                spin_unlock(&imp->imp_lock);
-                lustre_msg_add_op_flags(request->rq_reqmsg,
-                                        MSG_CONNECT_INITIAL);
-        }
+               lustre_msg_add_op_flags(request->rq_reqmsg,
+                                       MSG_CONNECT_INITIAL);
+       }
 
-        if (set_transno)
-                lustre_msg_add_op_flags(request->rq_reqmsg,
-                                        MSG_CONNECT_TRANSNO);
+       if (set_transno)
+               lustre_msg_add_op_flags(request->rq_reqmsg,
+                                       MSG_CONNECT_TRANSNO);
 
        DEBUG_REQ(D_RPCTRACE, request, "(re)connect request (timeout %d)",
                  request->rq_timeout);
@@ -1052,13 +1053,22 @@ static int ptlrpc_connect_interpret(const struct lu_env *env,
        /* check that server granted subset of flags we asked for. */
        if ((ocd->ocd_connect_flags & imp->imp_connect_flags_orig) !=
            ocd->ocd_connect_flags) {
-               CERROR("%s: Server didn't granted asked subset of flags: "
-                      "asked="LPX64" grranted="LPX64"\n",
-                      imp->imp_obd->obd_name,imp->imp_connect_flags_orig,
+               CERROR("%s: Server didn't grant requested subset of flags: "
+                      "asked="LPX64" granted="LPX64"\n",
+                      imp->imp_obd->obd_name, imp->imp_connect_flags_orig,
                       ocd->ocd_connect_flags);
                GOTO(out, rc = -EPROTO);
        }
 
+       if ((ocd->ocd_connect_flags2 & imp->imp_connect_flags2_orig) !=
+           ocd->ocd_connect_flags2) {
+               CERROR("%s: Server didn't grant requested subset of flags2: "
+                      "asked="LPX64" granted="LPX64"\n",
+                      imp->imp_obd->obd_name, imp->imp_connect_flags2_orig,
+                      ocd->ocd_connect_flags2);
+               GOTO(out, rc = -EPROTO);
+       }
+
        if (!(imp->imp_connect_flags_orig & OBD_CONNECT_LIGHTWEIGHT) &&
            (imp->imp_connect_flags_orig & OBD_CONNECT_MDS_MDS) &&
            (imp->imp_connect_flags_orig & OBD_CONNECT_FID) &&
index 0272c77..7247fe6 100644 (file)
@@ -1206,6 +1206,8 @@ void lustre_assert_wire_constants(void)
                 OBD_CONNECT_OBDOPACK);
        LASSERTF(OBD_CONNECT_FLAGS2 == 0x8000000000000000ULL, "found 0x%.16llxULL\n",
                 OBD_CONNECT_FLAGS2);
+       LASSERTF(OBD_CONNECT2_FILE_SECCTX == 0x1ULL, "found 0x%.16llxULL\n",
+                OBD_CONNECT2_FILE_SECCTX);
        LASSERTF(OBD_CKSUM_CRC32 == 0x00000001UL, "found 0x%.8xUL\n",
                (unsigned)OBD_CKSUM_CRC32);
        LASSERTF(OBD_CKSUM_ADLER == 0x00000002UL, "found 0x%.8xUL\n",
index b7d1ca7..2e6d50f 100644 (file)
@@ -555,6 +555,7 @@ check_obd_connect_data(void)
        CHECK_DEFINE_64X(OBD_CONNECT_BULK_MBITS);
        CHECK_DEFINE_64X(OBD_CONNECT_OBDOPACK);
        CHECK_DEFINE_64X(OBD_CONNECT_FLAGS2);
+       CHECK_DEFINE_64X(OBD_CONNECT2_FILE_SECCTX);
 
        CHECK_VALUE_X(OBD_CKSUM_CRC32);
        CHECK_VALUE_X(OBD_CKSUM_ADLER);
index 95aa57e..7b817b7 100644 (file)
@@ -1221,6 +1221,8 @@ void lustre_assert_wire_constants(void)
                 OBD_CONNECT_OBDOPACK);
        LASSERTF(OBD_CONNECT_FLAGS2 == 0x8000000000000000ULL, "found 0x%.16llxULL\n",
                 OBD_CONNECT_FLAGS2);
+       LASSERTF(OBD_CONNECT2_FILE_SECCTX == 0x1ULL, "found 0x%.16llxULL\n",
+                OBD_CONNECT2_FILE_SECCTX);
        LASSERTF(OBD_CKSUM_CRC32 == 0x00000001UL, "found 0x%.8xUL\n",
                (unsigned)OBD_CKSUM_CRC32);
        LASSERTF(OBD_CKSUM_ADLER == 0x00000002UL, "found 0x%.8xUL\n",