static int confobd_setup(struct obd_device *obd, obd_count len, void *buf)
{
struct conf_obd *confobd = &obd->u.conf;
- struct lustre_cfg* lcfg = buf;
struct lvfs_obd_ctxt *lvfs_ctxt = NULL;
- char *name = NULL;
+ struct lustre_cfg* lcfg = buf;
+ char *mountoptions = NULL;
+ unsigned long page = 0;
char *fstype = NULL;
- char *mountoption = NULL;
+ char *name = NULL;
int rc = 0;
ENTRY;
OBD_ALLOC(name, LUSTRE_CFG_BUFLEN(lcfg, 1));
if (!name) {
- CERROR("No Memory\n");
+ CERROR("No memory\n");
GOTO(out, rc = -ENOMEM);
}
memcpy(name, lustre_cfg_string(lcfg, 1), LUSTRE_CFG_BUFLEN(lcfg, 1));
OBD_ALLOC(fstype, LUSTRE_CFG_BUFLEN(lcfg, 2));
if (!fstype) {
- CERROR("No Memory\n");
+ CERROR("No memory\n");
GOTO(out, rc = -ENOMEM);
}
memcpy(fstype, lustre_cfg_string(lcfg, 2),
}
if (LUSTRE_CFG_BUFLEN(lcfg, 3) >= 1 && lustre_cfg_buf(lcfg, 3)) {
- OBD_ALLOC(mountoption, LUSTRE_CFG_BUFLEN(lcfg, 3));
- if (!mountoption) {
- CERROR("No Memory\n");
+ /* 2.6.9 selinux wants a full option page for do_kern_mount
+ * (bug6471) */
+ page = get_zeroed_page(GFP_KERNEL);
+ if (!page) {
+ CERROR("No memory\n");
GOTO(err_ops, rc = -ENOMEM);
}
- memcpy(mountoption, lustre_cfg_string(lcfg, 3),
+ mountoptions = (char *)page;
+
+ memcpy(mountoptions, lustre_cfg_string(lcfg, 3),
LUSTRE_CFG_BUFLEN(lcfg, 3));
}
- rc = lvfs_mount_fs(name, fstype, mountoption, 0, &lvfs_ctxt);
+
+ rc = lvfs_mount_fs(name, fstype, mountoptions, 0, &lvfs_ctxt);
+
+ if (page) {
+ free_page(page);
+ page = 0;
+ }
+
if (rc)
GOTO(err_ops, rc);
- LASSERT(lvfs_ctxt);
+ LASSERT(lvfs_ctxt);
confobd->cfobd_lvfs_ctxt = lvfs_ctxt;
rc = confobd_fs_setup(obd, lvfs_ctxt);
OBD_FREE(name, LUSTRE_CFG_BUFLEN(lcfg, 1));
if (fstype)
OBD_FREE(fstype, LUSTRE_CFG_BUFLEN(lcfg, 2));
- if (mountoption)
- OBD_FREE(mountoption, LUSTRE_CFG_BUFLEN(lcfg, 3));
return rc;
err_ops:
typelen = strlen(typestr);
CDEBUG(D_INODE, "smfs: mounting %s at %s\n", typestr, devstr);
+
mnt = do_kern_mount(typestr, 0, devstr, (void *)opts);
if (IS_ERR(mnt)) {
CERROR("do_kern_mount failed: rc = %ld\n",
struct inode *root_inode = NULL;
struct inode *back_root_inode = NULL;
struct smfs_super_info *smb = NULL;
- char *devstr = NULL, *typestr = NULL;
+ char *devstr = NULL, *typestr = NULL;
+ unsigned long page = 0;
char *opts = NULL;
- int err = 0;
int flags = 0;
+ int err = 0;
ENTRY;
smb = smfs_init_smb(sb);
if (!smb)
RETURN(-ENOMEM);
+
lock_kernel();
- OBD_ALLOC(opts, strlen(data) + 1);
- if (!opts) {
+
+ /* 2.6.9 selinux wants a full option page for do_kern_mount (bug6471) */
+ page = get_zeroed_page(GFP_KERNEL);
+ if (!page) {
err = -ENOMEM;
goto out_err;
}
+ opts = (char *)page;
err = smfs_options(data, &devstr, &typestr, opts, &flags);
if (err)
goto out_err;
}
- OBD_FREE(opts, strlen(data) + 1);
- opts = NULL;
+ free_page(page);
+ page = 0;
duplicate_sb(sb, smb->smsi_sb);
sb->s_bdev = smb->smsi_sb->s_bdev;
if (smb->smsi_mnt)
smfs_umount_cache(smb);
- if (opts)
- OBD_FREE(opts, strlen(data) + 1);
+ if (page)
+ free_page(page);
smfs_cleanup_smb(smb);
unlock_kernel();