xfs
[Top] [All Lists]

[PATCH] xfs: fix in the setting of logbsize

To: Dave Chinner <david@xxxxxxxxxxxxx>
Subject: [PATCH] xfs: fix in the setting of logbsize
From: Ales Novak <alnovak@xxxxxxx>
Date: Fri, 5 Jun 2015 15:28:45 +0200
Cc: xfs@xxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, Ales Novak <alnovak@xxxxxxx>
Delivered-to: xfs@xxxxxxxxxxx
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

<Prev in Thread] Current Thread [Next in Thread>