Commit 9c1db779 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs

Pull btrfs fixes from Chris Mason:
 "This is a small collection of fixes"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs:
  Btrfs: fix data corruption when reading/updating compressed extents
  Btrfs: don't loop forever if we can't run because of the tree mod log
  btrfs: reserve no transaction units in btrfs_ioctl_set_features
  btrfs: commit transaction after setting label and features
  Btrfs: fix assert screwup for the pending move stuff
parents 6f2a1c1e a2aa75e1
...@@ -1010,6 +1010,8 @@ int btrfs_decompress_buf2page(char *buf, unsigned long buf_start, ...@@ -1010,6 +1010,8 @@ int btrfs_decompress_buf2page(char *buf, unsigned long buf_start,
bytes = min(bytes, working_bytes); bytes = min(bytes, working_bytes);
kaddr = kmap_atomic(page_out); kaddr = kmap_atomic(page_out);
memcpy(kaddr + *pg_offset, buf + buf_offset, bytes); memcpy(kaddr + *pg_offset, buf + buf_offset, bytes);
if (*pg_index == (vcnt - 1) && *pg_offset == 0)
memset(kaddr + bytes, 0, PAGE_CACHE_SIZE - bytes);
kunmap_atomic(kaddr); kunmap_atomic(kaddr);
flush_dcache_page(page_out); flush_dcache_page(page_out);
......
...@@ -2385,6 +2385,7 @@ static noinline int __btrfs_run_delayed_refs(struct btrfs_trans_handle *trans, ...@@ -2385,6 +2385,7 @@ static noinline int __btrfs_run_delayed_refs(struct btrfs_trans_handle *trans,
spin_unlock(&delayed_refs->lock); spin_unlock(&delayed_refs->lock);
locked_ref = NULL; locked_ref = NULL;
cond_resched(); cond_resched();
count++;
continue; continue;
} }
......
...@@ -4525,7 +4525,7 @@ static int btrfs_ioctl_set_fslabel(struct file *file, void __user *arg) ...@@ -4525,7 +4525,7 @@ static int btrfs_ioctl_set_fslabel(struct file *file, void __user *arg)
spin_lock(&root->fs_info->super_lock); spin_lock(&root->fs_info->super_lock);
strcpy(super_block->label, label); strcpy(super_block->label, label);
spin_unlock(&root->fs_info->super_lock); spin_unlock(&root->fs_info->super_lock);
ret = btrfs_end_transaction(trans, root); ret = btrfs_commit_transaction(trans, root);
out_unlock: out_unlock:
mnt_drop_write_file(file); mnt_drop_write_file(file);
...@@ -4668,7 +4668,7 @@ static int btrfs_ioctl_set_features(struct file *file, void __user *arg) ...@@ -4668,7 +4668,7 @@ static int btrfs_ioctl_set_features(struct file *file, void __user *arg)
if (ret) if (ret)
return ret; return ret;
trans = btrfs_start_transaction(root, 1); trans = btrfs_start_transaction(root, 0);
if (IS_ERR(trans)) if (IS_ERR(trans))
return PTR_ERR(trans); return PTR_ERR(trans);
...@@ -4689,7 +4689,7 @@ static int btrfs_ioctl_set_features(struct file *file, void __user *arg) ...@@ -4689,7 +4689,7 @@ static int btrfs_ioctl_set_features(struct file *file, void __user *arg)
btrfs_set_super_incompat_flags(super_block, newflags); btrfs_set_super_incompat_flags(super_block, newflags);
spin_unlock(&root->fs_info->super_lock); spin_unlock(&root->fs_info->super_lock);
return btrfs_end_transaction(trans, root); return btrfs_commit_transaction(trans, root);
} }
long btrfs_ioctl(struct file *file, unsigned int long btrfs_ioctl(struct file *file, unsigned int
......
...@@ -2774,8 +2774,6 @@ static int add_waiting_dir_move(struct send_ctx *sctx, u64 ino) ...@@ -2774,8 +2774,6 @@ static int add_waiting_dir_move(struct send_ctx *sctx, u64 ino)
return 0; return 0;
} }
#ifdef CONFIG_BTRFS_ASSERT
static int del_waiting_dir_move(struct send_ctx *sctx, u64 ino) static int del_waiting_dir_move(struct send_ctx *sctx, u64 ino)
{ {
struct rb_node *n = sctx->waiting_dir_moves.rb_node; struct rb_node *n = sctx->waiting_dir_moves.rb_node;
...@@ -2796,8 +2794,6 @@ static int del_waiting_dir_move(struct send_ctx *sctx, u64 ino) ...@@ -2796,8 +2794,6 @@ static int del_waiting_dir_move(struct send_ctx *sctx, u64 ino)
return -ENOENT; return -ENOENT;
} }
#endif
static int add_pending_dir_move(struct send_ctx *sctx, u64 parent_ino) static int add_pending_dir_move(struct send_ctx *sctx, u64 parent_ino)
{ {
struct rb_node **p = &sctx->pending_dir_moves.rb_node; struct rb_node **p = &sctx->pending_dir_moves.rb_node;
...@@ -2902,7 +2898,9 @@ static int apply_dir_move(struct send_ctx *sctx, struct pending_dir_move *pm) ...@@ -2902,7 +2898,9 @@ static int apply_dir_move(struct send_ctx *sctx, struct pending_dir_move *pm)
} }
sctx->send_progress = sctx->cur_ino + 1; sctx->send_progress = sctx->cur_ino + 1;
ASSERT(del_waiting_dir_move(sctx, pm->ino) == 0); ret = del_waiting_dir_move(sctx, pm->ino);
ASSERT(ret == 0);
ret = get_cur_path(sctx, pm->ino, pm->gen, to_path); ret = get_cur_path(sctx, pm->ino, pm->gen, to_path);
if (ret < 0) if (ret < 0)
goto out; goto out;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment