Skip to content

Commit 8dc5e9b

Browse files
johnpgarrycmaiolino
authored andcommitted
xfs: reject max_atomic_write mount option for no reflink
If the FS has no reflink, then atomic writes greater than 1x block are not supported. As such, for no reflink it is pointless to accept setting max_atomic_write when it cannot be supported, so reject max_atomic_write mount option in this case. It could be still possible to accept max_atomic_write option of size 1x block if HW atomics are supported, so check for this specifically. Fixes: 4528b90 ("xfs: allow sysadmins to specify a maximum atomic write limit at mount time") Signed-off-by: John Garry <[email protected]> Reviewed-by: Darrick J. Wong <[email protected]> Signed-off-by: Carlos Maiolino <[email protected]>
1 parent 68456d0 commit 8dc5e9b

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

fs/xfs/xfs_mount.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -779,6 +779,25 @@ xfs_set_max_atomic_write_opt(
779779
return -EINVAL;
780780
}
781781

782+
if (xfs_has_reflink(mp))
783+
goto set_limit;
784+
785+
if (new_max_fsbs == 1) {
786+
if (mp->m_ddev_targp->bt_awu_max ||
787+
(mp->m_rtdev_targp && mp->m_rtdev_targp->bt_awu_max)) {
788+
} else {
789+
xfs_warn(mp,
790+
"cannot support atomic writes of size %lluk with no reflink or HW support",
791+
new_max_bytes >> 10);
792+
return -EINVAL;
793+
}
794+
} else {
795+
xfs_warn(mp,
796+
"cannot support atomic writes of size %lluk with no reflink support",
797+
new_max_bytes >> 10);
798+
return -EINVAL;
799+
}
800+
782801
set_limit:
783802
error = xfs_calc_atomic_write_reservation(mp, new_max_fsbs);
784803
if (error) {

0 commit comments

Comments
 (0)