summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/disk-io.c
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.cz>2011-06-09 12:02:51 +0200
committerChris Mason <chris.mason@oracle.com>2011-06-11 00:57:11 +0200
commit5be76758f35ec6578e5b9b150aa513ac26bd9c54 (patch)
tree071251fb002ec06e3db5848e9385386aa04f9197 /fs/btrfs/disk-io.c
parentBtrfs: avoid stack bloat in btrfs_ioctl_fs_info() (diff)
downloadlinux-5be76758f35ec6578e5b9b150aa513ac26bd9c54.tar.xz
linux-5be76758f35ec6578e5b9b150aa513ac26bd9c54.zip
btrfs: fix unlocked access of delalloc_inodes
list_splice_init will make delalloc_inodes empty, but without a spinlock around, this may produce corrupted list head, accessed in many placess, The race window is very tight and nobody seems to have hit it so far. Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r--fs/btrfs/disk-io.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index a203d363184d..33b744a5ac03 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -2911,9 +2911,8 @@ static int btrfs_destroy_delalloc_inodes(struct btrfs_root *root)
INIT_LIST_HEAD(&splice);
- list_splice_init(&root->fs_info->delalloc_inodes, &splice);
-
spin_lock(&root->fs_info->delalloc_lock);
+ list_splice_init(&root->fs_info->delalloc_inodes, &splice);
while (!list_empty(&splice)) {
btrfs_inode = list_entry(splice.next, struct btrfs_inode,