Whamcloud - gitweb
- passing full options page to do_kern_mount() in confobd and smfs too like it is...
authoryury <yury>
Wed, 6 Jul 2005 16:49:20 +0000 (16:49 +0000)
committeryury <yury>
Wed, 6 Jul 2005 16:49:20 +0000 (16:49 +0000)
lustre/mds/handler.c
lustre/obdclass/confobd.c
lustre/smfs/smfs_lib.c

index f6ab6c1..77c4b23 100644 (file)
@@ -3250,12 +3250,11 @@ static int mds_setup(struct obd_device *obd, obd_count len, void *buf)
 
         mds->mds_max_mdsize = sizeof(struct lov_mds_md);
 
-        page = __get_free_page(GFP_KERNEL);
+        page = get_zeroed_page(GFP_KERNEL);
         if (!page)
                 RETURN(-ENOMEM);
 
         options = (char *)page;
-        memset(options, 0, PAGE_SIZE);
 
         /*
          * here we use "iopen_nopriv" hardcoded, because it affects MDS utility
index 6baeb7f..076b91c 100644 (file)
@@ -144,11 +144,12 @@ int confobd_detach(struct obd_device *dev)
 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;
 
@@ -165,14 +166,14 @@ static int confobd_setup(struct obd_device *obd, obd_count len, void *buf)
 
         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), 
@@ -185,19 +186,30 @@ static int confobd_setup(struct obd_device *obd, obd_count len, void *buf)
         }
 
         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);
@@ -217,8 +229,6 @@ out:
                 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:
index 68e2421..26fd776 100644 (file)
@@ -278,6 +278,7 @@ static int smfs_mount_cache(struct smfs_super_info *smb, char *devstr,
         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", 
@@ -370,10 +371,11 @@ int smfs_fill_super(struct super_block *sb, void *data, int silent)
         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;
         
@@ -388,12 +390,16 @@ int smfs_fill_super(struct super_block *sb, void *data, int silent)
         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)
@@ -413,8 +419,8 @@ int smfs_fill_super(struct super_block *sb, void *data, int silent)
                 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;
@@ -451,8 +457,8 @@ out_err:
         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();