In class_procfs_init() if /proc/fs/lustre/ or /proc/fs/lustre/devices
cannot be created then cleanup and return an error.
Signed-off-by: John L. Hammond <john.hammond@intel.com>
Change-Id: I236a4af31c44b73207d411c02873c10ee7478ca7
Reviewed-on: http://review.whamcloud.com/11935
Tested-by: Jenkins
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: James Simmons <uja.ornl@gmail.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
int class_procfs_init(void)
{
int class_procfs_init(void)
{
+ struct proc_dir_entry *entry;
int rc;
ENTRY;
obd_sysctl_init();
int rc;
ENTRY;
obd_sysctl_init();
- proc_lustre_root = lprocfs_seq_register("fs/lustre", NULL,
- lprocfs_base, NULL);
+
+ entry = lprocfs_seq_register("fs/lustre", NULL, lprocfs_base, NULL);
+ if (IS_ERR(entry)) {
+ rc = PTR_ERR(entry);
+ CERROR("cannot create '/proc/fs/lustre': rc = %d\n", rc);
+ RETURN(rc);
+ }
+
+ proc_lustre_root = entry;
+
rc = lprocfs_seq_create(proc_lustre_root, "devices", 0444,
&obd_device_list_fops, NULL);
rc = lprocfs_seq_create(proc_lustre_root, "devices", 0444,
&obd_device_list_fops, NULL);
- if (rc)
- CERROR("error adding /proc/fs/lustre/devices file\n");
- RETURN(0);
+ if (rc < 0) {
+ CERROR("cannot create '/proc/fs/lustre/devices': rc = %d\n",
+ rc);
+ GOTO(out_proc, rc);
+ }
+
+ RETURN(rc);
+
+out_proc:
+ lprocfs_remove(&proc_lustre_root);
+
+ RETURN(rc);
}
int class_procfs_clean(void)
}
int class_procfs_clean(void)