diff options
Diffstat (limited to 'fs/btrfs/ioctl.c')
-rw-r--r-- | fs/btrfs/ioctl.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index e0a061db4353..c4f17e4e2c9c 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
@@ -282,8 +282,9 @@ static noinline int btrfs_ioctl_fitrim(struct file *file, void __user *arg) | |||
282 | if (!capable(CAP_SYS_ADMIN)) | 282 | if (!capable(CAP_SYS_ADMIN)) |
283 | return -EPERM; | 283 | return -EPERM; |
284 | 284 | ||
285 | mutex_lock(&fs_info->fs_devices->device_list_mutex); | 285 | rcu_read_lock(); |
286 | list_for_each_entry(device, &fs_info->fs_devices->devices, dev_list) { | 286 | list_for_each_entry_rcu(device, &fs_info->fs_devices->devices, |
287 | dev_list) { | ||
287 | if (!device->bdev) | 288 | if (!device->bdev) |
288 | continue; | 289 | continue; |
289 | q = bdev_get_queue(device->bdev); | 290 | q = bdev_get_queue(device->bdev); |
@@ -293,7 +294,7 @@ static noinline int btrfs_ioctl_fitrim(struct file *file, void __user *arg) | |||
293 | minlen); | 294 | minlen); |
294 | } | 295 | } |
295 | } | 296 | } |
296 | mutex_unlock(&fs_info->fs_devices->device_list_mutex); | 297 | rcu_read_unlock(); |
297 | if (!num_devices) | 298 | if (!num_devices) |
298 | return -EOPNOTSUPP; | 299 | return -EOPNOTSUPP; |
299 | 300 | ||
@@ -1279,7 +1280,6 @@ static noinline int copy_to_sk(struct btrfs_root *root, | |||
1279 | int nritems; | 1280 | int nritems; |
1280 | int i; | 1281 | int i; |
1281 | int slot; | 1282 | int slot; |
1282 | int found = 0; | ||
1283 | int ret = 0; | 1283 | int ret = 0; |
1284 | 1284 | ||
1285 | leaf = path->nodes[0]; | 1285 | leaf = path->nodes[0]; |
@@ -1326,7 +1326,7 @@ static noinline int copy_to_sk(struct btrfs_root *root, | |||
1326 | item_off, item_len); | 1326 | item_off, item_len); |
1327 | *sk_offset += item_len; | 1327 | *sk_offset += item_len; |
1328 | } | 1328 | } |
1329 | found++; | 1329 | (*num_found)++; |
1330 | 1330 | ||
1331 | if (*num_found >= sk->nr_items) | 1331 | if (*num_found >= sk->nr_items) |
1332 | break; | 1332 | break; |
@@ -1345,7 +1345,6 @@ advance_key: | |||
1345 | } else | 1345 | } else |
1346 | ret = 1; | 1346 | ret = 1; |
1347 | overflow: | 1347 | overflow: |
1348 | *num_found += found; | ||
1349 | return ret; | 1348 | return ret; |
1350 | } | 1349 | } |
1351 | 1350 | ||