All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] staging: lustre/lustre/obdclass/llog_cat.c: get rid of sparse context imbalance warning
@ 2015-06-03 20:20 Tolga Ceylan
  2015-06-08 19:35 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 6+ messages in thread
From: Tolga Ceylan @ 2015-06-03 20:20 UTC (permalink / raw)
  To: Oleg Drokin, Andreas Dilger, Greg Kroah-Hartman, Julia Lawall,
	Arjun AK, Greg Donald, Darshana Padmadas, Tolga Ceylan,
	Joe Perches, HPDD-discuss, devel, linux-kernel

In llog_cat_new_log(), sparse emits a context imbalance (unexpected lock)
warning due its inability to detect the noreturn attribute in
lbug_with_lock() function inside LBUG macro. With this patch, we unlock
the spinlock before checking the error condition to resolve this warning.

Signed-off-by: Tolga Ceylan <tolga.ceylan@gmail.com>
---
 drivers/staging/lustre/lustre/obdclass/llog_cat.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/lustre/lustre/obdclass/llog_cat.c b/drivers/staging/lustre/lustre/obdclass/llog_cat.c
index c8f6ab0..280e861 100644
--- a/drivers/staging/lustre/lustre/obdclass/llog_cat.c
+++ b/drivers/staging/lustre/lustre/obdclass/llog_cat.c
@@ -103,13 +103,13 @@ static int llog_cat_new_log(const struct lu_env *env,
 
 	spin_lock(&loghandle->lgh_hdr_lock);
 	llh->llh_count++;
-	if (ext2_set_bit(index, llh->llh_bitmap)) {
+	rc = ext2_set_bit(index, llh->llh_bitmap);
+	spin_unlock(&loghandle->lgh_hdr_lock);
+	if (rc) {
 		CERROR("argh, index %u already set in log bitmap?\n",
 		       index);
-		spin_unlock(&loghandle->lgh_hdr_lock);
 		LBUG(); /* should never happen */
 	}
-	spin_unlock(&loghandle->lgh_hdr_lock);
 
 	cathandle->lgh_last_idx = index;
 	llh->llh_tail.lrt_index = index;
-- 
2.4.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread
* [PATCH 1/1] staging: lustre/lustre/obdclass/llog_cat.c: get rid of sparse context imbalance warning
@ 2015-06-02 19:57 Tolga Ceylan
  2015-06-03  6:42 ` Sudip Mukherjee
  0 siblings, 1 reply; 6+ messages in thread
From: Tolga Ceylan @ 2015-06-02 19:57 UTC (permalink / raw)
  To: Oleg Drokin, Andreas Dilger, Greg Kroah-Hartman, Julia Lawall,
	Greg Donald, Joe Perches, Darshana Padmadas, Arjun AK,
	Tolga Ceylan, HPDD-discuss, devel, linux-kernel

In llog_cat_new_log(), sparse emits a context imbalance (unexpected lock)
warning due its inability to detect the noreturn attribute in
lbug_with_lock() function inside LBUG macro. Adding a never reached
return statement suppresses this warning.

Signed-off-by: Tolga Ceylan <tolga.ceylan@gmail.com>
---
 drivers/staging/lustre/lustre/obdclass/llog_cat.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/lustre/lustre/obdclass/llog_cat.c b/drivers/staging/lustre/lustre/obdclass/llog_cat.c
index c8f6ab0..259947c 100644
--- a/drivers/staging/lustre/lustre/obdclass/llog_cat.c
+++ b/drivers/staging/lustre/lustre/obdclass/llog_cat.c
@@ -108,6 +108,7 @@ static int llog_cat_new_log(const struct lu_env *env,
 		       index);
 		spin_unlock(&loghandle->lgh_hdr_lock);
 		LBUG(); /* should never happen */
+		return -EINVAL;
 	}
 	spin_unlock(&loghandle->lgh_hdr_lock);
 
-- 
2.4.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-06-08 19:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-03 20:20 [PATCH 1/1] staging: lustre/lustre/obdclass/llog_cat.c: get rid of sparse context imbalance warning Tolga Ceylan
2015-06-08 19:35 ` Greg Kroah-Hartman
  -- strict thread matches above, loose matches on Subject: below --
2015-06-02 19:57 Tolga Ceylan
2015-06-03  6:42 ` Sudip Mukherjee
2015-06-03 15:47   ` Tolga Ceylan
2015-06-03 16:36     ` Sudip Mukherjee

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.