]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
Btrfs: Various small fixes.
authorYan Zheng <zheng.yan@oracle.com>
Tue, 5 Aug 2008 03:23:47 +0000 (23:23 -0400)
committerChris Mason <chris.mason@oracle.com>
Thu, 25 Sep 2008 15:04:06 +0000 (11:04 -0400)
This trivial patch contains two locking fixes and a off by one fix.

---

Signed-off-by: Chris Mason <chris.mason@oracle.com>
fs/btrfs/ordered-data.c
fs/btrfs/root-tree.c
fs/btrfs/super.c
fs/btrfs/transaction.c
fs/btrfs/transaction.h

index 676e4bd65c529cb3332da5a62679a44ed5439bcd..db200e6baf7ee6efc130ddcb02872160487b9cc7 100644 (file)
@@ -548,7 +548,7 @@ int btrfs_ordered_update_i_size(struct inode *inode,
                 */
                test = rb_entry(node, struct btrfs_ordered_extent, rb_node);
                if (test->file_offset > entry_end(ordered)) {
-                       i_size_test = test->file_offset - 1;
+                       i_size_test = test->file_offset;
                }
        } else {
                i_size_test = i_size_read(inode);
@@ -561,7 +561,7 @@ int btrfs_ordered_update_i_size(struct inode *inode,
         * disk_i_size to the end of the region.
         */
        if (i_size_test > entry_end(ordered) &&
-           !test_range_bit(io_tree, entry_end(ordered), i_size_test,
+           !test_range_bit(io_tree, entry_end(ordered), i_size_test - 1,
                           EXTENT_DELALLOC, 0)) {
                new_i_size = min_t(u64, i_size_test, i_size_read(inode));
        }
index a5c0e98b5aeb94bef57c0d8a1a3500d5183a4465..36726696e58bbf12d02cf87e450dbbcfc3f3bce3 100644 (file)
@@ -209,8 +209,7 @@ again:
                        goto err;
                }
 
-               ret = btrfs_add_dead_root(dead_root, latest,
-                                         &root->fs_info->dead_roots);
+               ret = btrfs_add_dead_root(dead_root, latest);
                if (ret)
                        goto err;
                goto again;
index a6a418b6894b10ac248c821537704fb9b9092149..eb4b357d05e1cff0178990c8d43e2609d9cfa64a 100644 (file)
@@ -449,7 +449,9 @@ static int btrfs_get_sb(struct file_system_type *fs_type, int flags,
                s->s_flags |= MS_ACTIVE;
        }
 
+       mutex_lock(&s->s_root->d_inode->i_mutex);
        root = lookup_one_len(subvol_name, s->s_root, strlen(subvol_name));
+       mutex_unlock(&s->s_root->d_inode->i_mutex);
        if (IS_ERR(root)) {
                up_write(&s->s_umount);
                deactivate_super(s);
index a2c821e3c3a791fb3d8b707982aba271af435776..ebf5362da1d209dca7ed505a8c5de659ab3f312f 100644 (file)
@@ -389,9 +389,7 @@ int btrfs_commit_tree_roots(struct btrfs_trans_handle *trans,
        return 0;
 }
 
-int btrfs_add_dead_root(struct btrfs_root *root,
-                       struct btrfs_root *latest,
-                       struct list_head *dead_list)
+int btrfs_add_dead_root(struct btrfs_root *root, struct btrfs_root *latest)
 {
        struct btrfs_dirty_root *dirty;
 
@@ -400,7 +398,10 @@ int btrfs_add_dead_root(struct btrfs_root *root,
                return -ENOMEM;
        dirty->root = root;
        dirty->latest_root = latest;
-       list_add(&dirty->list, dead_list);
+
+       mutex_lock(&root->fs_info->trans_mutex);
+       list_add(&dirty->list, &latest->fs_info->dead_roots);
+       mutex_unlock(&root->fs_info->trans_mutex);
        return 0;
 }
 
index 2c73caeebb2c400ce8cabb2785b1d1a9dac0c965..598baa312417a9943eff627e5a376d846a9c9ad7 100644 (file)
@@ -90,8 +90,7 @@ int btrfs_write_and_wait_transaction(struct btrfs_trans_handle *trans,
 int btrfs_commit_tree_roots(struct btrfs_trans_handle *trans,
                            struct btrfs_root *root);
 
-int btrfs_add_dead_root(struct btrfs_root *root, struct btrfs_root *latest,
-                       struct list_head *dead_list);
+int btrfs_add_dead_root(struct btrfs_root *root, struct btrfs_root *latest);
 int btrfs_defrag_root(struct btrfs_root *root, int cacheonly);
 int btrfs_clean_old_snapshots(struct btrfs_root *root);
 int btrfs_commit_transaction(struct btrfs_trans_handle *trans,