[PATCH] xfs: fix in the setting of logbsize

From: Ales Novak
Date: Fri Jun 05 2015 - 09:28:59 EST


Logbsize should be integer multiple of log stripe unit size. If it's
not, various operations will lead to crashes, due to invalid buffer
sizes, i.e. we've seen crashes in the callpath xlog_sync->xlog_pack_data.

However, this rule is only mentioned in the documentation, while it
could be checked during the mount.

Signed-off-by: Ales Novak <alnovak@xxxxxxx>
---
fs/xfs/xfs_super.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index 8fcc4cc..1a3766d 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -1352,6 +1352,11 @@ xfs_finish_flags(
xfs_warn(mp,
"logbuf size must be greater than or equal to log stripe size");
return -EINVAL;
+ } else if (mp->m_logbsize > 0 && mp->m_sb.sb_logsunit > 0 &&
+ mp->m_logbsize % mp->m_sb.sb_logsunit) {
+ xfs_warn(mp,
+ "logbuf size must be integer multiple of log stripe size");
+ return -EINVAL;
}
} else {
/* Fail a mount if the logbuf is larger than 32K */
--
1.8.4.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/