Skip to contentSkip to conversation

xfsprogs: fixes for 5.10-rc1

PATCH In review Darrick J. Wong 4 participants 16 messages Nov 25, 2020 – Dec 4, 2020

lore
Share & tools
lore
#0 lore raw

v3 cover xfsprogs: fixes for 5.10-rc1

Hi all,

Fix various minor bugs in 5.10-rc1 (hence v3).

If you're going to start using this mess, you probably ought to just pull from my git trees, which are linked below.

This is an extraordinary way to destroy everything. Enjoy! Comments and questions are, as always, welcome.

--D

xfsprogs git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfsprogs-dev.git/log/?h=xfsprogs-5.10-fixes

---
 debian/changelog           |    2 +-
 debian/control             |    2 +-
 include/platform_defs.h.in |    6 +++---
 libxfs/trans.c             |   14 ++++++++++++++
 tools/libxfs-apply         |   14 +++++++++++---
 5 files changed, 30 insertions(+), 8 deletions(-)
#1 lore raw

PATCH v3 1/5 libxfs-apply: don't add duplicate headers

From: Darrick J. Wong <[email protected]>

When we're backporting patches from libxfs, don't add a S-o-b header if there's already one at the end of the headers of the patch being ported.

That way, we avoid things like:

---
 tools/libxfs-apply |   14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
tools/libxfs-apply +11 -3
index 3258272d6189..9271db380198 100755
@@ -193,6 +193,14 @@ filter_xfsprogs_patch()
 	rm -f $_libxfs_files
 }
 
+add_header()
+{
+	local hdr="$1"
+	local hdrfile="$2"
+
+	tail -n 1 "$hdrfile" | grep -q "^${hdr}$" || echo "$hdr" >> "$hdrfile"
+}
+
 fixup_header_format()
 {
 	local _source=$1
@@ -280,13 +288,13 @@ fixup_header_format()
 	sed -i '${/^[[:space:]]*$/d;}' $_hdr.new
 
 	# Add Signed-off-by: header if specified
-	if [ ! -z ${SIGNED_OFF_BY+x} ]; then 
-		echo "Signed-off-by: $SIGNED_OFF_BY" >> $_hdr.new
+	if [ ! -z ${SIGNED_OFF_BY+x} ]; then
+		add_header "Signed-off-by: $SIGNED_OFF_BY" $_hdr.new
 	else	# get it from git config if present
 		SOB_NAME=`git config --get user.name`
 		SOB_EMAIL=`git config --get user.email`
 		if [ ! -z ${SOB_NAME+x} ]; then
-			echo "Signed-off-by: $SOB_NAME <$SOB_EMAIL>" >> $_hdr.new
+			add_header "Signed-off-by: $SOB_NAME <$SOB_EMAIL>" $_hdr.new
 		fi
 	fi
 
Reviewed-by Dave Chinner on v3 1/5
#2 lore raw

Re: [PATCH 1/5] libxfs-apply: don't add duplicate headers

Quoted 8 lines · Darrick J. Wong

From: Darrick J. Wong <[email protected]>

When we're backporting patches from libxfs, don't add a S-o-b header if there's already one at the end of the headers of the patch being ported.

That way, we avoid things like:

But it will still not add my additional SOB if I merge something across to userspace that starts out with:

And I always felt like the committer should be adding their SOB to the end of the chain when they move code from one place to another, especially if any tweaks got made along the way.

IOWs I see the rationale for removing duplicate /sequential/ SOBs, but not for removing duplicate SOBs in general.

Am I thinking about that wrong?

Quoted 42 lines
---
 tools/libxfs-apply |   14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
tools/libxfs-apply +11 -3
index 3258272d6189..9271db380198 100755
@@ -193,6 +193,14 @@ filter_xfsprogs_patch()
 	rm -f $_libxfs_files
 }
 
+add_header()
+{
+	local hdr="$1"
+	local hdrfile="$2"
+
+	tail -n 1 "$hdrfile" | grep -q "^${hdr}$" || echo "$hdr" >> "$hdrfile"
+}
+
 fixup_header_format()
 {
 	local _source=$1
@@ -280,13 +288,13 @@ fixup_header_format()
 	sed -i '${/^[[:space:]]*$/d;}' $_hdr.new
 
 	# Add Signed-off-by: header if specified
-	if [ ! -z ${SIGNED_OFF_BY+x} ]; then 
-		echo "Signed-off-by: $SIGNED_OFF_BY" >> $_hdr.new
+	if [ ! -z ${SIGNED_OFF_BY+x} ]; then
+		add_header "Signed-off-by: $SIGNED_OFF_BY" $_hdr.new
 	else	# get it from git config if present
 		SOB_NAME=`git config --get user.name`
 		SOB_EMAIL=`git config --get user.email`
 		if [ ! -z ${SOB_NAME+x} ]; then
-			echo "Signed-off-by: $SOB_NAME <$SOB_EMAIL>" >> $_hdr.new
+			add_header "Signed-off-by: $SOB_NAME <$SOB_EMAIL>" $_hdr.new
 		fi
 	fi
 
#3 lore raw

Re: [PATCH 1/5] libxfs-apply: don't add duplicate headers

Quoted 17 lines · Eric Sandeen
Quoted 8 lines · Darrick J. Wong

From: Darrick J. Wong <[email protected]>

When we're backporting patches from libxfs, don't add a S-o-b header if there's already one at the end of the headers of the patch being ported.

That way, we avoid things like:

But it will still not add my additional SOB if I merge something across to userspace that starts out with:

Quoted 8 lines

And I always felt like the committer should be adding their SOB to the end of the chain when they move code from one place to another, especially if any tweaks got made along the way.

IOWs I see the rationale for removing duplicate /sequential/ SOBs, but not for removing duplicate SOBs in general.

Am I thinking about that wrong?

add_header is different from last time -- whereas before it would search the entire $hdrfile for $hdr and add $hdr if it didn't find a match, now it only looks at the last line of $hdrfile for a match.

For your example above, it would not add another "SOB: Darrick" because there's already one at the bottom of the headers; but it would add another "SOB: Eric" because this commit acquired other tags after your first signoff.

--D

Quoted 42 lines
Quoted 42 lines
---
 tools/libxfs-apply |   14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
tools/libxfs-apply +11 -3
index 3258272d6189..9271db380198 100755
@@ -193,6 +193,14 @@ filter_xfsprogs_patch()
 	rm -f $_libxfs_files
 }
 
+add_header()
+{
+	local hdr="$1"
+	local hdrfile="$2"
+
+	tail -n 1 "$hdrfile" | grep -q "^${hdr}$" || echo "$hdr" >> "$hdrfile"
+}
+
 fixup_header_format()
 {
 	local _source=$1
@@ -280,13 +288,13 @@ fixup_header_format()
 	sed -i '${/^[[:space:]]*$/d;}' $_hdr.new
 
 	# Add Signed-off-by: header if specified
-	if [ ! -z ${SIGNED_OFF_BY+x} ]; then 
-		echo "Signed-off-by: $SIGNED_OFF_BY" >> $_hdr.new
+	if [ ! -z ${SIGNED_OFF_BY+x} ]; then
+		add_header "Signed-off-by: $SIGNED_OFF_BY" $_hdr.new
 	else	# get it from git config if present
 		SOB_NAME=`git config --get user.name`
 		SOB_EMAIL=`git config --get user.email`
 		if [ ! -z ${SOB_NAME+x} ]; then
-			echo "Signed-off-by: $SOB_NAME <$SOB_EMAIL>" >> $_hdr.new
+			add_header "Signed-off-by: $SOB_NAME <$SOB_EMAIL>" $_hdr.new
 		fi
 	fi
 
#4 lore raw

Re: [PATCH 1/5] libxfs-apply: don't add duplicate headers

Quoted 22 lines · Darrick J. Wong
Quoted 21 lines · Eric Sandeen
Quoted 8 lines · Darrick J. Wong

From: Darrick J. Wong <[email protected]>

When we're backporting patches from libxfs, don't add a S-o-b header if there's already one at the end of the headers of the patch being ported.

That way, we avoid things like:

But it will still not add my additional SOB if I merge something across to userspace that starts out with:

And I always felt like the committer should be adding their SOB to the end of the chain when they move code from one place to another, especially if any tweaks got made along the way.

Quoted 8 lines
Quoted 4 lines

IOWs I see the rationale for removing duplicate /sequential/ SOBs, but not for removing duplicate SOBs in general.

Am I thinking about that wrong?

add_header is different from last time -- whereas before it would search the entire $hdrfile for $hdr and add $hdr if it didn't find a match, now it only looks at the last line of $hdrfile for a match.

I'm sorry, I visually checked and thought it was same as last time. Will look again, more closely.

Thanks,
-Eric

Quoted 50 lines

For your example above, it would not add another "SOB: Darrick" because there's already one at the bottom of the headers; but it would add another "SOB: Eric" because this commit acquired other tags after your first signoff.

--D

Quoted 42 lines
Quoted 42 lines
---
 tools/libxfs-apply |   14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
tools/libxfs-apply +11 -3
index 3258272d6189..9271db380198 100755
@@ -193,6 +193,14 @@ filter_xfsprogs_patch()
 	rm -f $_libxfs_files
 }
 
+add_header()
+{
+	local hdr="$1"
+	local hdrfile="$2"
+
+	tail -n 1 "$hdrfile" | grep -q "^${hdr}$" || echo "$hdr" >> "$hdrfile"
+}
+
 fixup_header_format()
 {
 	local _source=$1
@@ -280,13 +288,13 @@ fixup_header_format()
 	sed -i '${/^[[:space:]]*$/d;}' $_hdr.new
 
 	# Add Signed-off-by: header if specified
-	if [ ! -z ${SIGNED_OFF_BY+x} ]; then 
-		echo "Signed-off-by: $SIGNED_OFF_BY" >> $_hdr.new
+	if [ ! -z ${SIGNED_OFF_BY+x} ]; then
+		add_header "Signed-off-by: $SIGNED_OFF_BY" $_hdr.new
 	else	# get it from git config if present
 		SOB_NAME=`git config --get user.name`
 		SOB_EMAIL=`git config --get user.email`
 		if [ ! -z ${SOB_NAME+x} ]; then
-			echo "Signed-off-by: $SOB_NAME <$SOB_EMAIL>" >> $_hdr.new
+			add_header "Signed-off-by: $SOB_NAME <$SOB_EMAIL>" $_hdr.new
 		fi
 	fi
 
Reviewed-by on v3 1/5
#5 lore raw

Re: [PATCH 1/5] libxfs-apply: don't add duplicate headers

In reply to Darrick J. Wong
Quoted 8 lines · Darrick J. Wong

From: Darrick J. Wong <[email protected]>

When we're backporting patches from libxfs, don't add a S-o-b header if there's already one at the end of the headers of the patch being ported.

That way, we avoid things like:

I like how that SOB is part of the changelog and is also part of the changelog ;)

Quoted 42 lines
---
 tools/libxfs-apply |   14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
tools/libxfs-apply +11 -3
index 3258272d6189..9271db380198 100755
@@ -193,6 +193,14 @@ filter_xfsprogs_patch()
 	rm -f $_libxfs_files
 }
 
+add_header()
+{
+	local hdr="$1"
+	local hdrfile="$2"
+
+	tail -n 1 "$hdrfile" | grep -q "^${hdr}$" || echo "$hdr" >> "$hdrfile"
+}
+
 fixup_header_format()
 {
 	local _source=$1
@@ -280,13 +288,13 @@ fixup_header_format()
 	sed -i '${/^[[:space:]]*$/d;}' $_hdr.new
 
 	# Add Signed-off-by: header if specified
-	if [ ! -z ${SIGNED_OFF_BY+x} ]; then 
-		echo "Signed-off-by: $SIGNED_OFF_BY" >> $_hdr.new
+	if [ ! -z ${SIGNED_OFF_BY+x} ]; then
+		add_header "Signed-off-by: $SIGNED_OFF_BY" $_hdr.new
 	else	# get it from git config if present
 		SOB_NAME=`git config --get user.name`
 		SOB_EMAIL=`git config --get user.email`
 		if [ ! -z ${SOB_NAME+x} ]; then
-			echo "Signed-off-by: $SOB_NAME <$SOB_EMAIL>" >> $_hdr.new
+			add_header "Signed-off-by: $SOB_NAME <$SOB_EMAIL>" $_hdr.new
 		fi
 	fi
 
#6 lore raw

PATCH v3 2/5 libxfs: fix weird comment

In reply to Darrick J. Wong

From: Darrick J. Wong <[email protected]>

Not sure what happened with this multiline comment, but clean up all the stars.

---
 include/platform_defs.h.in |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
include/platform_defs.h.in +3 -3
index 95e7209a3332..539bdbecf6e0 100644
@@ -86,9 +86,9 @@ extern int	platform_nproc(void);
 /* Simplified from version in include/linux/overflow.h */
 
 /*
- *  * Compute a*b+c, returning SIZE_MAX on overflow. Internal helper for
- *   * struct_size() below.
- *    */
+ * Compute a*b+c, returning SIZE_MAX on overflow. Internal helper for
+ * struct_size() below.
+ */
 static inline size_t __ab_c_size(size_t a, size_t b, size_t c)
 {
 	return (a * b) + c;
Reviewed-by on v3 2/5
#7 lore raw

Re: [PATCH 2/5] libxfs: fix weird comment

Quoted 4 lines · Darrick J. Wong

From: Darrick J. Wong <[email protected]>

Not sure what happened with this multiline comment, but clean up all the stars.

urk, that looks like something I would do, thanks :)

"My God, it's full of stars!"

Quoted 25 lines
---
 include/platform_defs.h.in |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
include/platform_defs.h.in +3 -3
index 95e7209a3332..539bdbecf6e0 100644
@@ -86,9 +86,9 @@ extern int	platform_nproc(void);
 /* Simplified from version in include/linux/overflow.h */
 
 /*
- *  * Compute a*b+c, returning SIZE_MAX on overflow. Internal helper for
- *   * struct_size() below.
- *    */
+ * Compute a*b+c, returning SIZE_MAX on overflow. Internal helper for
+ * struct_size() below.
+ */
 static inline size_t __ab_c_size(size_t a, size_t b, size_t c)
 {
 	return (a * b) + c;
#9 lore raw

PATCH v3 3/5 libxfs: add realtime extent reservation and usage tracking to transactions

In reply to Darrick J. Wong

From: Darrick J. Wong <[email protected]>

The libxfs resync added to the deferred ops code the ability to capture the unfinished deferred ops and transaction reservation for later replay during log recovery. This nominally requires transactions to have the ability to track rt extent reservations and usage, so port that missing piece from the kernel now to avoid leaving logic bombs in case anyone ever /does/ start messing with realtime.

---
 libxfs/trans.c |   14 ++++++++++++++
 1 file changed, 14 insertions(+)
libxfs/trans.c +14 -0
index 83247582d61e..bc4af26c09f6 100644
@@ -230,6 +230,7 @@ xfs_trans_reserve(
 			error = -ENOSPC;
 			goto undo_blocks;
 		}
+		tp->t_rtx_res += rtextents;
 	}
 
 	return 0;
@@ -765,6 +766,19 @@ _("Transaction block reservation exceeded! %u > %u\n"),
 		tp->t_ifree_delta += delta;
 		break;
 	case XFS_TRANS_SB_FREXTENTS:
+		/*
+		 * Track the number of rt extents allocated in the transaction.
+		 * Make sure it does not exceed the number reserved.
+		 */
+		if (delta < 0) {
+			tp->t_rtx_res_used += (uint)-delta;
+			if (tp->t_rtx_res_used > tp->t_rtx_res) {
+				fprintf(stderr,
+_("Transaction rt block reservation exceeded! %u > %u\n"),
+					tp->t_rtx_res_used, tp->t_rtx_res);
+				ASSERT(0);
+			}
+		}
 		tp->t_frextents_delta += delta;
 		break;
 	default:
#11 lore raw

PATCH v3 4/5 debian: fix version in changelog

In reply to Darrick J. Wong

From: Darrick J. Wong <[email protected]>

We're still at 5.10-rc0, at least according to the tags.

---
 debian/changelog |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
debian/changelog +1 -1
index c41e3913efa4..ba6861985365 100644
@@ -1,4 +1,4 @@
-xfsprogs (5.10.0-1) unstable; urgency=low
+xfsprogs (5.10.0-rc0-1) unstable; urgency=low
 
   * New upstream prerelease
 
Reviewed-by on v3 4/5
#12 lore raw

Re: [PATCH 4/5] debian: fix version in changelog

Quoted 5 lines · Darrick J. Wong

From: Darrick J. Wong <[email protected]>

We're still at 5.10-rc0, at least according to the tags.

Thanks for spotting this

Quoted 16 lines
---
 debian/changelog |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
debian/changelog +1 -1
index c41e3913efa4..ba6861985365 100644
@@ -1,4 +1,4 @@
-xfsprogs (5.10.0-1) unstable; urgency=low
+xfsprogs (5.10.0-rc0-1) unstable; urgency=low
 
   * New upstream prerelease
 
#13 lore raw

PATCH v3 5/5 debian: add build dependency on libinih-dev

In reply to Darrick J. Wong

From: Darrick J. Wong <[email protected]>

mkfs now supports configuration files, which are parsed using libinih. Add this dependency to the debian build.

---
 debian/control |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
debian/control +1 -1
index ddd17850e378..49ffd3409dc0 100644
@@ -3,7 +3,7 @@ Section: admin
 Priority: optional
 Maintainer: XFS Development Team <[email protected]>
 Uploaders: Nathan Scott <[email protected]>, Anibal Monsalve Salazar <[email protected]>
-Build-Depends: uuid-dev, dh-autoreconf, debhelper (>= 5), gettext, libtool, libedit-dev, libblkid-dev (>= 2.17), linux-libc-dev, libdevmapper-dev, libattr1-dev, libicu-dev, dh-python, pkg-config
+Build-Depends: libinih-dev, uuid-dev, dh-autoreconf, debhelper (>= 5), gettext, libtool, libedit-dev, libblkid-dev (>= 2.17), linux-libc-dev, libdevmapper-dev, libattr1-dev, libicu-dev, dh-python, pkg-config
 Standards-Version: 4.0.0
 Homepage: https://xfs.wiki.kernel.org/
 
Reviewed-by on v3 5/5
#14 lore raw

Re: [PATCH 5/5] debian: add build dependency on libinih-dev

Quoted 6 lines · Darrick J. Wong

From: Darrick J. Wong <[email protected]>

mkfs now supports configuration files, which are parsed using libinih. Add this dependency to the debian build.

I don't speak Debian very well but this looks fine.

Quoted 19 lines
---
 debian/control |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
debian/control +1 -1
index ddd17850e378..49ffd3409dc0 100644
@@ -3,7 +3,7 @@ Section: admin
 Priority: optional
 Maintainer: XFS Development Team <[email protected]>
 Uploaders: Nathan Scott <[email protected]>, Anibal Monsalve Salazar <[email protected]>
-Build-Depends: uuid-dev, dh-autoreconf, debhelper (>= 5), gettext, libtool, libedit-dev, libblkid-dev (>= 2.17), linux-libc-dev, libdevmapper-dev, libattr1-dev, libicu-dev, dh-python, pkg-config
+Build-Depends: libinih-dev, uuid-dev, dh-autoreconf, debhelper (>= 5), gettext, libtool, libedit-dev, libblkid-dev (>= 2.17), linux-libc-dev, libdevmapper-dev, libattr1-dev, libicu-dev, dh-python, pkg-config
 Standards-Version: 4.0.0
 Homepage: https://xfs.wiki.kernel.org/
 
Reviewed-by on v3 5/5
#15 lore raw

Re: [PATCH 5/5] debian: add build dependency on libinih-dev

In reply to Darrick J. Wong
Quoted 16 lines · Darrick J. Wong

From: Darrick J. Wong <[email protected]>

mkfs now supports configuration files, which are parsed using libinih. Add this dependency to the debian build.

---
 debian/control |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
debian/control +0 -0
index ddd17850e378..49ffd3409dc0 100644

debian/control Section: admin · line 6

Quoted 5 lines
debian/control +1 -1
@@ -3,7 +3,7 @@ Section: admin
 Priority: optional
 Maintainer: XFS Development Team <[email protected]>
 Uploaders: Nathan Scott <[email protected]>, Anibal Monsalve Salazar <[email protected]>
-Build-Depends: uuid-dev, dh-autoreconf, debhelper (>= 5), gettext, libtool, libedit-dev, libblkid-dev (>= 2.17), linux-libc-dev, libdevmapper-dev, libattr1-dev, libicu-dev, dh-python, pkg-config
+Build-Depends: libinih-dev, uuid-dev, dh-autoreconf, debhelper (>= 5), gettext, libtool, libedit-dev, libblkid-dev (>= 2.17), linux-libc-dev, libdevmapper-dev, libattr1-dev, libicu-dev, dh-python, pkg-config

Oops, yeah, forgot that because my build machines already had that library installed....

Signature · 2 lines
Dave Chinner
[email protected]