Commit e6f24808 authored by Long Li's avatar Long Li
Browse files

xfs: forcealign not compatible with reflink and realtime device

hulk inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I9VTE3


CVE: NA

--------------------------------

Reflink will not be supported for forcealign yet, so disallow a mount
under this condition. This is because we have the limitation of pageache
writeback not knowing how to writeback an entire allocation unut, after
covert extent form cowfork to datafork, force alignment constraints may
be break, so reject a mount with relink.

RT vol will not be supported for forcealign yet, so disallow a mount under
this condition. It will be possible to support RT vol and forcealign in
future. For this, the inode extsize must be a multiple of rtextsize - this
is enforced already in xfs_ioctl_setattr_check_extsize() and
xfs_inode_validate_extsize().

Fixes: fabcdd2d ("fs: xfs: Introduce FORCEALIGN inode flag")
Signed-off-by: default avatarLong Li <leo.lilong@huawei.com>
parent ced10f24
Loading
Loading
Loading
Loading
+18 −1
Original line number Diff line number Diff line
@@ -1658,10 +1658,19 @@ xfs_fc_fill_super(
		}
	}

	if (xfs_has_forcealign(mp))
	if (xfs_has_forcealign(mp)) {
		xfs_warn(mp,
"EXPERIMENTAL forced data extent alignment feature in use. Use at your own risk!");

		if (xfs_has_realtime(mp)) {
			xfs_alert(mp,
	"forcealign not supported for realtime device!");
			error = -EINVAL;
			goto out_filestream_unmount;
		}

	}

	if (xfs_has_atomicwrites(mp))
		xfs_warn(mp,
"EXPERIMENTAL atomicwrites feature in use. Use at your own risk!");
@@ -1674,6 +1683,14 @@ xfs_fc_fill_super(
			goto out_filestream_unmount;
		}

		if (xfs_has_forcealign(mp)) {
			xfs_alert(mp,
	"reflink not compatible with forcealign!");
			error = -EINVAL;
			goto out_filestream_unmount;
		}


		if (xfs_globals.always_cow) {
			xfs_info(mp, "using DEBUG-only always_cow mode.");
			mp->m_always_cow = true;