Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'for-5.1-rc4-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux

Pull btrfs fixes from David Sterba:

- fix parsing of compression algorithm when set as a inode property,
this could end up with eg. 'zst' or 'zli' in the value

- don't allow trim on a filesystem with unreplayed log, this could
cause data loss if there are pending updates to the block groups that
would not be subject to trim after replay

* tag 'for-5.1-rc4-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux:
btrfs: prop: fix vanished compression property after failed set
btrfs: prop: fix zstd compression parameter validation
Btrfs: do not allow trimming when a fs is mounted with the nologreplay option

+14 -4
+10
fs/btrfs/ioctl.c
··· 501 501 if (!capable(CAP_SYS_ADMIN)) 502 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 514 rcu_read_lock(); 505 515 list_for_each_entry_rcu(device, &fs_info->fs_devices->devices, 506 516 dev_list) {
+4 -4
fs/btrfs/props.c
··· 366 366 367 367 static 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 370 return 0; 371 - else if (!strncmp("zlib", value, len)) 371 + else if (!strncmp("zlib", value, 4)) 372 372 return 0; 373 - else if (!strncmp("zstd", value, len)) 373 + else if (!strncmp("zstd", value, 4)) 374 374 return 0; 375 375 376 376 return -EINVAL; ··· 396 396 btrfs_set_fs_incompat(fs_info, COMPRESS_LZO); 397 397 } else if (!strncmp("zlib", value, 4)) { 398 398 type = BTRFS_COMPRESS_ZLIB; 399 - } else if (!strncmp("zstd", value, len)) { 399 + } else if (!strncmp("zstd", value, 4)) { 400 400 type = BTRFS_COMPRESS_ZSTD; 401 401 btrfs_set_fs_incompat(fs_info, COMPRESS_ZSTD); 402 402 } else {