Whamcloud - gitweb
add capability config interface. also modified the interface for rootsquash.
authorlsy <lsy>
Sat, 7 Oct 2006 10:23:51 +0000 (10:23 +0000)
committerlsy <lsy>
Sat, 7 Oct 2006 10:23:51 +0000 (10:23 +0000)
14 files changed:
lustre/include/lustre/lustre_idl.h
lustre/include/lustre_capa.h
lustre/include/lustre_param.h
lustre/llite/llite_capa.c
lustre/mdc/mdc_request.c
lustre/mdt/mdt_handler.c
lustre/mdt/mdt_internal.h
lustre/mdt/mdt_lproc.c
lustre/mgs/mgs_llog.c
lustre/obdclass/obd_mount.c
lustre/obdfilter/lproc_obdfilter.c
lustre/tests/cfg/insanity-local.sh
lustre/tests/cfg/local.sh
lustre/tests/cfg/lov.sh

index e5e6f9f..7267986 100644 (file)
@@ -1940,12 +1940,12 @@ enum {
 
 static inline int capa_for_mds(struct lustre_capa *c)
 {
-        return (c->lc_opc & CAPA_OPC_INDEX_INSERT) != 0;
+        return (c->lc_opc & CAPA_OPC_INDEX_LOOKUP) != 0;
 }
 
 static inline int capa_for_oss(struct lustre_capa *c)
 {
-        return (c->lc_opc & CAPA_OPC_INDEX_INSERT) == 0;
+        return (c->lc_opc & CAPA_OPC_INDEX_LOOKUP) == 0;
 }
 
 /* lustre_capa.lc_flags */
index 3123fbd..3ec4ba1 100644 (file)
@@ -346,8 +346,7 @@ struct filter_capa_key {
 enum {
         CAPA_CTX_ON           = 1,
         CAPA_CTX_TIMEOUT      = 1<<1,
-        CAPA_CTX_KEY_TIMEOUT  = 1<<2,
-        CAPA_CTX_ALG          = 1<<3,
-        CAPA_CTX_KEYS         = 1<<4,
+        CAPA_CTX_ALG          = 1<<2,
+        CAPA_CTX_KEYS         = 1<<3,
 };
 #endif /* __LINUX_CAPA_H_ */
index 21136a1..95f8a73 100644 (file)
@@ -52,9 +52,5 @@ int do_lcfg(char *cfgname, lnet_nid_t nid, int cmd,
 #define PARAM_SEC_RPC              PARAM_SEC"rpc."
 #define PARAM_SEC_RPC_MDT          PARAM_SEC_RPC"mdt="
 #define PARAM_SEC_RPC_CLI          PARAM_SEC_RPC"cli="
-#define PARAM_ROOTSQUASH           PARAM_SEC"rootsquash."
-#define PARAM_ROOTSQUASH_UID       PARAM_ROOTSQUASH"uid="
-#define PARAM_ROOTSQUASH_GID       PARAM_ROOTSQUASH"gid="
-#define PARAM_ROOTSQUASH_SKIPS     PARAM_ROOTSQUASH"skips="
 
 #endif // _LUSTRE_PARAM_H
index 552012d..d1963d0 100644 (file)
@@ -344,13 +344,17 @@ struct obd_capa *ll_lookup_oss_capa(struct inode *inode, __u64 opc)
                 capa_get(ocapa);
 
                 DEBUG_CAPA(D_SEC, &ocapa->c_capa, "found client");
-        } else if (atomic_read(&ll_capa_debug)) {
-                CERROR("no capability for "DFID" opc "LPX64"\n",
-                       PFID(&lli->lli_fid), opc);
-                atomic_set(&ll_capa_debug, 0);
+        } else {
                 ocapa = NULL;
+
+                if (atomic_read(&ll_capa_debug)) {
+                        CERROR("no capability for "DFID" opc "LPX64"\n",
+                               PFID(&lli->lli_fid), opc);
+                        atomic_set(&ll_capa_debug, 0);
+                }
         }
         spin_unlock(&capa_lock);
+
         RETURN(ocapa);
 }
 
index cfc874e..e8dcc2d 100644 (file)
@@ -1618,7 +1618,7 @@ static int mdc_interpret_renew_capa(struct ptlrpc_request *req, void *unused,
                                     int status)
 {
         struct obd_capa *oc = req->rq_async_args.pointer_arg[0];
-        renew_capa_cb_t *cb = req->rq_async_args.pointer_arg[1];
+        renew_capa_cb_t cb = req->rq_async_args.pointer_arg[1];
         struct mds_body *body = NULL;
         struct lustre_capa *capa;
         ENTRY;
@@ -1644,7 +1644,7 @@ static int mdc_interpret_renew_capa(struct ptlrpc_request *req, void *unused,
 
         EXIT;
 out:
-        (*cb)(oc, capa);
+        cb(oc, capa);
         return 0;
 }
 
index ec78cc9..a213e9e 100644 (file)
@@ -420,6 +420,7 @@ static int mdt_getattr_internal(struct mdt_thread_info *info,
 
 static int mdt_renew_capa(struct mdt_thread_info *info)
 {
+        struct mdt_device *mdt = info->mti_mdt;
         struct mdt_object *obj = info->mti_object;
         struct mdt_body *body;
         struct lustre_capa *capa, *c;
@@ -429,6 +430,13 @@ static int mdt_renew_capa(struct mdt_thread_info *info)
         c = req_capsule_client_get(&info->mti_pill, &RMF_CAPA1);
         LASSERT(c);
 
+        if ((capa_for_mds(c) && !mdt->mdt_opts.mo_mds_capa) ||
+            (capa_for_oss(c) && !mdt->mdt_opts.mo_oss_capa)) {
+                DEBUG_CAPA(D_SEC, c,
+                           "mds has disabled capability, skip renew for");
+                GOTO(out, rc = -ENOENT);
+        }
+
         capa = req_capsule_server_get(&info->mti_pill, &RMF_CAPA1);
         LASSERT(capa);
 
@@ -439,9 +447,10 @@ static int mdt_renew_capa(struct mdt_thread_info *info)
         LASSERT(body);
 
         body->valid |= OBD_MD_FLOSSCAPA;
+        EXIT;
+out:
         body->flags = (__u32)rc;
-
-        RETURN(0);
+        return 0;
 }
 
 static int mdt_getattr(struct mdt_thread_info *info)
@@ -1564,6 +1573,21 @@ static inline void mdt_finish_reply(struct mdt_thread_info *info, int rc)
 #endif
 
 
+static int mdt_init_capa_ctxt(const struct lu_env *env, struct mdt_device *m)
+{
+        struct md_device *next = m->mdt_child;
+        __u32 valid = CAPA_CTX_TIMEOUT | CAPA_CTX_ALG | CAPA_CTX_KEYS;
+        int rc;
+
+        if (m->mdt_opts.mo_mds_capa)
+                valid |= CAPA_CTX_ON;
+        rc = next->md_ops->mdo_init_capa_ctxt(env, next, valid,
+                                              m->mdt_capa_timeout,
+                                              m->mdt_capa_alg,
+                                              m->mdt_capa_keys);
+        return rc;
+}
+
 /*
  * Invoke handler for this request opc. Also do necessary preprocessing
  * (according to handler ->mh_flags), and post-processing (setting of
@@ -1631,6 +1655,12 @@ static int mdt_req_handle(struct mdt_thread_info *info,
                 }
         }
 
+        /* capability setting changed by /proc, needs reinitialize ctxt */
+        if (info->mti_mdt && info->mti_mdt->mdt_capa_conf) {
+                mdt_init_capa_ctxt(info->mti_env, info->mti_mdt);
+                info->mti_mdt->mdt_capa_conf = 0;
+        }
+
         if (rc == 0) {
                 /*
                  * Process request, there can be two types of rc:
@@ -3173,21 +3203,6 @@ static void mdt_fini(const struct lu_env *env, struct mdt_device *m)
 
 int mdt_postrecov(const struct lu_env *, struct mdt_device *);
 
-static int mdt_init_capa_ctxt(const struct lu_env *env, struct mdt_device *m)
-{
-        struct md_device *next = m->mdt_child;
-        __u32 valid = CAPA_CTX_TIMEOUT | CAPA_CTX_ALG | CAPA_CTX_KEYS;
-        int rc;
-
-        if (m->mdt_opts.mo_mds_capa)
-                valid |= CAPA_CTX_ON;
-        rc = next->md_ops->mdo_init_capa_ctxt(env, next, valid,
-                                              m->mdt_capa_timeout,
-                                              m->mdt_capa_alg,
-                                              m->mdt_capa_keys);
-        return rc;
-}
-
 static int mdt_init0(const struct lu_env *env, struct mdt_device *m,
                      struct lu_device_type *ldt, struct lustre_cfg *cfg)
 {
@@ -3216,8 +3231,6 @@ static int mdt_init0(const struct lu_env *env, struct mdt_device *m,
         m->mdt_opts.mo_user_xattr = 0;
         m->mdt_opts.mo_acl = 0;
         m->mdt_opts.mo_compat_resname = 0;
-        m->mdt_opts.mo_mds_capa = 0;
-        m->mdt_opts.mo_oss_capa = 0;
         m->mdt_capa_timeout = CAPA_TIMEOUT;
         m->mdt_capa_alg = CAPA_HMAC_ALG_SHA1;
         m->mdt_ck_timeout = CAPA_KEY_TIMEOUT;
@@ -3345,97 +3358,23 @@ err_free_site:
         return (rc);
 }
 
-/* FIXME: this macro is copied from lnet/libcfs/nidstring.c */
-#define LNET_NIDSTR_SIZE   32      /* size of each one (see below for usage) */
-static void do_process_nosquash_nids(struct mdt_device *m, char *buf)
-{
-        struct rootsquash_info *rsi = m->mdt_rootsquash_info;
-        char str[LNET_NIDSTR_SIZE], *end;
-        lnet_nid_t nid;
-
-        LASSERT(rsi);
-        rsi->rsi_n_nosquash_nids = 0;
-        while (rsi->rsi_n_nosquash_nids < N_NOSQUASH_NIDS) {
-                end = strchr(buf, ',');
-                memset(str, 0, sizeof(str));
-                if (end)
-                        strncpy(str, buf, min_t(int, sizeof(str), end - buf));
-                else
-                        strncpy(str, buf, min_t(int, sizeof(str), strlen(buf)));
-
-                if (!strcmp(str, "*")) {
-                        nid = LNET_NID_ANY;
-                } else {
-                        nid = libcfs_str2nid(str);
-                        if (nid == LNET_NID_ANY)
-                                goto ignore;
-                }
-                rsi->rsi_nosquash_nids[rsi->rsi_n_nosquash_nids++] = nid;
-ignore:
-                if (!end || (*(end + 1) == 0))
-                        return;
-                buf = end + 1;
-        }
-}
-
 /* used by MGS to process specific configurations */
 static int mdt_process_config(const struct lu_env *env,
                               struct lu_device *d, struct lustre_cfg *cfg)
 {
         struct mdt_device *m = mdt_dev(d);
-        struct md_device *md_next  = m->mdt_child;
+        struct md_device *md_next = m->mdt_child;
         struct lu_device *next = md2lu_dev(md_next);
         int rc = 0;
         ENTRY;
 
         switch (cfg->lcfg_command) {
         case LCFG_PARAM: {
-                int i;
-
-                for (i = 1; i < cfg->lcfg_bufcount; i++) {
-                        char *key, *val;
-
-                        key = lustre_cfg_buf(cfg, i);
-                        val = strchr(key, '=');
-                        if (!val || (*(val + 1) == 0)) {
-                                CERROR("Can't parse param %s\n", key);
-                                rc = -EINVAL;
-                                /* continue parsing other params */
-                                continue;
-                        }
-
-                        val++;
-                        if (class_match_param(key,
-                                        PARAM_ROOTSQUASH_UID, 0) == 0) {
-                                if (!m->mdt_rootsquash_info)
-                                        OBD_ALLOC_PTR(m->mdt_rootsquash_info);
-                                if (!m->mdt_rootsquash_info)
-                                        RETURN(-ENOMEM);
-
-                                m->mdt_rootsquash_info->rsi_uid =
-                                        simple_strtoul(val, NULL, 0);
-                        } else if (class_match_param(key,
-                                        PARAM_ROOTSQUASH_GID, 0) == 0) {
-                                if (!m->mdt_rootsquash_info)
-                                        OBD_ALLOC_PTR(m->mdt_rootsquash_info);
-                                if (!m->mdt_rootsquash_info)
-                                        RETURN(-ENOMEM);
-
-                                m->mdt_rootsquash_info->rsi_gid =
-                                        simple_strtoul(val, NULL, 0);
-                        } else if (class_match_param(key,
-                                        PARAM_ROOTSQUASH_SKIPS, 0) == 0) {
-                                if (!m->mdt_rootsquash_info)
-                                        OBD_ALLOC_PTR(m->mdt_rootsquash_info);
-                                if (!m->mdt_rootsquash_info)
-                                        RETURN(-ENOMEM);
-
-                                do_process_nosquash_nids(m, val);
-                        } else {
-                                rc = -EINVAL;
-                        }
-                }
+                struct lprocfs_static_vars lvars;
+                struct obd_device *obd = d->ld_obd;
 
+                lprocfs_init_vars(mdt, &lvars);
+                rc = class_process_proc_param(PARAM_MDT, lvars.obd_vars, cfg, obd);
                 if (rc)
                         /* others are passed further */
                         rc = next->ld_ops->ldo_process_config(env, next, cfg);
index b8db60c..fe65b12 100644 (file)
@@ -179,6 +179,7 @@ struct mdt_device {
         struct timer_list          mdt_ck_timer;
         struct ptlrpc_thread       mdt_ck_thread;
         struct lustre_capa_key     mdt_capa_keys[2];
+        unsigned int               mdt_capa_conf:1;
 };
 
 /*XXX copied from mds_internal.h */
index c01170f..6a7b27e 100644 (file)
@@ -386,6 +386,26 @@ static int lprocfs_rd_rootsquash_uid(char *page, char **start, off_t off,
                         rsi ? rsi->rsi_uid : 0);
 }
 
+static int lprocfs_wr_rootsquash_uid(struct file *file, const char *buffer,
+                                     unsigned long count, void *data)
+{
+        struct obd_device *obd = data;
+        struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
+        int val, rc;
+
+        rc = lprocfs_write_helper(buffer, count, &val);
+        if (rc)
+                return rc;
+
+        if (!mdt->mdt_rootsquash_info)
+                OBD_ALLOC_PTR(mdt->mdt_rootsquash_info);
+        if (!mdt->mdt_rootsquash_info)
+                RETURN(-ENOMEM);
+
+        mdt->mdt_rootsquash_info->rsi_uid = val;
+        return count;
+}
+
 static int lprocfs_rd_rootsquash_gid(char *page, char **start, off_t off,
                                  int count, int *eof, void *data)
 {
@@ -398,6 +418,26 @@ static int lprocfs_rd_rootsquash_gid(char *page, char **start, off_t off,
                         rsi ? rsi->rsi_gid : 0);
 }
 
+static int lprocfs_wr_rootsquash_gid(struct file *file, const char *buffer,
+                                     unsigned long count, void *data)
+{
+        struct obd_device *obd = data;
+        struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
+        int val, rc;
+
+        rc = lprocfs_write_helper(buffer, count, &val);
+        if (rc)
+                return rc;
+
+        if (!mdt->mdt_rootsquash_info)
+                OBD_ALLOC_PTR(mdt->mdt_rootsquash_info);
+        if (!mdt->mdt_rootsquash_info)
+                RETURN(-ENOMEM);
+
+        mdt->mdt_rootsquash_info->rsi_gid = val;
+        return count;
+}
+
 static int lprocfs_rd_rootsquash_skips(char *page, char **start, off_t off,
                                        int count, int *eof, void *data)
 {
@@ -416,6 +456,64 @@ static int lprocfs_rd_rootsquash_skips(char *page, char **start, off_t off,
         return ret;
 }
 
+/* FIXME: this macro is copied from lnet/libcfs/nidstring.c */
+#define LNET_NIDSTR_SIZE   32      /* size of each one (see below for usage) */
+static void do_process_nosquash_nids(struct mdt_device *m, char *buf)
+{
+        struct rootsquash_info *rsi = m->mdt_rootsquash_info;
+        char str[LNET_NIDSTR_SIZE], *end;
+        lnet_nid_t nid;
+
+        LASSERT(rsi);
+        rsi->rsi_n_nosquash_nids = 0;
+        while (rsi->rsi_n_nosquash_nids < N_NOSQUASH_NIDS) {
+                end = strchr(buf, ',');
+                memset(str, 0, sizeof(str));
+                if (end)
+                        strncpy(str, buf, min_t(int, sizeof(str), end - buf));
+                else
+                        strncpy(str, buf, min_t(int, sizeof(str), strlen(buf)));
+
+                if (!strcmp(str, "*")) {
+                        nid = LNET_NID_ANY;
+                } else {
+                        nid = libcfs_str2nid(str);
+                        if (nid == LNET_NID_ANY)
+                                goto ignore;
+                }
+                rsi->rsi_nosquash_nids[rsi->rsi_n_nosquash_nids++] = nid;
+ignore:
+                if (!end || (*(end + 1) == 0))
+                        return;
+                buf = end + 1;
+        }
+}
+
+static int lprocfs_wr_rootsquash_skips(struct file *file, const char *buffer,
+                                       unsigned long count, void *data)
+{
+        struct obd_device *obd = data;
+        struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
+        char skips[LNET_NIDSTR_SIZE * N_NOSQUASH_NIDS] = "";
+        unsigned long size = sizeof(skips);
+
+        if (count > size) {
+                CERROR("parameter exceeds max limit %lu\n", size);
+                return -EINVAL;
+        }
+
+        if (copy_from_user(skips, buffer, min(size, count)))
+                return -EFAULT;
+
+        if (!mdt->mdt_rootsquash_info)
+                OBD_ALLOC_PTR(mdt->mdt_rootsquash_info);
+        if (!mdt->mdt_rootsquash_info)
+                RETURN(-ENOMEM);
+
+        do_process_nosquash_nids(mdt, skips);
+        return count;
+}
+
 /* for debug only */
 static int lprocfs_rd_capa(char *page, char **start, off_t off,
                            int count, int *eof, void *data)
@@ -431,22 +529,29 @@ static int lprocfs_rd_capa(char *page, char **start, off_t off,
 static int lprocfs_wr_capa(struct file *file, const char *buffer,
                            unsigned long count, void *data)
 {
-        int val, rc;
-
-        rc = lprocfs_write_helper(buffer, count, &val);
-        if (rc)
-                return rc;
-
-        if (val & ~0x3) {
-                CERROR("invalid value %u: only 0/1/2/3 is accepted.\n", val);
-                CERROR("\t0: disable capability\n"
-                       "\t1: enable mds capability\n"
-                       "\t2: enable oss capability\n"
-                       "\t3: enable both mds and oss capability\n");
+        struct obd_device *obd = data;
+        struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
+        char mode[3] = "";
+
+        if (count > 3) {
+                CERROR("invalid capability mode, only m/o/mo/x is accepted.\n"
+                       " m:  enable MDS fid capability\n"
+                       " o:  enable OSS fid capability\n"
+                       " mo: enable both MDS and OSS fid capability\n"
+                       " x:  disable fid capability\n");
                 return -EINVAL;
         }
 
-//        mds_capa_onoff(obd, val);
+        if (copy_from_user(mode, buffer, min(2UL, count)))
+                return -EFAULT;
+
+        mdt->mdt_opts.mo_mds_capa = 0;
+        mdt->mdt_opts.mo_oss_capa = 0;
+        if (strchr(mode, 'm'))
+                mdt->mdt_opts.mo_mds_capa = 1;
+        if (strchr(mode, 'o'))
+                mdt->mdt_opts.mo_oss_capa = 1;
+        mdt->mdt_capa_conf = 1;
         return count;
 }
 
@@ -459,7 +564,7 @@ static int lprocfs_rd_capa_count(char *page, char **start, off_t off,
 }
 
 static int lprocfs_rd_capa_timeout(char *page, char **start, off_t off,
-                                       int count, int *eof, void *data)
+                                   int count, int *eof, void *data)
 {
         struct obd_device *obd = data;
         struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
@@ -467,6 +572,22 @@ static int lprocfs_rd_capa_timeout(char *page, char **start, off_t off,
         return snprintf(page, count, "%lu\n", mdt->mdt_capa_timeout);
 }
 
+static int lprocfs_wr_capa_timeout(struct file *file, const char *buffer,
+                                   unsigned long count, void *data)
+{
+        struct obd_device *obd = data;
+        struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
+        int val, rc;
+
+        rc = lprocfs_write_helper(buffer, count, &val);
+        if (rc)
+                return rc;
+
+        mdt->mdt_capa_timeout = (unsigned long)val;
+        mdt->mdt_capa_conf = 1;
+        return count;
+}
+
 static int lprocfs_rd_ck_timeout(char *page, char **start, off_t off, int count,
                                  int *eof, void *data)
 {
@@ -476,6 +597,22 @@ static int lprocfs_rd_ck_timeout(char *page, char **start, off_t off, int count,
         return snprintf(page, count, "%lu\n", mdt->mdt_ck_timeout);
 }
 
+static int lprocfs_wr_ck_timeout(struct file *file, const char *buffer,
+                                 unsigned long count, void *data)
+{
+        struct obd_device *obd = data;
+        struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
+        int val, rc;
+
+        rc = lprocfs_write_helper(buffer, count, &val);
+        if (rc)
+                return rc;
+
+        mdt->mdt_ck_timeout = (unsigned long)val;
+        mdt->mdt_capa_conf = 1;
+        return count;
+}
+
 static struct lprocfs_vars lprocfs_mdt_obd_vars[] = {
         { "uuid",                       lprocfs_rd_uuid,                 0, 0 },
         { "recovery_status",            lprocfs_obd_rd_recovery_status,  0, 0 },
@@ -495,12 +632,18 @@ static struct lprocfs_vars lprocfs_mdt_obd_vars[] = {
         { "rmtacl_upcall",              lprocfs_rd_rmtacl_upcall,
                                         lprocfs_wr_rmtacl_upcall,           0 },
         { "rmtacl_info",                0, lprocfs_wr_rmtacl_info,          0 },
-        { "rootsquash_uid",             lprocfs_rd_rootsquash_uid,       0, 0 },
-        { "rootsquash_gid",             lprocfs_rd_rootsquash_gid,       0, 0 },
-        { "rootsquash_skips",           lprocfs_rd_rootsquash_skips,     0, 0 },
-        { "capa",                       lprocfs_rd_capa, lprocfs_wr_capa,   0 },
-        { "capa_timeout",               lprocfs_rd_capa_timeout,         0, 0 },
-        { "capa_key_timeout",           lprocfs_rd_ck_timeout,           0, 0 },
+        { "rootsquash_uid",             lprocfs_rd_rootsquash_uid,
+                                        lprocfs_wr_rootsquash_uid,          0 },
+        { "rootsquash_gid",             lprocfs_rd_rootsquash_gid,
+                                        lprocfs_wr_rootsquash_gid,          0 },
+        { "rootsquash_skips",           lprocfs_rd_rootsquash_skips,
+                                        lprocfs_wr_rootsquash_skips,        0 },
+        { "capa",                       lprocfs_rd_capa,
+                                        lprocfs_wr_capa,                    0 },
+        { "capa_timeout",               lprocfs_rd_capa_timeout,
+                                        lprocfs_wr_capa_timeout,            0 },
+        { "capa_key_timeout",           lprocfs_rd_ck_timeout,
+                                        lprocfs_wr_ck_timeout,              0 },
         { "capa_count",                 lprocfs_rd_capa_count,           0, 0 },
         { 0 }
 };
index e5b2331..e0500f6 100644 (file)
@@ -1892,17 +1892,6 @@ static int mgs_write_log_params(struct obd_device *obd, struct fs_db *fsdb,
                         GOTO(end_while, rc);
                 }
 
-                if (!class_match_param(ptr, PARAM_ROOTSQUASH, NULL)) {
-                        /* Change mds root_squash params */
-                        lustre_cfg_bufs_reset(&bufs, mti->mti_svname);
-                        lustre_cfg_bufs_set(&bufs, 1, ptr, strlen(ptr));
-                        lcfg = lustre_cfg_new(LCFG_PARAM, &bufs);
-                        rc = mgs_write_log_direct(obd, fsdb, mti->mti_svname,
-                                                  mti->mti_svname, lcfg);
-                        lustre_cfg_free(lcfg);
-                        GOTO(end_while, rc);
-                }
-
                 LCONSOLE_WARN("Ignoring unrecognized param '%s'\n", ptr);
 
 end_while:
index 6931118..6abac48 100644 (file)
@@ -1906,6 +1906,9 @@ static int lmd_parse(char *options, struct lustre_mount_data *lmd)
                         if (rc)
                                 goto invalid;
                         clear++;
+                } else if (strncmp(s1, "capa=", 5) == 0) {
+                        lmd->lmd_nllu = simple_strtoul(s1 + 5, NULL, 10);
+                        clear++;
                 }
                 /* Linux 2.4 doesn't pass the device, so we stuck it at the
                    end of the options. */
index d2e5391..71727fe 100644 (file)
@@ -305,6 +305,49 @@ int lprocfs_filter_wr_fmd_max_age(struct file *file, const char *buffer,
         return count;
 }
 
+static int lprocfs_filter_rd_capa(char *page, char **start, off_t off,
+                                  int count, int *eof, void *data)
+{
+        struct obd_device *obd = data;
+        int rc;
+
+        rc = snprintf(page, count, "capability on: %s\n",
+                      obd->u.filter.fo_fl_oss_capa ? "oss" : "");
+        return rc;
+}
+
+static int lprocfs_filter_wr_capa(struct file *file, const char *buffer,
+                                  unsigned long count, void *data)
+{
+        struct obd_device *obd = data;
+        char mode[2] = "";
+
+        if (count > 2) {
+                CERROR("invalid capability mode, only o/x are accepted.\n"
+                       " o: enable oss fid capability\n"
+                       " x: disable oss fid capability\n");
+                return -EINVAL;
+        }
+
+        if (copy_from_user(mode, buffer, min(1UL, count)))
+                return -EFAULT;
+
+        if (strchr(mode, 'o'))
+                obd->u.filter.fo_fl_oss_capa = 1;
+        else
+                obd->u.filter.fo_fl_oss_capa = 0;
+
+        return count;
+}
+
+static int lprocfs_filter_rd_capa_count(char *page, char **start, off_t off,
+                                        int count, int *eof, void *data)
+{
+        return snprintf(page, count, "%d %d\n",
+                        capa_count[CAPA_SITE_CLIENT],
+                        capa_count[CAPA_SITE_SERVER]);
+}
+
 static struct lprocfs_vars lprocfs_obd_vars[] = {
         { "uuid",         lprocfs_rd_uuid,          0, 0 },
         { "blocksize",    lprocfs_rd_blksize,       0, 0 },
@@ -340,6 +383,9 @@ static struct lprocfs_vars lprocfs_obd_vars[] = {
                           lprocfs_filter_wr_fmd_max_num, 0 },
         { "client_cache_seconds", lprocfs_filter_rd_fmd_max_age,
                           lprocfs_filter_wr_fmd_max_age, 0 },
+        { "capa",         lprocfs_filter_rd_capa,
+                          lprocfs_filter_wr_capa, 0 },
+        { "capa_count",   lprocfs_filter_rd_capa_count, 0, 0 },
         { 0 }
 };
 
index 2fdde52..d31c089 100644 (file)
@@ -40,6 +40,8 @@ MOUNTOPT=""
     MKFSOPT=$MKFSOPT" -i $MDSISIZE"
 [ "x$MKFSOPT" != "x" ] &&
     MKFSOPT="--mkfsoptions=\"$MKFSOPT\""
+[ "x$MDSCAPA" != "x" ] &&
+    MKFSOPT="--param mdt.capa=$MDSCAPA"
 [ "x$mdsfailover_HOST" != "x" ] &&
     MOUNTOPT=$MOUNTOPT" --failnode=`h2$NETTYPE $mdsfailover_HOST`"
 [ "x$STRIPE_BYTES" != "x" ] &&
@@ -54,6 +56,8 @@ MOUNTOPT=""
     MKFSOPT=$MKFSOPT" -J size=$OSTJOURNALSIZE"
 [ "x$MKFSOPT" != "x" ] &&
     MKFSOPT="--mkfsoptions=\"$MKFSOPT\""
+[ "x$OSSCAPA" != "x" ] &&
+    MKFSOPT="--param ost.capa=$OSSCAPA"
 [ "x$ostfailover_HOST" != "x" ] &&
     MOUNTOPT=$MOUNTOPT" --failnode=`h2$NETTYPE $ostfailover_HOST`"
 OST_MKFS_OPTS="--ost --fsname=$FSNAME --device-size=$OSTSIZE --mgsnode=$MGSNID --param sys.timeout=$TIMEOUT $MKFSOPT $MOUNTOPT $OSTOPT"
index df04dc0..4cc3074 100644 (file)
@@ -44,6 +44,8 @@ MOUNTOPT=""
     MKFSOPT=$MKFSOPT" -i $MDSISIZE"
 [ "x$MKFSOPT" != "x" ] &&
     MKFSOPT="--mkfsoptions=\"$MKFSOPT\""
+[ "x$MDSCAPA" != "x" ] &&
+    MKFSOPT="--param mdt.capa=$MDSCAPA"
 [ "x$mdsfailover_HOST" != "x" ] &&
     MOUNTOPT=$MOUNTOPT" --failnode=`h2$NETTYPE $mdsfailover_HOST`"
 [ "x$STRIPE_BYTES" != "x" ] &&
@@ -58,6 +60,8 @@ MOUNTOPT=""
     MKFSOPT=$MKFSOPT" -J size=$OSTJOURNALSIZE"
 [ "x$MKFSOPT" != "x" ] &&
     MKFSOPT="--mkfsoptions=\"$MKFSOPT\""
+[ "x$OSSCAPA" != "x" ] &&
+    MKFSOPT="--param ost.capa=$OSSCAPA"
 [ "x$ostfailover_HOST" != "x" ] &&
     MOUNTOPT=$MOUNTOPT" --failnode=`h2$NETTYPE $ostfailover_HOST`"
 OST_MKFS_OPTS="--ost --fsname=$FSNAME --device-size=$OSTSIZE --mgsnode=$MGSNID --param sys.timeout=$TIMEOUT $MKFSOPT $MOUNTOPT $OSTOPT"
index b460438..520a7a9 100644 (file)
@@ -39,6 +39,8 @@ MOUNTOPT=""
     MKFSOPT=$MKFSOPT" -i $MDSISIZE"
 [ "x$MKFSOPT" != "x" ] &&
     MKFSOPT="--mkfsoptions=\"$MKFSOPT\""
+[ "x$MDSCAPA" != "x" ] &&
+    MKFSOPT="--param mdt.capa=$MDSCAPA"
 [ "x$mdsfailover_HOST" != "x" ] &&
     MOUNTOPT=$MOUNTOPT" --failnode=`h2$NETTYPE $mdsfailover_HOST`"
 [ "x$STRIPE_BYTES" != "x" ] &&
@@ -53,6 +55,8 @@ MOUNTOPT=""
     MKFSOPT=$MKFSOPT" -J size=$OSTJOURNALSIZE"
 [ "x$MKFSOPT" != "x" ] &&
     MKFSOPT="--mkfsoptions=\"$MKFSOPT\""
+[ "x$OSSCAPA" != "x" ] &&
+    MKFSOPT="--param ost.capa=$OSSCAPA"
 [ "x$ostfailover_HOST" != "x" ] &&
     MOUNTOPT=$MOUNTOPT" --failnode=`h2$NETTYPE $ostfailover_HOST`"
 OST_MKFS_OPTS="--ost --fsname=$FSNAME --device-size=$OSTSIZE --mgsnode=$MGSNID --param sys.timeout=$TIMEOUT $MKFSOPT $MOUNTOPT $OSTOPT"