diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c index 534ffb856c4a..3d7c53db1977 100644 --- a/fs/xfs/libxfs/xfs_bmap.c +++ b/fs/xfs/libxfs/xfs_bmap.c @@ -5109,7 +5109,8 @@ xfs_bmap_del_extent_real( if (error) goto done; } else { - if (bflags & XFS_BMAPI_NODISCARD) { + if ((bflags & XFS_BMAPI_NODISCARD) || + (del->br_state == XFS_EXT_UNWRITTEN)) { xfs_bmap_add_free_nodiscard(mp, dfops, del->br_startblock, del->br_blockcount, NULL);