* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*
- * Copyright (c) 2011, 2012, Intel Corporation.
+ * Copyright (c) 2013, Intel Corporation.
*/
/*
* This file is part of Lustre, http://www.lustre.org/
#include <obd.h>
#include <lvfs.h>
-#include <lustre_fsfilt.h>
#include <obd_class.h>
#include <lustre/lustre_user.h>
#include <linux/version.h>
#ifdef HAVE_KERNEL_LOCKED
#include <linux/smp_lock.h>
#endif
+#ifdef HAVE_SELINUX_IS_ENABLED
+#include <linux/selinux.h>
+#endif
/*********** mount lookup *********/
rc = lustre_start_simple(LUSTRE_MGS_OBDNAME, LUSTRE_MGS_NAME,
LUSTRE_MGS_OBDNAME, 0, 0,
lsi->lsi_osd_obdname, 0);
- /* Do NOT call server_deregister_mount() here. This leads to
- * inability cleanup cleanly and free lsi and other stuff when
- * mgs calls server_put_mount() in error handling case. -umka */
+ /* server_deregister_mount() is not called previously, for lsi
+ * and other stuff can't be freed cleanly when mgs calls
+ * server_put_mount() in error handling case (see b=17758),
+ * this problem is caused by a bug in mgs_init0, which forgot
+ * calling server_put_mount in error case. */
+
+ if (rc)
+ server_deregister_mount(LUSTRE_MGS_OBDNAME);
}
if (rc)
**/
static int lustre_lwp_setup(struct lustre_cfg *lcfg, struct lustre_sb_info *lsi)
{
- struct obd_connect_data *data = NULL;
struct obd_device *obd;
char *lwpname = NULL;
char *lwpuuid = NULL;
if (rc != 0)
CERROR("%s: connect failed: rc = %d\n", lwpname, rc);
out:
- if (data != NULL)
- OBD_FREE_PTR(data);
if (lwpname != NULL)
OBD_FREE(lwpname, MTI_NAME_MAXLEN);
if (lwpuuid != NULL)
}
if (obd != NULL && (type == NULL || type->typ_refcnt == 0)) {
- int err;
-
obd->obd_force = 1;
/* obd_fail doesn't mean much on a server obd */
- err = class_manual_cleanup(obd);
- if (rc != 0)
- rc = err;
+ rc = class_manual_cleanup(obd);
}
mutex_unlock(&server_start_lock);
.statfs = server_statfs,
};
+/*
+ * Xattr support for Lustre servers
+ */
+static ssize_t lustre_getxattr(struct dentry *dentry, const char *name,
+ void *buffer, size_t size)
+{
+ if (!selinux_is_enabled())
+ return -EOPNOTSUPP;
+ return -ENODATA;
+}
+
+static int lustre_setxattr(struct dentry *dentry, const char *name,
+ const void *value, size_t size, int flags)
+{
+ return -EOPNOTSUPP;
+}
+
+static ssize_t lustre_listxattr(struct dentry *d_entry, char *name,
+ size_t size)
+{
+ return -EOPNOTSUPP;
+}
+
+const struct inode_operations server_inode_operations = {
+ .setxattr = lustre_setxattr,
+ .getxattr = lustre_getxattr,
+ .listxattr = lustre_listxattr,
+};
+
#define log2(n) ffz(~(n))
#define LUSTRE_SUPER_MAGIC 0x0BD00BD1
/* make_bad_inode(root); -- badness - can't umount */
/* apparently we need to be a directory for the mount to finish */
root->i_mode = S_IFDIR;
-
+ root->i_op = &server_inode_operations;
sb->s_root = d_make_root(root);
if (!sb->s_root) {
CERROR("%s: can't make root dentry\n", sb->s_id);
obd->obd_force = 1;
class_manual_cleanup(obd);
lsi->lsi_dt_dev = NULL;
+ RETURN(rc);
}
- /* XXX: to keep support old components relying on lsi_srv_mnt
- * we get this info from OSD just started */
LASSERT(obd->obd_lu_dev);
+ lu_device_get(obd->obd_lu_dev);
lsi->lsi_dt_dev = lu2dt_dev(obd->obd_lu_dev);
LASSERT(lsi->lsi_dt_dev);
+ /* set disk context for llog usage */
+ OBD_SET_CTXT_MAGIC(&obd->obd_lvfs_ctxt);
+ obd->obd_lvfs_ctxt.dt = lsi->lsi_dt_dev;
+
dt_conf_get(NULL, lsi->lsi_dt_dev, &p);
lsi->lsi_srv_mnt = p.ddp_mnt;