mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 11:41:38 -04:00
xfs: prohibit fstrim in norecovery mode
The xfs fstrim implementation uses the free space btrees to find free space that can be discarded. If we haven't recovered the log, the bnobt will be stale and we absolutely *cannot* use stale metadata to zap the underlying storage. Signed-off-by: Darrick J. Wong <[email protected]> Reviewed-by: Eric Sandeen <[email protected]>
This commit is contained in:
parent
4b0bce30f3
commit
ed79dac98c
1 changed files with 8 additions and 0 deletions
|
|
@ -161,6 +161,14 @@ xfs_ioc_trim(
|
|||
return -EPERM;
|
||||
if (!blk_queue_discard(q))
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
/*
|
||||
* We haven't recovered the log, so we cannot use our bnobt-guided
|
||||
* storage zapping commands.
|
||||
*/
|
||||
if (mp->m_flags & XFS_MOUNT_NORECOVERY)
|
||||
return -EROFS;
|
||||
|
||||
if (copy_from_user(&range, urange, sizeof(range)))
|
||||
return -EFAULT;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue