From 3857faaaa1dfe89f903c9a3e1f35eba32595801d Mon Sep 17 00:00:00 2001 From: "John L. Hammond" Date: Mon, 17 Dec 2012 17:34:57 -0600 Subject: [PATCH] LU-2504 procfs: Call put_cpu() if stats alloc fails Call put_cpu() if lprocfs_stats_alloc_one() fails in lprocfs_stats_lock(). Signed-off-by: John L. Hammond Change-Id: I12c3eb9ecbbef3086493d63c300ddb853d86dd98 Reviewed-on: http://review.whamcloud.com/4845 Tested-by: Hudson Tested-by: Maloo Reviewed-by: Keith Mannthey Reviewed-by: Bob Glossman Reviewed-by: Oleg Drokin --- lustre/include/lprocfs_status.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lustre/include/lprocfs_status.h b/lustre/include/lprocfs_status.h index 1c2b906..030df3f 100644 --- a/lustre/include/lprocfs_status.h +++ b/lustre/include/lprocfs_status.h @@ -389,9 +389,15 @@ static inline int lprocfs_stats_lock(struct lprocfs_stats *stats, int opc, if ((stats->ls_flags & LPROCFS_STATS_FLAG_NOPERCPU) == 0) { cpuid = cfs_get_cpu(); - if (unlikely(stats->ls_percpu[cpuid + 1] == NULL)) + if (unlikely(stats->ls_percpu[cpuid + 1] == NULL)) { rc = lprocfs_stats_alloc_one(stats, cpuid + 1); - return rc < 0 ? rc : cpuid + 1; + if (rc < 0) { + cfs_put_cpu(); + return rc; + } + } + + return cpuid + 1; } /* non-percpu counter stats */ -- 1.8.3.1