summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/ioctl.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman2019-04-21 23:18:44 +0200
committerGreg Kroah-Hartman2019-04-21 23:18:44 +0200
commit817de6b85914a3dda72b971c074d4d342965fba0 (patch)
treedf0a4563a04aadb8f8595f72392d66d65797c455 /fs/btrfs/ioctl.c
parentstaging: kpc2000: add initial set of Daktronics drivers (diff)
parentLinux 5.1-rc6 (diff)
downloadkernel-qcow2-linux-817de6b85914a3dda72b971c074d4d342965fba0.tar.gz
kernel-qcow2-linux-817de6b85914a3dda72b971c074d4d342965fba0.tar.xz
kernel-qcow2-linux-817de6b85914a3dda72b971c074d4d342965fba0.zip
Merge 5.1-rc6 into staging-next
We want the fixes in here as well as this resolves an iio driver merge issue. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/btrfs/ioctl.c')
-rw-r--r--fs/btrfs/ioctl.c10
1 files changed, 10 insertions, 0 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)
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
+ /*
+ * If the fs is mounted with nologreplay, which requires it to be
+ * mounted in RO mode as well, we can not allow discard on free space
+ * inside block groups, because log trees refer to extents that are not
+ * pinned in a block group's free space cache (pinning the extents is
+ * precisely the first phase of replaying a log tree).
+ */
+ if (btrfs_test_opt(fs_info, NOLOGREPLAY))
+ return -EROFS;
+
rcu_read_lock();
list_for_each_entry_rcu(device, &fs_info->fs_devices->devices,
dev_list) {