diff options
author | Miao Xie <miaox@cn.fujitsu.com> | 2014-09-03 17:35:38 +0400 |
---|---|---|
committer | Chris Mason <clm@fb.com> | 2014-09-18 00:38:38 +0400 |
commit | 7cc8e58d53cd2295c3c1cee7b503bd1790ea4486 (patch) | |
tree | 1befd9a2bea8e1808f0fe1b12406c05b3f7dbe2d /fs/btrfs/ioctl.c | |
parent | 1c1161870c8bcb0d966ebbf1aec05a87a79a4175 (diff) | |
download | linux-7cc8e58d53cd2295c3c1cee7b503bd1790ea4486.tar.xz |
Btrfs: fix unprotected device's variants on 32bits machine
->total_bytes,->disk_total_bytes,->bytes_used is protected by chunk
lock when we change them, but sometimes we read them without any lock,
and we might get unexpected value. We fix this problem like inode's
i_size.
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'fs/btrfs/ioctl.c')
-rw-r--r-- | fs/btrfs/ioctl.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index f60d1ca389f0..0ff212757b95 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -1553,7 +1553,7 @@ static noinline int btrfs_ioctl_resize(struct file *file, goto out_free; } - old_size = device->total_bytes; + old_size = btrfs_device_get_total_bytes(device); if (mod < 0) { if (new_size > old_size) { @@ -2740,8 +2740,8 @@ static long btrfs_ioctl_dev_info(struct btrfs_root *root, void __user *arg) } di_args->devid = dev->devid; - di_args->bytes_used = dev->bytes_used; - di_args->total_bytes = dev->total_bytes; + di_args->bytes_used = btrfs_device_get_bytes_used(dev); + di_args->total_bytes = btrfs_device_get_total_bytes(dev); memcpy(di_args->uuid, dev->uuid, sizeof(di_args->uuid)); if (dev->name) { struct rcu_string *name; |