public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Heiko Carstens <heiko.carstens@de.ibm.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: mm-commits@vger.kernel.org, agk@redhat.com, jbrassow@redhat.com,
	linux-kernel@vger.kernel.org
Subject: Re: + dm-raid1-bitops-bug.patch added to -mm tree
Date: Mon, 17 Mar 2008 16:45:57 +0100	[thread overview]
Message-ID: <20080317154557.GD6500@osiris.boeblingen.de.ibm.com> (raw)
In-Reply-To: <200802230732.m1N7Wdmr018088@imap1.linux-foundation.org>

> Subject: dm raid1: bitops bug
> From: Heiko Carstens <heiko.carstens@de.ibm.com>
> 
> Commit 8f0205b798f926e2745de5fdebf0a8605c621de6
> "dm raid1: handle recovery failures" introduces a test_bit on an
> integer. test_bit is only defined to do something useful on arrays
> of long. Remove the test_bit code and use hand coded test bit
> instead.
> 
> Cc: Jonathan Brassow <jbrassow@redhat.com>
> Cc: Alasdair G Kergon <agk@redhat.com>
> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---
> 
>  drivers/md/dm-raid1.c |    7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff -puN drivers/md/dm-raid1.c~dm-raid1-bitops-bug drivers/md/dm-raid1.c
> --- a/drivers/md/dm-raid1.c~dm-raid1-bitops-bug
> +++ a/drivers/md/dm-raid1.c
> @@ -758,7 +758,8 @@ static void recovery_complete(int read_e
>  {
>  	struct region *reg = (struct region *)context;
>  	struct mirror_set *ms = reg->rh->ms;
> -	int m, bit = 0;
> +	unsigned int mask = 1;
> +	int m;
> 
>  	if (read_err) {
>  		/* Read error means the failure of default mirror. */
> @@ -776,10 +777,10 @@ static void recovery_complete(int read_e
>  		for (m = 0; m < ms->nr_mirrors; m++) {
>  			if (&ms->mirror[m] == get_default_mirror(ms))
>  				continue;
> -			if (test_bit(bit, &write_err))
> +			if (write_err & mask)
>  				fail_mirror(ms->mirror + m,
>  					    DM_RAID1_SYNC_ERROR);
> -			bit++;
> +			mask <<= 1;
>  		}
>  	}

Could we have this patch or something similar in 2.6.25, please?
It's broken doing a test_bit() on an int since the result is random
whenever sizeof(int) != sizeof(long).
It might also lead to exceptions if an architecture requires a
sizeof(long) alignment for test_bit().

           reply	other threads:[~2008-03-17 15:46 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <200802230732.m1N7Wdmr018088@imap1.linux-foundation.org>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080317154557.GD6500@osiris.boeblingen.de.ibm.com \
    --to=heiko.carstens@de.ibm.com \
    --cc=agk@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=jbrassow@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mm-commits@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox