Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 166681
b: refs/heads/master
c: 1ab86ae
h: refs/heads/master
i:
  166679: 90debc2
v: v3
  • Loading branch information
Sage Weil authored and Chris Mason committed Sep 29, 2009
1 parent 55d143a commit 69279f7
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 20 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3baf0bed0a5adab95c7599d2f27124c74692ef28
refs/heads/master: 1ab86aedbc7845a946b4ba4edf37762629970708
41 changes: 22 additions & 19 deletions trunk/fs/btrfs/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1232,15 +1232,15 @@ static long btrfs_ioctl_trans_start(struct file *file)
struct inode *inode = fdentry(file)->d_inode;
struct btrfs_root *root = BTRFS_I(inode)->root;
struct btrfs_trans_handle *trans;
int ret = 0;
int ret;

ret = -EPERM;
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
goto out;

if (file->private_data) {
ret = -EINPROGRESS;
ret = -EINPROGRESS;
if (file->private_data)
goto out;
}

ret = mnt_want_write(file->f_path.mnt);
if (ret)
Expand All @@ -1250,12 +1250,19 @@ static long btrfs_ioctl_trans_start(struct file *file)
root->fs_info->open_ioctl_trans++;
mutex_unlock(&root->fs_info->trans_mutex);

ret = -ENOMEM;
trans = btrfs_start_ioctl_transaction(root, 0);
if (trans)
file->private_data = trans;
else
ret = -ENOMEM;
/*printk(KERN_INFO "btrfs_ioctl_trans_start on %p\n", file);*/
if (!trans)
goto out_drop;

file->private_data = trans;
return 0;

out_drop:
mutex_lock(&root->fs_info->trans_mutex);
root->fs_info->open_ioctl_trans--;
mutex_unlock(&root->fs_info->trans_mutex);
mnt_drop_write(file->f_path.mnt);
out:
return ret;
}
Expand All @@ -1271,24 +1278,20 @@ long btrfs_ioctl_trans_end(struct file *file)
struct inode *inode = fdentry(file)->d_inode;
struct btrfs_root *root = BTRFS_I(inode)->root;
struct btrfs_trans_handle *trans;
int ret = 0;

trans = file->private_data;
if (!trans) {
ret = -EINVAL;
goto out;
}
btrfs_end_transaction(trans, root);
if (!trans)
return -EINVAL;
file->private_data = NULL;

btrfs_end_transaction(trans, root);

mutex_lock(&root->fs_info->trans_mutex);
root->fs_info->open_ioctl_trans--;
mutex_unlock(&root->fs_info->trans_mutex);

mnt_drop_write(file->f_path.mnt);

out:
return ret;
return 0;
}

long btrfs_ioctl(struct file *file, unsigned int
Expand Down

0 comments on commit 69279f7

Please sign in to comment.