generic: prohibit fstrim on journalled filesystems with norecovery
authorDarrick J. Wong <darrick.wong@oracle.com>
Sat, 23 Mar 2019 00:35:32 +0000 (17:35 -0700)
committerEryu Guan <guaneryu@gmail.com>
Sun, 31 Mar 2019 15:33:44 +0000 (23:33 +0800)
commit8a011c00b524f9ef1281cfdbc79fac41585be0fa
tree3db57eda0c882f8ac1af06f72a7a0d00e137095c
parent63b0ee12326649e89c9c0241369dc81028b10489
generic: prohibit fstrim on journalled filesystems with norecovery

This test makes sure that we can't use stale unrecovered fs metadata to
drive a DISCARD festival on a disk and thereby destroy user data by
accident.

The following patches fixed the bug on ext4, xfs and btrfs
ext4: prohibit fstrim in norecovery mode
xfs: prohibit fstrim in norecovery mode
Btrfs: do not allow trimming when a fs is mounted with the nologreplay option

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
tests/generic/537 [new file with mode: 0755]
tests/generic/537.out [new file with mode: 0644]
tests/generic/group