Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1157118 > unrolled thread

Re: [PATCH 1/1] staging: lustre/lustre/obdclass/llog_cat.c: get rid of sparse context imbalance warning

Started bySudip Mukherjee <sudipm.mukherjee@gmail.com>
First post2015-06-03 08:50 +0200
Last post2015-06-03 18:40 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH 1/1] staging: lustre/lustre/obdclass/llog_cat.c: get rid  of sparse context imbalance warning Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2015-06-03 08:50 +0200
    Re: [PATCH 1/1] staging: lustre/lustre/obdclass/llog_cat.c: get rid  of sparse context imbalance warning Tolga Ceylan <tolga.ceylan@gmail.com> - 2015-06-03 17:50 +0200
      Re: [PATCH 1/1] staging: lustre/lustre/obdclass/llog_cat.c: get rid  of sparse context imbalance warning Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2015-06-03 18:40 +0200

#1157118 — Re: [PATCH 1/1] staging: lustre/lustre/obdclass/llog_cat.c: get rid of sparse context imbalance warning

FromSudip Mukherjee <sudipm.mukherjee@gmail.com>
Date2015-06-03 08:50 +0200
SubjectRe: [PATCH 1/1] staging: lustre/lustre/obdclass/llog_cat.c: get rid of sparse context imbalance warning
Message-ID<pxaEV-186-5@gated-at.bofh.it>
On Tue, Jun 02, 2015 at 12:57:20PM -0700, Tolga Ceylan wrote:
> 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.
but adding a statement which never executes, is that the correct solution?
what about :

diff --git a/drivers/staging/lustre/lustre/obdclass/llog_cat.c b/drivers/staging/lustre/lustre/obdclass/llog_cat.c
index c8f6ab0..1cb3495 100644
--- a/drivers/staging/lustre/lustre/obdclass/llog_cat.c
+++ b/drivers/staging/lustre/lustre/obdclass/llog_cat.c
@@ -103,13 +103,12 @@ 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)) {
-		CERROR("argh, index %u already set in log bitmap?\n",
-		       index);
-		spin_unlock(&loghandle->lgh_hdr_lock);
+	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);
 		LBUG(); /* should never happen */
 	}
-	spin_unlock(&loghandle->lgh_hdr_lock);
 
 	cathandle->lgh_last_idx = index;
 	llh->llh_tail.lrt_index = index;


regards
sudip	

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1157789

FromTolga Ceylan <tolga.ceylan@gmail.com>
Date2015-06-03 17:50 +0200
Message-ID<pxj5w-5s8-15@gated-at.bofh.it>
In reply to#1157118
The second patch is better (it also keeps the lock locked shorter.) Do
I need to resend?

On Tue, Jun 2, 2015 at 11:42 PM, Sudip Mukherjee
<sudipm.mukherjee@gmail.com> wrote:
> On Tue, Jun 02, 2015 at 12:57:20PM -0700, Tolga Ceylan wrote:
>> 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.
> but adding a statement which never executes, is that the correct solution?
> what about :
>
> diff --git a/drivers/staging/lustre/lustre/obdclass/llog_cat.c b/drivers/staging/lustre/lustre/obdclass/llog_cat.c
> index c8f6ab0..1cb3495 100644
> --- a/drivers/staging/lustre/lustre/obdclass/llog_cat.c
> +++ b/drivers/staging/lustre/lustre/obdclass/llog_cat.c
> @@ -103,13 +103,12 @@ 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)) {
> -               CERROR("argh, index %u already set in log bitmap?\n",
> -                      index);
> -               spin_unlock(&loghandle->lgh_hdr_lock);
> +       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);
>                 LBUG(); /* should never happen */
>         }
> -       spin_unlock(&loghandle->lgh_hdr_lock);
>
>         cathandle->lgh_last_idx = index;
>         llh->llh_tail.lrt_index = index;
>
>
> regards
> sudip
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1157826

FromSudip Mukherjee <sudipm.mukherjee@gmail.com>
Date2015-06-03 18:40 +0200
Message-ID<pxjRU-6Dp-5@gated-at.bofh.it>
In reply to#1157789
On Wed, Jun 03, 2015 at 08:47:38AM -0700, Tolga Ceylan wrote:
> The second patch is better (it also keeps the lock locked shorter.) Do
> I need to resend?
yes, please, it was not formally submitted.

regards
sudip
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web