Btrfs: fix casting error in scrub reada code
authorChris Mason <chris.mason@oracle.com>
Tue, 28 Feb 2012 17:42:44 +0000 (12:42 -0500)
committerChris Mason <chris.mason@oracle.com>
Sat, 3 Mar 2012 12:42:35 +0000 (07:42 -0500)
The reada code from scrub was casting down a u64 to
an unsigned long so it could insert it into a radix tree.

What it really wanted to do was cast down the result of a shift, instead
of casting down the u64.  The bug resulted in trying to insert our
reada struct into the wrong place, which caused soft lockups and other
problems.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
fs/btrfs/reada.c

index 2373b39a132b5eacaf0341fcfb351e99c912c1a7..22db04550f6a03ff92580e801b860cc4ed757ebc 100644 (file)
@@ -305,7 +305,7 @@ again:
 
        spin_lock(&fs_info->reada_lock);
        ret = radix_tree_insert(&dev->reada_zones,
-                               (unsigned long)zone->end >> PAGE_CACHE_SHIFT,
+                               (unsigned long)(zone->end >> PAGE_CACHE_SHIFT),
                                zone);
        spin_unlock(&fs_info->reada_lock);