summaryrefslogtreecommitdiffstats
path: root/fs/btrfs
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2019-04-17 14:26:25 -0400
committerDavid S. Miller <davem@davemloft.net>2019-04-17 14:26:25 -0400
commit6b0a7f84ea1fe248df96ccc4dd86e817e32ef65b (patch)
tree0a7976054052e793da782c2b7ec34eccfbf66449 /fs/btrfs
parentcea0aa9cbd5ad4efe267e9487ed5d48d16756253 (diff)
parentfe5cdef29e41c8bda8cd1a11545e7c6bfe25570e (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Conflict resolution of af_smc.c from Stephen Rothwell. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'fs/btrfs')
-rw-r--r--fs/btrfs/ioctl.c10
-rw-r--r--fs/btrfs/props.c8
2 files changed, 14 insertions, 4 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index ec2d8919e7fb..cd4e693406a0 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -501,6 +501,16 @@ static noinline int btrfs_ioctl_fitrim(struct file *file, void __user *arg)
501 if (!capable(CAP_SYS_ADMIN)) 501 if (!capable(CAP_SYS_ADMIN))
502 return -EPERM; 502 return -EPERM;
503 503
504 /*
505 * If the fs is mounted with nologreplay, which requires it to be
506 * mounted in RO mode as well, we can not allow discard on free space
507 * inside block groups, because log trees refer to extents that are not
508 * pinned in a block group's free space cache (pinning the extents is
509 * precisely the first phase of replaying a log tree).
510 */
511 if (btrfs_test_opt(fs_info, NOLOGREPLAY))
512 return -EROFS;
513
504 rcu_read_lock(); 514 rcu_read_lock();
505 list_for_each_entry_rcu(device, &fs_info->fs_devices->devices, 515 list_for_each_entry_rcu(device, &fs_info->fs_devices->devices,
506 dev_list) { 516 dev_list) {
diff --git a/fs/btrfs/props.c b/fs/btrfs/props.c
index dc6140013ae8..61d22a56c0ba 100644
--- a/fs/btrfs/props.c
+++ b/fs/btrfs/props.c
@@ -366,11 +366,11 @@ int btrfs_subvol_inherit_props(struct btrfs_trans_handle *trans,
366 366
367static int prop_compression_validate(const char *value, size_t len) 367static int prop_compression_validate(const char *value, size_t len)
368{ 368{
369 if (!strncmp("lzo", value, len)) 369 if (!strncmp("lzo", value, 3))
370 return 0; 370 return 0;
371 else if (!strncmp("zlib", value, len)) 371 else if (!strncmp("zlib", value, 4))
372 return 0; 372 return 0;
373 else if (!strncmp("zstd", value, len)) 373 else if (!strncmp("zstd", value, 4))
374 return 0; 374 return 0;
375 375
376 return -EINVAL; 376 return -EINVAL;
@@ -396,7 +396,7 @@ static int prop_compression_apply(struct inode *inode,
396 btrfs_set_fs_incompat(fs_info, COMPRESS_LZO); 396 btrfs_set_fs_incompat(fs_info, COMPRESS_LZO);
397 } else if (!strncmp("zlib", value, 4)) { 397 } else if (!strncmp("zlib", value, 4)) {
398 type = BTRFS_COMPRESS_ZLIB; 398 type = BTRFS_COMPRESS_ZLIB;
399 } else if (!strncmp("zstd", value, len)) { 399 } else if (!strncmp("zstd", value, 4)) {
400 type = BTRFS_COMPRESS_ZSTD; 400 type = BTRFS_COMPRESS_ZSTD;
401 btrfs_set_fs_incompat(fs_info, COMPRESS_ZSTD); 401 btrfs_set_fs_incompat(fs_info, COMPRESS_ZSTD);
402 } else { 402 } else {