stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: <gregkh@linuxfoundation.org>
To: darrick.wong@oracle.com, bfoster@redhat.com, gregkh@linuxfoundation.org
Cc: <stable@vger.kernel.org>, <stable-commits@vger.kernel.org>
Subject: Patch "xfs: perag initialization should only touch m_ag_max_usable for AG 0" has been added to the 4.13-stable tree
Date: Tue, 24 Oct 2017 14:53:51 +0200	[thread overview]
Message-ID: <1508849631464@kroah.com> (raw)


This is a note to let you know that I've just added the patch titled

    xfs: perag initialization should only touch m_ag_max_usable for AG 0

to the 4.13-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     xfs-perag-initialization-should-only-touch-m_ag_max_usable-for-ag-0.patch
and it can be found in the queue-4.13 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


>From 9789dd9e1d939232e8ff4c50ef8e75aa6781b3fb Mon Sep 17 00:00:00 2001
From: "Darrick J. Wong" <darrick.wong@oracle.com>
Date: Mon, 18 Sep 2017 09:42:09 -0700
Subject: xfs: perag initialization should only touch m_ag_max_usable for AG 0

From: Darrick J. Wong <darrick.wong@oracle.com>

commit 9789dd9e1d939232e8ff4c50ef8e75aa6781b3fb upstream.

We call __xfs_ag_resv_init to make a per-AG reservation for each AG.
This makes the reservation per-AG, not per-filesystem.  Therefore, it
is incorrect to adjust m_ag_max_usable for each AG.  Adjust it only
when we're reserving AG 0's blocks so that we only do it once per fs.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/xfs/libxfs/xfs_ag_resv.c |   12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

--- a/fs/xfs/libxfs/xfs_ag_resv.c
+++ b/fs/xfs/libxfs/xfs_ag_resv.c
@@ -156,7 +156,8 @@ __xfs_ag_resv_free(
 	trace_xfs_ag_resv_free(pag, type, 0);
 
 	resv = xfs_perag_resv(pag, type);
-	pag->pag_mount->m_ag_max_usable += resv->ar_asked;
+	if (pag->pag_agno == 0)
+		pag->pag_mount->m_ag_max_usable += resv->ar_asked;
 	/*
 	 * AGFL blocks are always considered "free", so whatever
 	 * was reserved at mount time must be given back at umount.
@@ -216,7 +217,14 @@ __xfs_ag_resv_init(
 		return error;
 	}
 
-	mp->m_ag_max_usable -= ask;
+	/*
+	 * Reduce the maximum per-AG allocation length by however much we're
+	 * trying to reserve for an AG.  Since this is a filesystem-wide
+	 * counter, we only make the adjustment for AG 0.  This assumes that
+	 * there aren't any AGs hungrier for per-AG reservation than AG 0.
+	 */
+	if (pag->pag_agno == 0)
+		mp->m_ag_max_usable -= ask;
 
 	resv = xfs_perag_resv(pag, type);
 	resv->ar_asked = ask;


Patches currently in stable-queue which might be from darrick.wong@oracle.com are

queue-4.13/xfs-don-t-unconditionally-clear-the-reflink-flag-on-zero-block-files.patch
queue-4.13/xfs-move-two-more-rt-specific-functions-into-config_xfs_rt.patch
queue-4.13/xfs-cancel-dirty-pages-on-invalidation.patch
queue-4.13/xfs-reinit-btree-pointer-on-attr-tree-inactivation-walk.patch
queue-4.13/xfs-report-zeroed-or-not-correctly-in-xfs_zero_range.patch
queue-4.13/xfs-move-more-rt-specific-code-under-config_xfs_rt.patch
queue-4.13/xfs-don-t-change-inode-mode-if-acl-update-fails.patch
queue-4.13/xfs-handle-error-if-xfs_btree_get_bufs-fails.patch
queue-4.13/iomap_dio_rw-allocate-aio-completion-queue-before-submitting-dio.patch
queue-4.13/xfs-update-i_size-after-unwritten-conversion-in-dio-completion.patch
queue-4.13/xfs-trim-writepage-mapping-to-within-eof.patch
queue-4.13/xfs-handle-racy-aio-in-xfs_reflink_end_cow.patch
queue-4.13/xfs-evict-cow-fork-extents-when-performing-finsert-fcollapse.patch
queue-4.13/xfs-capture-state-of-the-right-inode-in-xfs_iflush_done.patch
queue-4.13/fs-xfs-use-ps-printk-format-for-direct-addresses.patch
queue-4.13/xfs-perag-initialization-should-only-touch-m_ag_max_usable-for-ag-0.patch
queue-4.13/xfs-always-swap-the-cow-forks-when-swapping-extents.patch
queue-4.13/xfs-don-t-log-uninitialised-fields-in-inode-structures.patch

                 reply	other threads:[~2017-10-24 12:54 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1508849631464@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=bfoster@redhat.com \
    --cc=darrick.wong@oracle.com \
    --cc=stable-commits@vger.kernel.org \
    --cc=stable@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).