@@ -150,12 +150,13 @@ struct lustre_sb_info {
int lustre_start_mgc(struct super_block *sb);
int lustre_common_put_super(struct super_block *sb);
-int mgc_fsname2resid(char *fsname, struct ldlm_res_id *res_id, int type);
-
struct lustre_sb_info *lustre_init_lsi(struct super_block *sb);
int lustre_put_lsi(struct super_block *sb);
int lmd_parse(char *options, struct lustre_mount_data *lmd);
+/* mgc_request.c */
+int mgc_fsname2resid(char *fsname, struct ldlm_res_id *res_id, int type);
+
/** @} disk */
#endif /* _LUSTRE_DISK_H */
@@ -1052,8 +1052,6 @@ int ll_fill_super(struct super_block *sb)
CDEBUG(D_VFSTRACE, "VFS Op: sb %p\n", sb);
- try_module_get(THIS_MODULE);
-
cfg = kzalloc(sizeof(*cfg), GFP_NOFS);
if (!cfg) {
err = -ENOMEM;
@@ -1252,9 +1250,6 @@ void ll_put_super(struct super_block *sb)
ll_common_put_super(sb);
cl_env_cache_purge(~0);
-
- module_put(THIS_MODULE);
-
} /* client_put_super */
struct inode *ll_inode_from_resource_lock(struct ldlm_lock *lock)
@@ -32,6 +32,7 @@
*/
#define DEBUG_SUBSYSTEM S_LLITE
+
#define D_MOUNT (D_SUPER | D_CONFIG/*|D_WARNING */)
#include <linux/module.h>
@@ -95,11 +96,12 @@ static int ll_drop_inode(struct inode *inode)
.show_options = ll_show_options,
};
-/** This is the entry point for the mount call into Lustre.
+/**
+ * This is the entry point for the mount call into Lustre.
* This is called when a server or client is mounted,
* and this is where we start setting things up.
*
- * @data: Mount options (e.g. -o flock,abort_recov)
+ * @lmd2data Mount options (e.g. -o flock,abort_recov)
*/
static int lustre_fill_super(struct super_block *sb, void *lmd2_data,
int silent)
@@ -132,30 +134,30 @@ static int lustre_fill_super(struct super_block *sb, void *lmd2_data,
goto out_put_lsi;
}
- if (lmd_is_client(lmd)) {
- CDEBUG(D_MOUNT, "Mounting client %s\n", lmd->lmd_profile);
-
- rc = ptlrpc_inc_ref();
- if (rc)
- goto out_put_lsi;
- rc = lustre_start_mgc(sb);
- if (rc) {
- /* This will put_lsi and ptlrpc_dec_ref */
- ll_common_put_super(sb);
- goto out;
- }
- /* Connect and start */
- rc = ll_fill_super(sb);
- /*
- * c_f_s will call ll_common_put_super on failure, otherwise
- * c_f_s will have taken another reference to the module
- */
- } else {
- CERROR("This is client-side-only module, cannot handle server mount.\n");
- rc = -EINVAL;
+ if (!lmd_is_client(lmd)) {
+ rc = -ENODEV;
+ CERROR("%s: This is client-side-only module, cannot handle server mount: rc = %d\n",
+ lmd->lmd_profile, rc);
+ goto out_put_lsi;
}
- /* If error happens in fill_super() call, @lsi will be killed there.
+ CDEBUG(D_MOUNT, "Mounting client %s\n", lmd->lmd_profile);
+ rc = ptlrpc_inc_ref();
+ if (rc)
+ goto out_put_lsi;
+
+ rc = lustre_start_mgc(sb);
+ if (rc) {
+ /* This will put_lsi and ptlrpc_dec_ref */
+ ll_common_put_super(sb);
+ goto out;
+ }
+ /* Connect and start */
+ rc = ll_fill_super(sb);
+ /* ll_file_super will call lustre_common_put_super on failure,
+ * which takes care of the module reference.
+ *
+ * If error happens in fill_super() call, @lsi will be killed there.
* This is why we do not put it here.
*/
goto out;
@@ -163,10 +165,10 @@ static int lustre_fill_super(struct super_block *sb, void *lmd2_data,
lustre_put_lsi(sb);
out:
if (rc) {
- CERROR("Unable to mount %s (%d)\n",
- s2lsi(sb) ? lmd->lmd_dev : "", rc);
+ CERROR("llite: Unable to mount %s: rc = %d\n",
+ s2lsi(sb) ? lmd->lmd_dev : "<unknown>", rc);
} else {
- CDEBUG(D_SUPER, "Mount %s complete\n",
+ CDEBUG(D_SUPER, "%s: Mount complete\n",
lmd->lmd_dev);
}
lockdep_on();
@@ -268,10 +270,12 @@ static int __init lustre_init(void)
rc = register_filesystem(&lustre_fs_type);
if (rc)
- goto out_inode_fini_env;
+ goto out_xattr;
return 0;
+out_xattr:
+ ll_xattr_fini();
out_inode_fini_env:
cl_env_put(cl_inode_fini_env, &cl_inode_fini_refcheck);
out_vvp:
@@ -719,12 +719,14 @@ static int __init obdclass_init(void)
/* simulate a late OOM situation now to require all
* alloc'ed/initialized resources to be freed
*/
- if (!OBD_FAIL_CHECK(OBD_FAIL_OBDCLASS_MODULE_LOAD))
- return 0;
-
- /* force error to ensure module will be unloaded/cleaned */
- err = -ENOMEM;
+ if (OBD_FAIL_CHECK(OBD_FAIL_OBDCLASS_MODULE_LOAD)) {
+ /* force error to ensure module will be unloaded/cleaned */
+ err = -ENOMEM;
+ goto cleanup_all;
+ }
+ return 0;
+cleanup_all:
llog_info_fini();
cleanup_cl_global:
@@ -748,9 +750,6 @@ static int __init obdclass_init(void)
cleanup_zombie_impexp:
obd_zombie_impexp_stop();
- if (err)
- return err;
-
return err;
}