summaryrefslogtreecommitdiff
path: root/fs/btrfs/extent_map.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2007-09-10 20:02:27 -0400
committerDavid Woodhouse <dwmw2@hera.kernel.org>2007-09-10 20:02:27 -0400
commit90f1c19a9fd2a943adc69d2b9b8c83bcc4bba6f9 (patch)
tree4928c818b63181775d7800158882024390b7103a /fs/btrfs/extent_map.c
parent9433063bcb4b3c0c9e5ef3c24a811b63084dedb4 (diff)
Btrfs: [PATCH] extent_map: fix locking for bio completion
The bio completion handlers can be run in any context, e.g. when using the old ide driver they run in hardirq context with irqs disabled so lockdep rightfully warns about using write_lock_irq useage in these handlers. This patch switches clear_extent_bit and set_extent_bit to write_lock_irqsave to fix this problem. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/extent_map.c')
-rw-r--r--fs/btrfs/extent_map.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/fs/btrfs/extent_map.c b/fs/btrfs/extent_map.c
index 370ed97e52f5..3021564ac62c 100644
--- a/fs/btrfs/extent_map.c
+++ b/fs/btrfs/extent_map.c
@@ -456,6 +456,7 @@ int clear_extent_bit(struct extent_map_tree *tree, u64 start, u64 end,
struct extent_state *state;
struct extent_state *prealloc = NULL;
struct rb_node *node;
+ unsigned long flags;
int err;
int set = 0;
@@ -466,7 +467,7 @@ again:
return -ENOMEM;
}
- write_lock_irq(&tree->lock);
+ write_lock_irqsave(&tree->lock, flags);
/*
* this search will find the extents that end after
* our range starts
@@ -533,7 +534,7 @@ again:
goto search_again;
out:
- write_unlock_irq(&tree->lock);
+ write_unlock_irqrestore(&tree->lock, flags);
if (prealloc)
free_extent_state(prealloc);
@@ -542,7 +543,7 @@ out:
search_again:
if (start >= end)
goto out;
- write_unlock_irq(&tree->lock);
+ write_unlock_irqrestore(&tree->lock, flags);
if (mask & __GFP_WAIT)
cond_resched();
goto again;
@@ -628,6 +629,7 @@ int set_extent_bit(struct extent_map_tree *tree, u64 start, u64 end, int bits,
struct extent_state *state;
struct extent_state *prealloc = NULL;
struct rb_node *node;
+ unsigned long flags;
int err = 0;
int set;
u64 last_start;
@@ -639,7 +641,7 @@ again:
return -ENOMEM;
}
- write_lock_irq(&tree->lock);
+ write_lock_irqsave(&tree->lock, flags);
/*
* this search will find all the extents that end after
* our range starts.
@@ -759,7 +761,7 @@ again:
goto search_again;
out:
- write_unlock_irq(&tree->lock);
+ write_unlock_irqrestore(&tree->lock, flags);
if (prealloc)
free_extent_state(prealloc);
@@ -768,7 +770,7 @@ out:
search_again:
if (start > end)
goto out;
- write_unlock_irq(&tree->lock);
+ write_unlock_irqrestore(&tree->lock, flags);
if (mask & __GFP_WAIT)
cond_resched();
goto again;