diff --git a/SOURCES/quota-4.05-Fix-limits-setting-on-XFS-filesystem.patch b/SOURCES/quota-4.05-Fix-limits-setting-on-XFS-filesystem.patch
new file mode 100644
index 0000000..92de36d
--- /dev/null
+++ b/SOURCES/quota-4.05-Fix-limits-setting-on-XFS-filesystem.patch
@@ -0,0 +1,42 @@
+From 13bb8c2daca0f1c1099ce6ba9dcb23319f7955d0 Mon Sep 17 00:00:00 2001
+From: Jan Kara <jack@suse.cz>
+Date: Wed, 20 May 2020 16:22:52 +0200
+Subject: [PATCH 2/2] Fix limits setting on XFS filesystem
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+xfs_commit_dquot() always set FS_DQ_LIMIT_MASK when calling
+Q_XFS_SETQLIM. So far this wasn't a problem since quota tools didn't
+support setting of anything else for XFS but now that kernel will start
+supporting setting of grace times for XFS, we need to be more careful
+and set limits bits only if we really want to update them. Also
+FS_DQ_LIMIT_MASK contains real-time limits as well. Quota tools
+currently don't support them in any way so avoid telling kernel to set
+them.
+
+Reviewed-by: Eric Sandeen <sandeen@redhat.com>
+Signed-off-by: Jan Kara <jack@suse.cz>
+Signed-off-by: Petr Písař <ppisar@redhat.com>
+---
+ quotaio_xfs.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/quotaio_xfs.c b/quotaio_xfs.c
+index a4d6f67..3333bb1 100644
+--- a/quotaio_xfs.c
++++ b/quotaio_xfs.c
+@@ -165,7 +165,9 @@ static int xfs_commit_dquot(struct dquot *dquot, int flags)
+ 		if (flags & COMMIT_USAGE) /* block usage */
+ 			xdqblk.d_fieldmask |= FS_DQ_BCOUNT;
+ 	} else {
+-		xdqblk.d_fieldmask |= FS_DQ_LIMIT_MASK;
++		if (flags & COMMIT_LIMITS) /* warn/limit */
++			xdqblk.d_fieldmask |= FS_DQ_BSOFT | FS_DQ_BHARD |
++						FS_DQ_ISOFT | FS_DQ_IHARD;
+ 		if (flags & COMMIT_TIMES) /* indiv grace period */
+ 			xdqblk.d_fieldmask |= FS_DQ_TIMER_MASK;
+ 	}
+-- 
+2.25.4
+
diff --git a/SOURCES/quota-4.05-quota-tools-Set-FS_DQ_TIMER_MASK-for-individual-xfs-.patch b/SOURCES/quota-4.05-quota-tools-Set-FS_DQ_TIMER_MASK-for-individual-xfs-.patch
new file mode 100644
index 0000000..b12b3f7
--- /dev/null
+++ b/SOURCES/quota-4.05-quota-tools-Set-FS_DQ_TIMER_MASK-for-individual-xfs-.patch
@@ -0,0 +1,39 @@
+From be96da2353669d433b0abddb85b26ccaf35e3451 Mon Sep 17 00:00:00 2001
+From: Eric Sandeen <sandeen@redhat.com>
+Date: Thu, 14 May 2020 12:17:29 +0200
+Subject: [PATCH 1/2] quota-tools: Set FS_DQ_TIMER_MASK for individual xfs
+ grace times
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+xfs quota code doesn't currently allow increasing an individual
+user's grace time, but kernel patches are in development for this.
+
+In order for setquota to be able to send this update via
+setquota -T, we need to add the FS_DQ_TIMER_MASK when we are trying
+to update the grace times on an individual user's dquot.
+
+Signed-off-by: Eric Sandeen <sandeen@redhat.com>
+Signed-off-by: Jan Kara <jack@suse.cz>
+Signed-off-by: Petr Písař <ppisar@redhat.com>
+---
+ quotaio_xfs.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/quotaio_xfs.c b/quotaio_xfs.c
+index b22c7b4..a4d6f67 100644
+--- a/quotaio_xfs.c
++++ b/quotaio_xfs.c
+@@ -166,6 +166,8 @@ static int xfs_commit_dquot(struct dquot *dquot, int flags)
+ 			xdqblk.d_fieldmask |= FS_DQ_BCOUNT;
+ 	} else {
+ 		xdqblk.d_fieldmask |= FS_DQ_LIMIT_MASK;
++		if (flags & COMMIT_TIMES) /* indiv grace period */
++			xdqblk.d_fieldmask |= FS_DQ_TIMER_MASK;
+ 	}
+ 
+ 	qcmd = QCMD(Q_XFS_SETQLIM, h->qh_type);
+-- 
+2.25.4
+
diff --git a/SOURCES/quota-4.05-quota-tools-pass-quota-type-to-QCMD-for-Q_XFS_GETQST.patch b/SOURCES/quota-4.05-quota-tools-pass-quota-type-to-QCMD-for-Q_XFS_GETQST.patch
new file mode 100644
index 0000000..d1e987e
--- /dev/null
+++ b/SOURCES/quota-4.05-quota-tools-pass-quota-type-to-QCMD-for-Q_XFS_GETQST.patch
@@ -0,0 +1,56 @@
+From fdd774bf08e56872ae4c0420e0f01efa25e715d6 Mon Sep 17 00:00:00 2001
+From: Eric Sandeen <sandeen@redhat.com>
+Date: Fri, 8 May 2020 14:36:46 -0500
+Subject: [PATCH] quota-tools: pass quota type to QCMD for Q_XFS_GETQSTAT
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Older kernels ignored the type sent to Q_XFS_GETQSTAT, and returned
+timer information for the first quota type which was found to be
+enabled.
+
+As of 555b2c3da1fc ("quota: honor quota type in Q_XGETQSTAT[V] calls")
+the kernel now honors the quota type requested, so send that from the
+Q_XFS_GETQSTAT calls in quota tools.
+
+Older kernels ignore the type altogether, so this change should be
+backwards compatible with no change in behavior.
+
+Signed-off-by: Eric Sandeen <sandeen@redhat.com>
+Signed-off-by: Jan Kara <jack@suse.cz>
+Signed-off-by: Petr Písař <ppisar@redhat.com>
+---
+ quotaio_xfs.c | 2 +-
+ quotaon_xfs.c | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/quotaio_xfs.c b/quotaio_xfs.c
+index 56daf89..b22c7b4 100644
+--- a/quotaio_xfs.c
++++ b/quotaio_xfs.c
+@@ -81,7 +81,7 @@ static int xfs_init_io(struct quota_handle *h)
+ 	struct xfs_mem_dqinfo info;
+ 	int qcmd;
+ 
+-	qcmd = QCMD(Q_XFS_GETQSTAT, 0);
++	qcmd = QCMD(Q_XFS_GETQSTAT, h->qh_type);
+ 	memset(&info, 0, sizeof(struct xfs_mem_dqinfo));
+ 	if (quotactl(qcmd, h->qh_quotadev, 0, (void *)&info) < 0)
+ 		return -1;
+diff --git a/quotaon_xfs.c b/quotaon_xfs.c
+index d557a75..d137240 100644
+--- a/quotaon_xfs.c
++++ b/quotaon_xfs.c
+@@ -32,7 +32,7 @@ static int xfs_state_check(int qcmd, int type, int flags, const char *dev, int r
+ 	if (flags & STATEFLAG_ALL)
+ 		return 0;	/* noop */
+ 
+-	if (quotactl(QCMD(Q_XFS_GETQSTAT, 0), dev, 0, (void *)&info) < 0) {
++	if (quotactl(QCMD(Q_XFS_GETQSTAT, type), dev, 0, (void *)&info) < 0) {
+ 		errstr(_("quotactl() on %s: %s\n"), dev, strerror(errno));
+ 		return -1;
+ 	}
+-- 
+2.25.4
+
diff --git a/SPECS/quota.spec b/SPECS/quota.spec
index 3ea4fd8..1dbca28 100644
--- a/SPECS/quota.spec
+++ b/SPECS/quota.spec
@@ -10,7 +10,7 @@
 Name:       quota
 Epoch:      1
 Version:    4.04
-Release:    11%{?dist}
+Release:    12%{?dist}
 Summary:    System administration tools for monitoring users' disk usage
 # quota_nld.c, quotaio_xfs.h:       GPLv2
 # bylabel.c copied from util-linux: GPLv2+
@@ -92,6 +92,14 @@ Patch14: quota-4.04-quotackeck-Fix-a-directory-descriptor-leak-in-scan_d.patch
 # Fix a descriptor leak, bug #1602674, proposed to upstream,
 # <https://sourceforge.net/p/linuxquota/bugs/129/>
 Patch15: quota-4.04-xqmstats-Fix-a-file-descriptor-leak-in-main.patch
+# Pass quota type for Q_XFS_GETQSTAT, bug #1898549, in upstream after 4.05
+Patch16: quota-4.05-quota-tools-pass-quota-type-to-QCMD-for-Q_XFS_GETQST.patch
+# 1/2 Support setting individual grace times for XFS, bug #1898549,
+# in upstream after 4.05
+Patch17: quota-4.05-quota-tools-Set-FS_DQ_TIMER_MASK-for-individual-xfs-.patch
+# 2/2 Support setting individual grace times for XFS, bug #1898549,
+# in upstream after 4.05
+Patch18: quota-4.05-Fix-limits-setting-on-XFS-filesystem.patch
 BuildRequires:  autoconf
 BuildRequires:  automake
 BuildRequires:  bash
@@ -223,6 +231,9 @@ Linux/UNIX environment.
 %patch13 -p1
 %patch14 -p1
 %patch15 -p1
+%patch16 -p1
+%patch17 -p1
+%patch18 -p1
 # Regenerate build scripts
 autoreconf -f -i
 
@@ -367,6 +378,9 @@ make check
 
 
 %changelog
+* Wed Nov 18 2020 Petr Pisar <ppisar@redhat.com> - 1:4.04-12
+- Support setting individual grace times for XFS (bug #1898549)
+
 * Wed Sep 02 2020 Petr Pisar <ppisar@redhat.com> - 1:4.04-11
 - Require libtirpc-devel by quota-devel because of rpc/rpc.h (bug #1868671)