* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*
- * Copyright (c) 2010, 2014, Intel Corporation.
+ * Copyright (c) 2010, 2015, Intel Corporation.
*/
/*
* This file is part of Lustre, http://www.lustre.org/
RETURN(0);
}
+static inline bool str_starts_with(const char *str, const char *prefix)
+{
+ return strncmp(str, prefix, strlen(prefix)) == 0;
+}
+
static int mgs_set_info(struct tgt_session_info *tsi)
{
struct mgs_thread_info *mgi;
struct mgs_send_param *msp, *rep_msp;
struct lustre_cfg *lcfg;
+ size_t param_len;
+ char *s;
int rc;
ENTRY;
if (msp == NULL)
RETURN(err_serious(-EFAULT));
+ param_len = strnlen(msp->mgs_param, sizeof(msp->mgs_param));
+ if (param_len == 0 || param_len == sizeof(msp->mgs_param))
+ RETURN(-EINVAL);
+
+ /* We only allow '*.lov.stripe{size,count,offset}=*' from an RPC. */
+ s = strchr(msp->mgs_param, '.');
+ if (s == NULL)
+ RETURN(-EINVAL);
+
+ if (!str_starts_with(s + 1, "lov.stripesize=") &&
+ !str_starts_with(s + 1, "lov.stripecount=") &&
+ !str_starts_with(s + 1, "lov.stripeoffset="))
+ RETURN(-EINVAL);
+
/* Construct lustre_cfg structure to pass to function mgs_setparam */
lustre_cfg_bufs_reset(&mgi->mgi_bufs, NULL);
lustre_cfg_bufs_set_string(&mgi->mgi_bufs, 1, msp->mgs_param);
/* from mdt_iocontrol */
static int mgs_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
- void *karg, void *uarg)
+ void *karg, void __user *uarg)
{
struct mgs_device *mgs = exp2mgs_dev(exp);
struct obd_ioctl_data *data = karg;
rc = mgs_iocontrol_nodemap(&env, mgs, data);
break;
- case OBD_IOC_DUMP_LOG: {
- struct llog_ctxt *ctxt;
-
- ctxt = llog_get_context(mgs->mgs_obd, LLOG_CONFIG_ORIG_CTXT);
- rc = class_config_dump_llog(&env, ctxt, data->ioc_inlbuf1,
- NULL);
- llog_ctxt_put(ctxt);
-
- break;
- }
-
case OBD_IOC_CATLOGLIST:
rc = mgs_list_logs(&env, mgs, data);
break;
LUSTRE_MGS_NAME, &mgs_device_type);
}
-static void /*__exit*/ mgs_exit(void)
+static void __exit mgs_exit(void)
{
class_unregister_type(LUSTRE_MGS_NAME);
}
-MODULE_AUTHOR("Sun Microsystems, Inc. <http://www.lustre.org/>");
-MODULE_DESCRIPTION("Lustre Management Server (MGS)");
+MODULE_AUTHOR("OpenSFS, Inc. <http://www.lustre.org/>");
+MODULE_DESCRIPTION("Lustre Management Server (MGS)");
+MODULE_VERSION(LUSTRE_VERSION_STRING);
MODULE_LICENSE("GPL");
module_init(mgs_init);