Merge tag 'ext4_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git...
[sfrench/cifs-2.6.git] / fs / ext4 / ioctl.c
index 3c4f8bb59f8abfd23ceaf36f93c7fceffac0134e..bab3da4f1e0d36692fa172b6724379baa47bb2d6 100644 (file)
@@ -1000,6 +1000,13 @@ resizefs_out:
                if (!blk_queue_discard(q))
                        return -EOPNOTSUPP;
 
+               /*
+                * We haven't replayed the journal, so we cannot use our
+                * block-bitmap-guided storage zapping commands.
+                */
+               if (test_opt(sb, NOLOAD) && ext4_has_feature_journal(sb))
+                       return -EROFS;
+
                if (copy_from_user(&range, (struct fstrim_range __user *)arg,
                    sizeof(range)))
                        return -EFAULT;