]> git-server-git.apps.pok.os.sepia.ceph.com Git - xfsprogs-dev.git/commit
xfs_scrub_all: fix deadlock if lsblk produces a lot of output
authorDarrick J. Wong <djwong@kernel.org>
Thu, 30 Apr 2026 15:54:06 +0000 (08:54 -0700)
committerAndrey Albershteyn <aalbersh@kernel.org>
Wed, 6 May 2026 09:24:04 +0000 (11:24 +0200)
commit1c52b36e3234aedaaa4b467f64c01636e96c1946
tree24fc1ae630b2ff4cafddb8cf1d1d970bf5e663c8
parent922f14a9b77638b4a3fc604169df6799d16f8fd7
xfs_scrub_all: fix deadlock if lsblk produces a lot of output

Patrick Fischer reported a deadlock in find_mounts() that is the result
of lsblk producing so much output that it fills the pipe buffer.  When
this happens, lsblk blocks on write()ing the pipe, at which point
waiting for lsblk to exit will also block forever.

Now that we can be reasonably assured that everyone has Python 3.5
(because RHEL6 is long dead), we can replace this whole mess with a call
to subprocess.run that captures the output.  The json library can
convert a byte array directly to a python dict, which means we don't
need to concatenate iterated lines or any of that stuff anymore.

Reported-by: patrick.fischer@siedl.net
Link: https://lore.kernel.org/linux-xfs/323580211.1220195.1777554001363.JavaMail.zimbra@siedl.net/
Cc: <linux-xfs@vger.kernel.org> # v4.15.0
Fixes: f1dca11cad1308 ("xfs_scrub: create a script to scrub all xfs filesystems")
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
Reviewed-by: Andrey Albershteyn <aalbersh@kernel.org>
scrub/xfs_scrub_all.py.in