1 Index: linux-2.6.27.21-0.1/fs/ext4/extents.c
2 ===================================================================
3 --- linux-2.6.27.21-0.1.orig/fs/ext4/extents.c 2009-06-19 15:50:57.000000000 +0530
4 +++ linux-2.6.27.21-0.1/fs/ext4/extents.c 2009-06-19 15:56:32.000000000 +0530
5 @@ -1736,11 +1736,13 @@
7 struct ext4_ext_cache *cex;
9 + spin_lock(&EXT4_I(inode)->i_block_reservation_lock);
10 cex = &EXT4_I(inode)->i_cached_extent;
12 cex->ec_block = block;
14 cex->ec_start = start;
15 + spin_unlock(&EXT4_I(inode)->i_block_reservation_lock);
19 @@ -1797,12 +1799,17 @@
20 struct ext4_extent *ex)
22 struct ext4_ext_cache *cex;
23 + int ret = EXT4_EXT_CACHE_NO;
26 + * We borrow i_block_reservation_lock to protect i_cached_extent
28 + spin_lock(&EXT4_I(inode)->i_block_reservation_lock);
29 cex = &EXT4_I(inode)->i_cached_extent;
31 /* has cache valid data? */
32 if (cex->ec_type == EXT4_EXT_CACHE_NO)
33 - return EXT4_EXT_CACHE_NO;
36 BUG_ON(cex->ec_type != EXT4_EXT_CACHE_GAP &&
37 cex->ec_type != EXT4_EXT_CACHE_EXTENT);
38 @@ -1813,11 +1820,12 @@
39 ext_debug("%u cached by %u:%u:%llu\n",
41 cex->ec_block, cex->ec_len, cex->ec_start);
42 - return cex->ec_type;
47 - return EXT4_EXT_CACHE_NO;
49 + spin_unlock(&EXT4_I(inode)->i_block_reservation_lock);