From: Brian Foster <bfoster@redhat.com>
To: linux-xfs@vger.kernel.org
Subject: [PATCH RFC 4/4] xfs: enforce a maximum total iclog buffer size
Date: Mon, 23 Oct 2017 10:46:46 -0400 [thread overview]
Message-ID: <20171023144646.50107-5-bfoster@redhat.com> (raw)
In-Reply-To: <20171023144646.50107-1-bfoster@redhat.com>
Since mkfs has historically had an issue creating a very small
filesystems with a log smaller than the minimum log size, add an
extra layer of runtime protection around the log buffer count and
size parameters. Restrict the total log buffer size to 1/2 of the
physical log size, otherwise fail the mount.
The default log buffer count and size is 8 and 32k, respectively.
This total size of 256k results in a minimum log size requirement of
512k, which is well outside even the smallest logs created by broken
formats. Therefore, this change should only affect users who
explicitly attempt to use larger log buffer counts/sizes with such
filesystems.
Signed-off-by: Brian Foster <bfoster@redhat.com>
---
fs/xfs/xfs_log.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index e282fd8..5966cab 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -1453,6 +1453,14 @@ xlog_alloc_log(
xlog_get_iclog_buffer_size(mp, log);
+ error = -EINVAL;
+ if (log->l_iclog_bufs * log->l_iclog_size > (log->l_logsize >> 1)) {
+ xfs_warn(mp,
+ "total iclog buffer size (logbufs * logbsize) cannot exceed %d bytes",
+ (log->l_logsize >> 1));
+ goto out_free_log;
+ }
+
/*
* Use a NULL block for the extra log buffer used during splits so that
* it will trigger errors if we ever try to do IO on it without first
--
2.9.5
prev parent reply other threads:[~2017-10-23 14:46 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-23 14:46 [PATCH 0/4] xfs: miscellaneous log recovery fixes Brian Foster
2017-10-23 14:46 ` [PATCH 1/4] xfs: sanity check log record range parameters Brian Foster
2017-10-23 23:49 ` Darrick J. Wong
2017-10-24 11:30 ` Brian Foster
2017-10-25 5:09 ` Darrick J. Wong
2017-10-23 14:46 ` [PATCH 2/4] xfs: fix log block underflow during recovery cycle verification Brian Foster
2017-10-23 23:50 ` Darrick J. Wong
2017-10-23 14:46 ` [PATCH 3/4] xfs: drain the buffer LRU on mount Brian Foster
2017-10-23 16:39 ` Darrick J. Wong
2017-10-23 16:54 ` Brian Foster
2017-10-24 0:23 ` Darrick J. Wong
2017-10-24 14:06 ` Brian Foster
2017-10-24 19:47 ` Brian Foster
2017-10-23 14:46 ` Brian Foster [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171023144646.50107-5-bfoster@redhat.com \
--to=bfoster@redhat.com \
--cc=linux-xfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).