gfs2-utils: master - GFS2: libgfs2 bitfit algorithm using wrong shift point

Bob Peterson rpeterso at fedoraproject.org
Wed Jul 28 01:27:22 UTC 2010


Gitweb:        http://git.fedorahosted.org/git/gfs2-utils.git?p=gfs2-utils.git;a=commitdiff;h=89d49877de559e99505098a742b846e27184f04c
Commit:        89d49877de559e99505098a742b846e27184f04c
Parent:        3fce665dffac8537f520e33674020988ae011fcf
Author:        Bob Peterson <rpeterso at redhat.com>
AuthorDate:    Tue Jul 27 20:18:18 2010 -0500
Committer:     Bob Peterson <rpeterso at redhat.com>
CommitterDate: Tue Jul 27 20:28:14 2010 -0500

GFS2: libgfs2 bitfit algorithm using wrong shift point

This patch fixes a problem specific to 32-bit architectures.
The shift point calculation for determining where to start looking
for a desired value in the bitmap was wrong because it was
using sizeof(unsigned long) rather than sizeof(unsigned long long).
That caused the bitfit function to start in the wrong place, which
in some circumstances caused the same block to be returned repeatedly
which resulted in infinite loops in fsck.gfs2.

rhbz#608154
---
 gfs2/libgfs2/fs_bits.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/gfs2/libgfs2/fs_bits.c b/gfs2/libgfs2/fs_bits.c
index d98919a..6f096f3 100644
--- a/gfs2/libgfs2/fs_bits.c
+++ b/gfs2/libgfs2/fs_bits.c
@@ -66,7 +66,7 @@ static inline uint64_t gfs2_bit_search(const unsigned long long *ptr,
 unsigned long gfs2_bitfit(const unsigned char *buf, const unsigned int len,
 			  unsigned long goal, unsigned char state)
 {
-	unsigned long spoint = (goal << 1) & ((8 * sizeof(unsigned long)) - 1);
+	unsigned long spoint = (goal << 1) & ((8 * sizeof(unsigned long long)) - 1);
 	const unsigned long long *ptr = ((unsigned long long *)buf) + (goal >> 5);
 	const unsigned long long *end = (unsigned long long *)
 		(buf + ALIGN(len, sizeof(unsigned long long)));


More information about the cluster-commits mailing list