From: Brian Foster <bfoster@redhat.com>
To: xfs@oss.sgi.com
Subject: [PATCH 2/3] xfs: exclude never-released buffers from buftarg I/O accounting
Date: Wed, 13 Jul 2016 12:16:34 -0400 [thread overview]
Message-ID: <1468426595-35032-3-git-send-email-bfoster@redhat.com> (raw)
In-Reply-To: <1468426595-35032-1-git-send-email-bfoster@redhat.com>
The upcoming buftarg I/O accounting mechanism maintains a count of all
buffers that have undergone I/O in the current hold-release cycle.
Certain buffers associated with core infrastructure (e.g., the xfs_mount
superblock buffer, log buffers) are never released, however. This means
that accounting I/O submission on such buffers elevates the buftarg
count indefinitely and could lead to lockup on unmount.
Define a new buffer flag to explicitly exclude buffers from buftarg I/O
accounting. Set the flag on the superblock and associated log buffers.
Signed-off-by: Brian Foster <bfoster@redhat.com>
---
fs/xfs/xfs_buf.h | 1 +
fs/xfs/xfs_log.c | 4 +++-
fs/xfs/xfs_mount.c | 12 +++++++-----
3 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/fs/xfs/xfs_buf.h b/fs/xfs/xfs_buf.h
index a3c7ba4..9e1cca7 100644
--- a/fs/xfs/xfs_buf.h
+++ b/fs/xfs/xfs_buf.h
@@ -43,6 +43,7 @@ typedef enum {
#define XBF_READ (1 << 0) /* buffer intended for reading from device */
#define XBF_WRITE (1 << 1) /* buffer intended for writing to device */
#define XBF_READ_AHEAD (1 << 2) /* asynchronous read-ahead */
+#define XBF_NO_IOACCT (1 << 3) /* bypass I/O accounting (non-LRU bufs) */
#define XBF_ASYNC (1 << 4) /* initiator will not wait for completion */
#define XBF_DONE (1 << 5) /* all pages in the buffer uptodate */
#define XBF_STALE (1 << 6) /* buffer has been staled, do not find it */
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index 63dad9e..4af0fb0 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -1427,7 +1427,8 @@ xlog_alloc_log(
ASSERT(xfs_buf_islocked(bp));
xfs_buf_unlock(bp);
- /* use high priority wq for log I/O completion */
+ /* disable accounting and use high priority wq for log I/O completion */
+ bp->b_flags |= XBF_NO_IOACCT;
bp->b_ioend_wq = mp->m_log_workqueue;
bp->b_iodone = xlog_iodone;
log->l_xbuf = bp;
@@ -1457,6 +1458,7 @@ xlog_alloc_log(
BTOBB(log->l_iclog_size), 0);
if (!bp)
goto out_free_iclog;
+ bp->b_flags |= XBF_NO_IOACCT;
ASSERT(xfs_buf_islocked(bp));
xfs_buf_unlock(bp);
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
index e39b023..a9234a2 100644
--- a/fs/xfs/xfs_mount.c
+++ b/fs/xfs/xfs_mount.c
@@ -272,13 +272,15 @@ xfs_readsb(
buf_ops = NULL;
/*
- * Allocate a (locked) buffer to hold the superblock.
- * This will be kept around at all times to optimize
- * access to the superblock.
+ * Allocate a (locked) buffer to hold the superblock. This will be kept
+ * around at all times to optimize access to the superblock. Therefore,
+ * set XBF_NO_IOACCT to make sure it doesn't hold the buftarg count
+ * elevated.
*/
reread:
- error = xfs_buf_read_uncached(mp->m_ddev_targp, XFS_SB_DADDR,
- BTOBB(sector_size), 0, &bp, buf_ops);
+ error = xfs_buf_read_uncached_flags(mp->m_ddev_targp, XFS_SB_DADDR,
+ BTOBB(sector_size), 0, &bp, buf_ops,
+ XBF_NO_IOACCT);
if (error) {
if (loud)
xfs_warn(mp, "SB validate failed with error %d.", error);
--
2.5.5
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2016-07-13 16:16 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-13 16:16 [PATCH 0/3] serialize unmount against new buffer I/O Brian Foster
2016-07-13 16:16 ` [PATCH 1/3] xfs: helper to set flags on uncached buffer reads Brian Foster
2016-07-14 0:01 ` Dave Chinner
2016-07-14 10:52 ` Brian Foster
2016-07-13 16:16 ` Brian Foster [this message]
2016-07-13 16:16 ` [PATCH 3/3] xfs: track and serialize in-flight async buffers against unmount Brian Foster
2016-07-14 0:05 ` Dave Chinner
2016-07-14 17:29 ` [PATCH 0/3] serialize unmount against new buffer I/O Brian Foster
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=1468426595-35032-3-git-send-email-bfoster@redhat.com \
--to=bfoster@redhat.com \
--cc=xfs@oss.sgi.com \
/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