[packages/xfsprogs] - rel 2; fix deadlock

arekm arekm at pld-linux.org
Wed Feb 6 08:18:08 CET 2019


commit eb18ee86691f2b5fdf285674f3ddbbf1b6fdd658
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Wed Feb 6 08:17:58 2019 +0100

    - rel 2; fix deadlock

 xfsprogs-small_fixes.patch | 65 ++++++++++++++++++++++++++++++++++++++++++++++
 xfsprogs.spec              |  4 ++-
 2 files changed, 68 insertions(+), 1 deletion(-)
---
diff --git a/xfsprogs.spec b/xfsprogs.spec
index bfb3070..4bf4f77 100644
--- a/xfsprogs.spec
+++ b/xfsprogs.spec
@@ -6,7 +6,7 @@ Summary:	Tools for the XFS filesystem
 Summary(pl.UTF-8):	Narzędzia do systemu plików XFS
 Name:		xfsprogs
 Version:	4.19.0
-Release:	1
+Release:	2
 License:	LGPL v2.1 (libhandle), GPL v2 (the rest)
 Group:		Applications/System
 Source0:	https://www.kernel.org/pub/linux/utils/fs/xfs/xfsprogs/%{name}-%{version}.tar.gz
@@ -14,6 +14,7 @@ Source0:	https://www.kernel.org/pub/linux/utils/fs/xfs/xfsprogs/%{name}-%{versio
 Source1:	xfs_lsprojid
 Patch0:		%{name}-miscfix-v2.patch
 Patch1:		%{name}-pl.po-update.patch
+Patch2:		xfsprogs-small_fixes.patch
 # Patch1-md5:	28832d2c0aefb92ec17ebfe924c156e3
 URL:		http://www.xfs.org/
 BuildRequires:	autoconf >= 2.50
@@ -108,6 +109,7 @@ Biblioteki statyczne do XFS.
 %setup -q
 %patch0 -p1
 %patch1 -p1
+%patch2 -p1
 
 %{__sed} -i -e '1s,/usr/bin/env python3,%{__python3},' scrub/xfs_scrub_all.in tools/xfsbuflock.py
 
diff --git a/xfsprogs-small_fixes.patch b/xfsprogs-small_fixes.patch
new file mode 100644
index 0000000..2887ba9
--- /dev/null
+++ b/xfsprogs-small_fixes.patch
@@ -0,0 +1,65 @@
+From: Dave Chinner <dchinner at redhat.com>
+
+If inode_item_done() fails to flush an inode after we've grabbed a
+reference to the underlying buffer during a transaction commit, we
+fail to put the buffer and hence leak it. We then deadlock on the
+next lookup ofthe inode buffer as it is still locked and no-one owns
+it.
+
+To fix it, put the buffer on error so that it gets unlocked and
+can be recovered appropriately in a later phase of repair.
+
+Reported-by: Arkadiusz Miskiewicz <arekm at maven.pl>
+Fixes: d15188a1ec14 ("xfs: rework the inline directory verifiers")
+Signed-off-by: Dave Chinner <dchinner at redhat.com>
+---
+ libxfs/trans.c | 17 +++++++++++++----
+ 1 file changed, 13 insertions(+), 4 deletions(-)
+
+diff --git a/libxfs/trans.c b/libxfs/trans.c
+index 46ff8b4ae798..10a35dd47b01 100644
+--- a/libxfs/trans.c
++++ b/libxfs/trans.c
+@@ -824,8 +824,10 @@ _("Transaction block reservation exceeded! %u > %u\n"),
+ 
+ /*
+  * Transaction commital code follows (i.e. write to disk in libxfs)
++ *
++ * XXX (dgc): should failure to flush the inode (e.g. due to uncorrected
++ * corruption) result in transaction commit failure w/ EFSCORRUPTED?
+  */
+-
+ static void
+ inode_item_done(
+ 	xfs_inode_log_item_t	*iip)
+@@ -856,17 +858,24 @@ inode_item_done(
+ 		return;
+ 	}
+ 
++	/*
++	 * Flush the inode and disassociate it from the transaction regardless
++	 * of whether the flush succeed or not. If we fail the flush, make sure
++	 * we still release the buffer reference we currently hold.
++	 */
+ 	bp->b_log_item = iip;
+ 	error = libxfs_iflush_int(ip, bp);
++	ip->i_transp = NULL;	/* disassociate from transaction */
++	bp->b_log_item = NULL;	/* remove log item */
++	bp->b_transp = NULL;	/* remove xact ptr */
++
+ 	if (error) {
+ 		fprintf(stderr, _("%s: warning - iflush_int failed (%d)\n"),
+ 			progname, error);
++		libxfs_putbuf(bp);
+ 		return;
+ 	}
+ 
+-	ip->i_transp = NULL;	/* disassociate from transaction */
+-	bp->b_log_item = NULL;	/* remove log item */
+-	bp->b_transp = NULL;	/* remove xact ptr */
+ 	libxfs_writebuf(bp, 0);
+ #ifdef XACT_DEBUG
+ 	fprintf(stderr, "flushing dirty inode %llu, buffer %p\n",
+-- 
+2.20.1
+
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/xfsprogs.git/commitdiff/eb18ee86691f2b5fdf285674f3ddbbf1b6fdd658



More information about the pld-cvs-commit mailing list