diff --git a/SOURCES/rsync-3.1.3-xattr.patch b/SOURCES/rsync-3.1.3-xattr.patch
new file mode 100644
index 0000000..91b77c2
--- /dev/null
+++ b/SOURCES/rsync-3.1.3-xattr.patch
@@ -0,0 +1,38 @@
+diff --git a/xattrs.c b/xattrs.c
+index 508649c0..3c549192 100644
+--- a/xattrs.c
++++ b/xattrs.c
+@@ -1055,7 +1055,7 @@ int set_xattr(const char *fname, const struct file_struct *file, const char *fna
+ {
+ 	rsync_xa_list *glst = rsync_xal_l.items;
+ 	item_list *lst;
+-	int ndx;
++	int ndx, added_write_perm = 0;
+ 
+ 	if (dry_run)
+ 		return 1; /* FIXME: --dry-run needs to compute this value */
+@@ -1084,10 +1084,23 @@ int set_xattr(const char *fname, const struct file_struct *file, const char *fna
+ 	}
+ #endif
+ 
++	/* If the target file lacks write permission, we try to add it
++	 * temporarily so we can change the extended attributes. */
++	if (!am_root
++#ifdef SUPPORT_LINKS
++	 && !S_ISLNK(sxp->st.st_mode)
++#endif
++	 && access(fname, W_OK) < 0
++	 && do_chmod(fname, (sxp->st.st_mode & CHMOD_BITS) | S_IWUSR) == 0)
++		added_write_perm = 1;
++
+ 	ndx = F_XATTR(file);
+ 	glst += ndx;
+ 	lst = &glst->xa_items;
+-	return rsync_xal_set(fname, lst, fnamecmp, sxp);
++	int return_value = rsync_xal_set(fname, lst, fnamecmp, sxp);
++	if (added_write_perm) /* remove the temporary write permission */
++		do_chmod(fname, sxp->st.st_mode);
++	return return_value;
+ }
+ 
+ #ifdef SUPPORT_ACLS
diff --git a/SPECS/rsync.spec b/SPECS/rsync.spec
index c267baa..c13436e 100644
--- a/SPECS/rsync.spec
+++ b/SPECS/rsync.spec
@@ -9,7 +9,7 @@
 Summary: A program for synchronizing files over a network
 Name: rsync
 Version: 3.1.3
-Release: 12%{?dist}
+Release: 13%{?dist}
 Group: Applications/Internet
 URL: http://rsync.samba.org/
 
@@ -35,6 +35,7 @@ Patch4: rsync-3.1.2-vvv-hang.patch
 Patch5: rsync-3.1.3-ignore-missing.patch
 Patch6: rsync-3.1.3-append-check.patch
 Patch7: rsync-3.1.3-skip-compress.patch
+Patch8: rsync-3.1.3-xattr.patch
 
 %description
 Rsync uses a reliable algorithm to bring remote and host files into
@@ -80,6 +81,7 @@ patch -p1 -i patches/copy-devices.diff
 %patch5 -p1 -b .missing
 %patch6 -p1 -b .append
 %patch7 -p1 -b .skip-compress
+%patch8 -p1 -b .xattr
 
 %build
 %configure
@@ -126,6 +128,9 @@ chmod -x support/*
 %systemd_postun_with_restart rsyncd.service
 
 %changelog
+* Mon Sep 27 2021 Tomas Korbar <tkorbar@redhat.com> - 3.1.3-13
+- Resolves: #1907443 - Read-only files that have changed xattrs fail to allow xattr changes
+
 * Fri Dec 18 2020 Michal Ruprich <mruprich@redhat.com> - 3.1.3-12
 - Resolves: #1816528 - Defaults for --skip-compress are not working, everything is being compressed