From 229ca819001710e5a53b335ef9a3623daf692386 Mon Sep 17 00:00:00 2001 From: "John L. Hammond" Date: Mon, 15 Sep 2014 19:02:49 -0500 Subject: [PATCH] LU-3331 obdclass: return errors from class_procfs_init() 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 Change-Id: I236a4af31c44b73207d411c02873c10ee7478ca7 Reviewed-on: http://review.whamcloud.com/11935 Tested-by: Jenkins Reviewed-by: Bob Glossman Reviewed-by: James Simmons Tested-by: Maloo Reviewed-by: Andreas Dilger --- lustre/obdclass/linux/linux-module.c | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/lustre/obdclass/linux/linux-module.c b/lustre/obdclass/linux/linux-module.c index 04ec8c5..56ee26c 100644 --- a/lustre/obdclass/linux/linux-module.c +++ b/lustre/obdclass/linux/linux-module.c @@ -412,17 +412,35 @@ struct file_operations obd_device_list_fops = { int class_procfs_init(void) { + struct proc_dir_entry *entry; 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); - 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) -- 1.8.3.1