]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
xfs: exclude never-released buffers from buftarg I/O accounting
authorBrian Foster <bfoster@redhat.com>
Wed, 20 Jul 2016 01:13:43 +0000 (11:13 +1000)
committerSomasundaram Krishnasamy <somasundaram.krishnasamy@oracle.com>
Thu, 18 May 2017 18:57:26 +0000 (11:57 -0700)
Orabug: 25550712

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>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
(cherry picked from commit c891c30a4dd1a236bb98630b35fc2769c5ce0d40)
Signed-off-by: Somasundaram Krishnasamy <somasundaram.krishnasamy@oracle.com>
Reviewed-by: Dhaval Giani <dhaval.giani@oracle.com>
fs/xfs/xfs_buf.c
fs/xfs/xfs_buf.h
fs/xfs/xfs_log.c
fs/xfs/xfs_mount.c

index aa20f8adc23cc37a207016639acdae3ec1c23684..98d7b9d09b8124f9c32cdf6d8a82f651f5bde4dd 100644 (file)
@@ -809,7 +809,8 @@ xfs_buf_get_uncached(
        struct xfs_buf          *bp;
        DEFINE_SINGLE_BUF_MAP(map, XFS_BUF_DADDR_NULL, numblks);
 
-       bp = _xfs_buf_alloc(target, &map, 1, 0);
+       /* flags might contain irrelevant bits, pass only what we care about */
+       bp = _xfs_buf_alloc(target, &map, 1, flags & XBF_NO_IOACCT);
        if (unlikely(bp == NULL))
                goto fail;
 
index def09fde2cf6616d9decad3da6a48ea28e2d7251..2ec465e8d61350d1fbbd043e3014f893e925cb38 100644 (file)
@@ -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 */
index 45e9ec2c6b66d60df74a41e184ee66c8256cbe0c..e16f51cd3bfef670a4acebe9f001b9e04adce9c0 100644 (file)
@@ -1395,7 +1395,7 @@ xlog_alloc_log(
         */
        error = -ENOMEM;
        bp = xfs_buf_alloc(mp->m_logdev_targp, XFS_BUF_DADDR_NULL,
-                          BTOBB(log->l_iclog_size), 0);
+                          BTOBB(log->l_iclog_size), XBF_NO_IOACCT);
        if (!bp)
                goto out_free_log;
 
@@ -1434,7 +1434,8 @@ xlog_alloc_log(
                prev_iclog = iclog;
 
                bp = xfs_buf_get_uncached(mp->m_logdev_targp,
-                                               BTOBB(log->l_iclog_size), 0);
+                                         BTOBB(log->l_iclog_size),
+                                         XBF_NO_IOACCT);
                if (!bp)
                        goto out_free_iclog;
 
index f210c0fb6d012632439e1d2806f0ee65b48f83b1..6d8b1a107094e1f8f36ad1138c3c13d05ffcd116 100644 (file)
@@ -281,13 +281,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);
+                                     BTOBB(sector_size), XBF_NO_IOACCT, &bp,
+                                     buf_ops);
        if (error) {
                if (loud)
                        xfs_warn(mp, "SB validate failed with error %d.", error);