diff options
author | Josef Bacik <josef@redhat.com> | 2010-09-16 22:17:03 +0200 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2010-10-29 15:26:35 +0200 |
commit | dde5abee12327d59f968bbfc8151e1b04082a2c4 (patch) | |
tree | eba52b161a83f77c902ecb365ad661d317499717 /fs | |
parent | Btrfs: load free space cache if it exists (diff) | |
download | linux-dde5abee12327d59f968bbfc8151e1b04082a2c4.tar.xz linux-dde5abee12327d59f968bbfc8151e1b04082a2c4.zip |
Btrfs: check cache->caching_ctl before returning if caching has started
With the free space disk caching we can mark the block group as started with the
caching, but we don't have a caching ctl. This can race with anybody else who
tries to get the caching ctl before we cache (this is very hard to do btw). So
instead check to see if cache->caching_ctl is set, and if not return NULL.
Thanks,
Signed-off-by: Josef Bacik <josef@redhat.com>
Diffstat (limited to '')
-rw-r--r-- | fs/btrfs/extent-tree.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 9a325e465ad9..5c9ef3ac25e1 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -242,6 +242,12 @@ get_caching_control(struct btrfs_block_group_cache *cache) return NULL; } + /* We're loading it the fast way, so we don't have a caching_ctl. */ + if (!cache->caching_ctl) { + spin_unlock(&cache->lock); + return NULL; + } + ctl = cache->caching_ctl; atomic_inc(&ctl->count); spin_unlock(&cache->lock); |