@@ -453,7 +453,7 @@ void lprocfs_counter_init(struct lprocfs_stats *stats, int index,
void ldebugfs_add_vars(struct dentry *parent, struct lprocfs_vars *var,
void *data);
-int lprocfs_obd_setup(struct obd_device *obd);
+int lprocfs_obd_setup(struct obd_device *obd, bool uuid_only);
int lprocfs_obd_cleanup(struct obd_device *obd);
/* Generic callbacks */
@@ -1255,7 +1255,7 @@ static int lmv_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
lprocfs_lmv_init_vars(obd);
- lprocfs_obd_setup(obd);
+ lprocfs_obd_setup(obd, true);
debugfs_create_file("target_obd", 0444, obd->obd_debugfs_entry, obd,
&lmv_proc_target_fops);
rc = fld_client_init(&lmv->lmv_fld, obd->obd_name,
@@ -769,7 +769,7 @@ int lov_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
goto out;
lprocfs_lov_init_vars(obd);
- lprocfs_obd_setup(obd);
+ lprocfs_obd_setup(obd, false);
debugfs_create_file("target_obd", 0444, obd->obd_debugfs_entry, obd,
&lov_proc_target_fops);
@@ -2648,7 +2648,7 @@ static int mdc_setup(struct obd_device *obd, struct lustre_cfg *cfg)
goto err_ptlrpcd_decref;
lprocfs_mdc_init_vars(obd);
- lprocfs_obd_setup(obd);
+ lprocfs_obd_setup(obd, false);
sptlrpc_lprocfs_cliobd_attach(obd);
ptlrpc_lprocfs_register_obd(obd);
@@ -748,7 +748,7 @@ static int mgc_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
}
lprocfs_mgc_init_vars(obd);
- lprocfs_obd_setup(obd);
+ lprocfs_obd_setup(obd, true);
sptlrpc_lprocfs_cliobd_attach(obd);
if (atomic_inc_return(&mgc_count) == 1) {
@@ -989,6 +989,11 @@ int lprocfs_rd_connect_flags(struct seq_file *m, void *data)
}
EXPORT_SYMBOL(lprocfs_rd_connect_flags);
+static const struct attribute *obd_def_uuid_attrs[] = {
+ &lustre_attr_uuid.attr,
+ NULL,
+};
+
static const struct attribute *obd_def_attrs[] = {
&lustre_attr_blocksize.attr,
&lustre_attr_kbytestotal.attr,
@@ -1008,7 +1013,7 @@ static void obd_sysfs_release(struct kobject *kobj)
complete(&obd->obd_kobj_unregister);
}
-int lprocfs_obd_setup(struct obd_device *obd)
+int lprocfs_obd_setup(struct obd_device *obd, bool uuid_only)
{
int rc;
@@ -1022,7 +1027,12 @@ int lprocfs_obd_setup(struct obd_device *obd)
if (rc)
return rc;
- rc = sysfs_create_files(&obd->obd_kobj, obd_def_attrs);
+ if (uuid_only)
+ obd->obd_attrs = obd_def_uuid_attrs;
+ else
+ obd->obd_attrs = obd_def_attrs;
+
+ rc = sysfs_create_files(&obd->obd_kobj, obd->obd_attrs);
if (rc) {
kobject_put(&obd->obd_kobj);
return rc;
@@ -1043,7 +1053,10 @@ int lprocfs_obd_cleanup(struct obd_device *obd)
debugfs_remove_recursive(obd->obd_debugfs_entry);
- sysfs_remove_files(&obd->obd_kobj, obd_def_attrs);
+ if (obd->obd_attrs) {
+ sysfs_remove_files(&obd->obd_kobj, obd->obd_attrs);
+ obd->obd_attrs = NULL;
+ }
kobject_put(&obd->obd_kobj);
wait_for_completion(&obd->obd_kobj_unregister);
@@ -2804,7 +2804,7 @@ int osc_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
cli->cl_grant_shrink_interval = GRANT_SHRINK_INTERVAL;
lprocfs_osc_init_vars(obd);
- if (lprocfs_obd_setup(obd) == 0) {
+ if (lprocfs_obd_setup(obd, false) == 0) {
lproc_osc_attach_seqstat(obd);
sptlrpc_lprocfs_cliobd_attach(obd);
ptlrpc_lprocfs_register_obd(obd);