#define PRINT_MASK (D_SUPER | D_CONFIG)
#include <obd.h>
-#include <lvfs.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 *********/
/* we must register an obd for a mount before we call the setup routine.
*_setup will call lustre_get_mount to get the mnt struct
by obd_name, since we can't pass the pointer to setup. */
-static int server_register_mount(const char *name, struct super_block *sb,
- struct vfsmount *mnt)
+static int server_register_mount(const char *name, struct super_block *sb)
{
struct lustre_mount_info *lmi;
char *name_cp;
}
lmi->lmi_name = name_cp;
lmi->lmi_sb = sb;
- lmi->lmi_mnt = mnt;
cfs_list_add(&lmi->lmi_list_chain, &server_mount_info_list);
mutex_unlock(&lustre_mount_info_lock);
- CDEBUG(D_MOUNT, "reg_mnt %p from %s\n", lmi->lmi_mnt, name);
+ CDEBUG(D_MOUNT, "register mount %p from %s\n", sb, name);
RETURN(0);
}
RETURN(-ENOENT);
}
- CDEBUG(D_MOUNT, "dereg_mnt %p from %s\n", lmi->lmi_mnt, name);
+ CDEBUG(D_MOUNT, "deregister mount %p from %s\n", lmi->lmi_sb, name);
OBD_FREE(lmi->lmi_name, strlen(lmi->lmi_name) + 1);
cfs_list_del(&lmi->lmi_list_chain);
cfs_atomic_inc(&lsi->lsi_mounts);
- CDEBUG(D_MOUNT, "get_mnt %p from %s, refs=%d\n", lmi->lmi_mnt,
+ CDEBUG(D_MOUNT, "get mount %p from %s, refs=%d\n", lmi->lmi_sb,
name, cfs_atomic_read(&lsi->lsi_mounts));
RETURN(lmi);
EXPORT_SYMBOL(server_get_mount_2);
/* to be called from obd_cleanup methods */
-int server_put_mount(const char *name, struct vfsmount *mnt)
+int server_put_mount(const char *name)
{
struct lustre_mount_info *lmi;
struct lustre_sb_info *lsi;
}
lsi = s2lsi(lmi->lmi_sb);
- CDEBUG(D_MOUNT, "put_mnt %p from %s, refs=%d\n",
- lmi->lmi_mnt, name, cfs_atomic_read(&lsi->lsi_mounts));
+ CDEBUG(D_MOUNT, "put mount %p from %s, refs=%d\n",
+ lmi->lmi_sb, name, cfs_atomic_read(&lsi->lsi_mounts));
if (lustre_put_lsi(lmi->lmi_sb))
- CDEBUG(D_MOUNT, "Last put of mnt %p from %s\n",
- lmi->lmi_mnt, name);
+ CDEBUG(D_MOUNT, "Last put of mount %p from %s\n",
+ lmi->lmi_sb, name);
/* this obd should never need the mount again */
server_deregister_mount(name);
static int server_start_mgs(struct super_block *sb)
{
struct lustre_sb_info *lsi = s2lsi(sb);
- struct vfsmount *mnt = lsi->lsi_srv_mnt;
struct lustre_mount_info *lmi;
int rc = 0;
ENTRY;
CDEBUG(D_CONFIG, "Start MGS service %s\n", LUSTRE_MGS_OBDNAME);
- rc = server_register_mount(LUSTRE_MGS_OBDNAME, sb, mnt);
+ rc = server_register_mount(LUSTRE_MGS_OBDNAME, sb);
if (!rc) {
rc = lustre_start_simple(LUSTRE_MGS_OBDNAME, LUSTRE_MGS_NAME,
if (rc != 0)
RETURN(rc);
- lu_context_init(&session_ctx, LCT_SESSION);
+ lu_context_init(&session_ctx, LCT_SERVER_SESSION);
session_ctx.lc_thread = NULL;
lu_context_enter(&session_ctx);
env.le_ses = &session_ctx;
**/
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);
/** Start server targets: MDTs and OSTs
*/
-static int server_start_targets(struct super_block *sb, struct vfsmount *mnt)
+static int server_start_targets(struct super_block *sb)
{
struct obd_device *obd;
struct lustre_sb_info *lsi = s2lsi(sb);
/* Set the mgc fs to our server disk. This allows the MGC to
* read and write configs locally, in case it can't talk to the MGS. */
- if (lsi->lsi_srv_mnt) {
- rc = server_mgc_set_fs(lsi->lsi_mgc, sb);
- if (rc)
- GOTO(out_stop_service, rc);
- }
+ rc = server_mgc_set_fs(lsi->lsi_mgc, sb);
+ if (rc)
+ GOTO(out_stop_service, rc);
/* Register with MGS */
rc = server_register_target(lsi);
/* Let the target look up the mount using the target's name
(we can't pass the sb or mnt through class_process_config.) */
- rc = server_register_mount(lsi->lsi_svname, sb, mnt);
+ rc = server_register_mount(lsi->lsi_svname, sb);
if (rc)
GOTO(out_mgc, rc);
if (rc == 0) {
struct lu_context session_ctx;
- lu_context_init(&session_ctx, LCT_SESSION);
+ lu_context_init(&session_ctx, LCT_SERVER_SESSION);
session_ctx.lc_thread = NULL;
lu_context_enter(&session_ctx);
env.le_ses = &session_ctx;
out_mgc:
/* Release the mgc fs for others to use */
- if (lsi->lsi_srv_mnt)
- server_mgc_clear_fs(lsi->lsi_mgc);
+ server_mgc_clear_fs(lsi->lsi_mgc);
out_stop_service:
if (rc != 0)
strcpy(lsi->lsi_osd_type, LUSTRE_OSD_LDISKFS_NAME);
}
- /* XXX: a temp. solution for components using fsfilt
+ /* XXX: a temp. solution for components using ldiskfs
* to be removed in one of the subsequent patches */
if (!strcmp(lsi->lsi_lmd->lmd_osd_type, "osd-ldiskfs"))
strcpy(lsi->lsi_fstype, "ldiskfs");
.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);
- dt_conf_get(NULL, lsi->lsi_dt_dev, &p);
-
- lsi->lsi_srv_mnt = p.ddp_mnt;
+ /* 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);
out:
RETURN(rc);
}
/* Set up all obd devices for service */
if (!(lsi->lsi_lmd->lmd_flags & LMD_FLG_NOSVC) &&
(IS_OST(lsi) || IS_MDT(lsi))) {
- rc = server_start_targets(sb, lsi->lsi_srv_mnt);
+ rc = server_start_targets(sb);
if (rc < 0) {
CERROR("Unable to start targets: %d\n", rc);
GOTO(out_mnt, rc);