Skip to contentSkip to conversation

xfsprogs: fixes and updates

PATCH In review Dave Chinner 4 participants 17 messages Apr 26, 2022 – May 27, 2022

lore
Share & tools
lore
#0 lore raw

cover xfsprogs: fixes and updates

Hi folks,

A handful of patches I have lying around for xfsprogs. The first two are fixes for metadump when handling corrupt filesystems with bad inode fork layouts. The third is a patch I've used for testing bulkstat scalability to minimise userspace CPU overhead so I can drive the kernel code as hard as possible. The last is an autoconf updates to silence a bunch of build warnings I now get with the latest and greatest autoconf releases.

Applies against v5.15.0.

Cheers,

Dave.

#1 lore raw

PATCH 1/4 metadump: handle corruption errors without aborting

From: Dave Chinner <[email protected]>

Sean Caron reported that a metadump terminated after givin gthis warning:

xfs_metadump: inode 2216156864 has unexpected extents

Metadump is supposed to ignore corruptions and continue dumping the filesystem as best it can. Whilst it warns about many situations where it can't fully dump structures, it should stop processing that structure and continue with the next one until the entire filesystem has been processed.

Unfortunately, some warning conditions also return an "abort" error status, causing metadump to abort if that condition is hit. Most of these abort conditions should really be "continue on next object" conditions so that the we attempt to dump the rest of the filesystem.

Fix the returns for warnings that incorrectly cause aborts such that the only abort conditions are read errors when "stop-on-read-error" semantics are specified. Also make the return values consistently mean abort/continue rather than returning -errno to mean "stop because read error" and then trying to infer what the error means in callers without the context it occurred in.

---
 db/metadump.c | 94 +++++++++++++++++++++++++--------------------------
 1 file changed, 47 insertions(+), 47 deletions(-)
db/metadump.c +47 -47
index 48cda88a3ea5..a21baa2070d9 100644
@@ -1645,7 +1645,7 @@ process_symlink_block(
 {
 	struct bbmap	map;
 	char		*link;
-	int		ret = 0;
+	int		rval = 1;
 
 	push_cur();
 	map.nmaps = 1;
@@ -1658,8 +1658,7 @@ process_symlink_block(
 
 		print_warning("cannot read %s block %u/%u (%llu)",
 				typtab[btype].name, agno, agbno, s);
-		if (stop_on_read_error)
-			ret = -1;
+		rval = !stop_on_read_error;
 		goto out_pop;
 	}
 	link = iocur_top->data;
@@ -1682,10 +1681,11 @@ process_symlink_block(
 	}
 
 	iocur_top->need_crc = 1;
-	ret = write_buf(iocur_top);
+	if (write_buf(iocur_top))
+		rval = 0;
 out_pop:
 	pop_cur();
-	return ret;
+	return rval;
 }
 
 #define MAX_REMOTE_VALS		4095
@@ -1843,8 +1843,8 @@ process_single_fsb_objects(
 	typnm_t		btype,
 	xfs_fileoff_t	last)
 {
+	int		rval = 1;
 	char		*dp;
-	int		ret = 0;
 	int		i;
 
 	for (i = 0; i < c; i++) {
@@ -1858,8 +1858,7 @@ process_single_fsb_objects(
 
 			print_warning("cannot read %s block %u/%u (%llu)",
 					typtab[btype].name, agno, agbno, s);
-			if (stop_on_read_error)
-				ret = -EIO;
+			rval = !stop_on_read_error;
 			goto out_pop;
 
 		}
@@ -1925,16 +1924,17 @@ process_single_fsb_objects(
 		}
 
 write:
-		ret = write_buf(iocur_top);
+		if (write_buf(iocur_top))
+			rval = 0;
 out_pop:
 		pop_cur();
-		if (ret)
+		if (!rval)
 			break;
 		o++;
 		s++;
 	}
 
-	return ret;
+	return rval;
 }
 
 /*
@@ -1952,7 +1952,7 @@ process_multi_fsb_dir(
 	xfs_fileoff_t	last)
 {
 	char		*dp;
-	int		ret = 0;
+	int		rval = 1;
 
 	while (c > 0) {
 		unsigned int	bm_len;
@@ -1978,8 +1978,7 @@ process_multi_fsb_dir(
 
 				print_warning("cannot read %s block %u/%u (%llu)",
 						typtab[btype].name, agno, agbno, s);
-				if (stop_on_read_error)
-					ret = -1;
+				rval = !stop_on_read_error;
 				goto out_pop;
 
 			}
@@ -1998,18 +1997,19 @@ process_multi_fsb_dir(
 			}
 			iocur_top->need_crc = 1;
 write:
-			ret = write_buf(iocur_top);
+			if (write_buf(iocur_top))
+				rval = 0;
 out_pop:
 			pop_cur();
 			mfsb_map.nmaps = 0;
-			if (ret)
+			if (!rval)
 				break;
 		}
 		c -= bm_len;
 		s += bm_len;
 	}
 
-	return ret;
+	return rval;
 }
 
 static bool
@@ -2039,15 +2039,15 @@ process_multi_fsb_objects(
 		return process_symlink_block(o, s, c, btype, last);
 	default:
 		print_warning("bad type for multi-fsb object %d", btype);
-		return -EINVAL;
+		return 1;
 	}
 }
 
 /* inode copy routines */
 static int
 process_bmbt_reclist(
-	xfs_bmbt_rec_t 		*rp,
-	int 			numrecs,
+	xfs_bmbt_rec_t		*rp,
+	int			numrecs,
 	typnm_t			btype)
 {
 	int			i;
@@ -2059,7 +2059,7 @@ process_bmbt_reclist(
 	xfs_agnumber_t		agno;
 	xfs_agblock_t		agbno;
 	bool			is_multi_fsb = is_multi_fsb_object(mp, btype);
-	int			error;
+	int			rval = 1;
 
 	if (btype == TYP_DATA)
 		return 1;
@@ -2123,16 +2123,16 @@ process_bmbt_reclist(
 
 		/* multi-extent blocks require special handling */
 		if (is_multi_fsb)
-			error = process_multi_fsb_objects(o, s, c, btype,
+			rval = process_multi_fsb_objects(o, s, c, btype,
 					last);
 		else
-			error = process_single_fsb_objects(o, s, c, btype,
+			rval = process_single_fsb_objects(o, s, c, btype,
 					last);
-		if (error)
-			return 0;
+		if (!rval)
+			break;
 	}
 
-	return 1;
+	return rval;
 }
 
 static int
@@ -2331,7 +2331,7 @@ process_inode_data(
 	return 1;
 }
 
-static int
+static void
 process_dev_inode(
 	xfs_dinode_t		*dip)
 {
@@ -2339,15 +2339,13 @@ process_dev_inode(
 		if (show_warnings)
 			print_warning("inode %llu has unexpected extents",
 				      (unsigned long long)cur_ino);
-		return 0;
-	} else {
-		if (zero_stale_data) {
-			unsigned int	size = sizeof(xfs_dev_t);
+		return;
+	}
+	if (zero_stale_data) {
+		unsigned int	size = sizeof(xfs_dev_t);
 
-			memset(XFS_DFORK_DPTR(dip) + size, 0,
-					XFS_DFORK_DSIZE(dip, mp) - size);
-		}
-		return 1;
+		memset(XFS_DFORK_DPTR(dip) + size, 0,
+				XFS_DFORK_DSIZE(dip, mp) - size);
 	}
 }
 
@@ -2365,11 +2363,10 @@ process_inode(
 	xfs_dinode_t 		*dip,
 	bool			free_inode)
 {
-	int			success;
+	int			rval = 1;
 	bool			crc_was_ok = false; /* no recalc by default */
 	bool			need_new_crc = false;
 
-	success = 1;
 	cur_ino = XFS_AGINO_TO_INO(mp, agno, agino);
 
 	/* we only care about crc recalculation if we will modify the inode. */
@@ -2390,32 +2387,34 @@ process_inode(
 	/* copy appropriate data fork metadata */
 	switch (be16_to_cpu(dip->di_mode) & S_IFMT) {
 		case S_IFDIR:
-			success = process_inode_data(dip, TYP_DIR2);
+			rval = process_inode_data(dip, TYP_DIR2);
 			if (dip->di_format == XFS_DINODE_FMT_LOCAL)
 				need_new_crc = 1;
 			break;
 		case S_IFLNK:
-			success = process_inode_data(dip, TYP_SYMLINK);
+			rval = process_inode_data(dip, TYP_SYMLINK);
 			if (dip->di_format == XFS_DINODE_FMT_LOCAL)
 				need_new_crc = 1;
 			break;
 		case S_IFREG:
-			success = process_inode_data(dip, TYP_DATA);
+			rval = process_inode_data(dip, TYP_DATA);
 			break;
 		case S_IFIFO:
 		case S_IFCHR:
 		case S_IFBLK:
 		case S_IFSOCK:
-			success = process_dev_inode(dip);
+			process_dev_inode(dip);
 			need_new_crc = 1;
 			break;
 		default:
 			break;
 	}
 	nametable_clear();
+	if (!rval)
+		goto done;
 
 	/* copy extended attributes if they exist and forkoff is valid */
-	if (success && XFS_DFORK_DSIZE(dip, mp) < XFS_LITINO(mp)) {
+	if (XFS_DFORK_DSIZE(dip, mp) < XFS_LITINO(mp)) {
 		attr_data.remote_val_count = 0;
 		switch (dip->di_aformat) {
 			case XFS_DINODE_FMT_LOCAL:
@@ -2425,11 +2424,11 @@ process_inode(
 				break;
 
 			case XFS_DINODE_FMT_EXTENTS:
-				success = process_exinode(dip, TYP_ATTR);
+				rval = process_exinode(dip, TYP_ATTR);
 				break;
 
 			case XFS_DINODE_FMT_BTREE:
-				success = process_btinode(dip, TYP_ATTR);
+				rval = process_btinode(dip, TYP_ATTR);
 				break;
 		}
 		nametable_clear();
@@ -2442,7 +2441,8 @@ done:
 
 	if (crc_was_ok && need_new_crc)
 		libxfs_dinode_calc_crc(mp, dip);
-	return success;
+
+	return rval;
 }
 
 static uint32_t	inodes_copied;
@@ -2541,7 +2541,7 @@ copy_inode_chunk(
 
 			/* process_inode handles free inodes, too */
 			if (!process_inode(agno, agino + ioff + i, dip,
-			    XFS_INOBT_IS_FREE_DISK(rp, ioff + i)))
+					XFS_INOBT_IS_FREE_DISK(rp, ioff + i)))
 				goto pop_out;
 
 			inodes_copied++;
@@ -2800,7 +2800,7 @@ copy_ino(
 	xfs_agblock_t		agbno;
 	xfs_agino_t		agino;
 	int			offset;
-	int			rval = 0;
+	int			rval = 1;
 
 	if (ino == 0 || ino == NULLFSINO)
 		return 1;
Signature · 1 line
2.35.1
Reviewed-by on v1 1/4
#2 lore raw

Re: [PATCH 1/4] metadump: handle corruption errors without aborting

Quoted 19 lines · Dave Chinner

From: Dave Chinner <[email protected]>

Sean Caron reported that a metadump terminated after givin gthis warning:

xfs_metadump: inode 2216156864 has unexpected extents

Metadump is supposed to ignore corruptions and continue dumping the filesystem as best it can. Whilst it warns about many situations where it can't fully dump structures, it should stop processing that structure and continue with the next one until the entire filesystem has been processed.

Unfortunately, some warning conditions also return an "abort" error status, causing metadump to abort if that condition is hit. Most of these abort conditions should really be "continue on next object" conditions so that the we attempt to dump the rest of the filesystem.

Quoted 6 lines

Fix the returns for warnings that incorrectly cause aborts such that the only abort conditions are read errors when "stop-on-read-error" semantics are specified. Also make the return values consistently mean abort/continue rather than returning -errno to mean "stop because read error" and then trying to infer what the error means in callers without the context it occurred in.

I was almost about to say "This variable should be named success", but then noticed that there already /are/ variables named success. Yuck.

rval==0 means abort? and rval!=0 means continue? If so,

--D

Quoted 305 lines
---
 db/metadump.c | 94 +++++++++++++++++++++++++--------------------------
 1 file changed, 47 insertions(+), 47 deletions(-)
db/metadump.c +47 -47
index 48cda88a3ea5..a21baa2070d9 100644
@@ -1645,7 +1645,7 @@ process_symlink_block(
 {
 	struct bbmap	map;
 	char		*link;
-	int		ret = 0;
+	int		rval = 1;
 
 	push_cur();
 	map.nmaps = 1;
@@ -1658,8 +1658,7 @@ process_symlink_block(
 
 		print_warning("cannot read %s block %u/%u (%llu)",
 				typtab[btype].name, agno, agbno, s);
-		if (stop_on_read_error)
-			ret = -1;
+		rval = !stop_on_read_error;
 		goto out_pop;
 	}
 	link = iocur_top->data;
@@ -1682,10 +1681,11 @@ process_symlink_block(
 	}
 
 	iocur_top->need_crc = 1;
-	ret = write_buf(iocur_top);
+	if (write_buf(iocur_top))
+		rval = 0;
 out_pop:
 	pop_cur();
-	return ret;
+	return rval;
 }
 
 #define MAX_REMOTE_VALS		4095
@@ -1843,8 +1843,8 @@ process_single_fsb_objects(
 	typnm_t		btype,
 	xfs_fileoff_t	last)
 {
+	int		rval = 1;
 	char		*dp;
-	int		ret = 0;
 	int		i;
 
 	for (i = 0; i < c; i++) {
@@ -1858,8 +1858,7 @@ process_single_fsb_objects(
 
 			print_warning("cannot read %s block %u/%u (%llu)",
 					typtab[btype].name, agno, agbno, s);
-			if (stop_on_read_error)
-				ret = -EIO;
+			rval = !stop_on_read_error;
 			goto out_pop;
 
 		}
@@ -1925,16 +1924,17 @@ process_single_fsb_objects(
 		}
 
 write:
-		ret = write_buf(iocur_top);
+		if (write_buf(iocur_top))
+			rval = 0;
 out_pop:
 		pop_cur();
-		if (ret)
+		if (!rval)
 			break;
 		o++;
 		s++;
 	}
 
-	return ret;
+	return rval;
 }
 
 /*
@@ -1952,7 +1952,7 @@ process_multi_fsb_dir(
 	xfs_fileoff_t	last)
 {
 	char		*dp;
-	int		ret = 0;
+	int		rval = 1;
 
 	while (c > 0) {
 		unsigned int	bm_len;
@@ -1978,8 +1978,7 @@ process_multi_fsb_dir(
 
 				print_warning("cannot read %s block %u/%u (%llu)",
 						typtab[btype].name, agno, agbno, s);
-				if (stop_on_read_error)
-					ret = -1;
+				rval = !stop_on_read_error;
 				goto out_pop;
 
 			}
@@ -1998,18 +1997,19 @@ process_multi_fsb_dir(
 			}
 			iocur_top->need_crc = 1;
 write:
-			ret = write_buf(iocur_top);
+			if (write_buf(iocur_top))
+				rval = 0;
 out_pop:
 			pop_cur();
 			mfsb_map.nmaps = 0;
-			if (ret)
+			if (!rval)
 				break;
 		}
 		c -= bm_len;
 		s += bm_len;
 	}
 
-	return ret;
+	return rval;
 }
 
 static bool
@@ -2039,15 +2039,15 @@ process_multi_fsb_objects(
 		return process_symlink_block(o, s, c, btype, last);
 	default:
 		print_warning("bad type for multi-fsb object %d", btype);
-		return -EINVAL;
+		return 1;
 	}
 }
 
 /* inode copy routines */
 static int
 process_bmbt_reclist(
-	xfs_bmbt_rec_t 		*rp,
-	int 			numrecs,
+	xfs_bmbt_rec_t		*rp,
+	int			numrecs,
 	typnm_t			btype)
 {
 	int			i;
@@ -2059,7 +2059,7 @@ process_bmbt_reclist(
 	xfs_agnumber_t		agno;
 	xfs_agblock_t		agbno;
 	bool			is_multi_fsb = is_multi_fsb_object(mp, btype);
-	int			error;
+	int			rval = 1;
 
 	if (btype == TYP_DATA)
 		return 1;
@@ -2123,16 +2123,16 @@ process_bmbt_reclist(
 
 		/* multi-extent blocks require special handling */
 		if (is_multi_fsb)
-			error = process_multi_fsb_objects(o, s, c, btype,
+			rval = process_multi_fsb_objects(o, s, c, btype,
 					last);
 		else
-			error = process_single_fsb_objects(o, s, c, btype,
+			rval = process_single_fsb_objects(o, s, c, btype,
 					last);
-		if (error)
-			return 0;
+		if (!rval)
+			break;
 	}
 
-	return 1;
+	return rval;
 }
 
 static int
@@ -2331,7 +2331,7 @@ process_inode_data(
 	return 1;
 }
 
-static int
+static void
 process_dev_inode(
 	xfs_dinode_t		*dip)
 {
@@ -2339,15 +2339,13 @@ process_dev_inode(
 		if (show_warnings)
 			print_warning("inode %llu has unexpected extents",
 				      (unsigned long long)cur_ino);
-		return 0;
-	} else {
-		if (zero_stale_data) {
-			unsigned int	size = sizeof(xfs_dev_t);
+		return;
+	}
+	if (zero_stale_data) {
+		unsigned int	size = sizeof(xfs_dev_t);
 
-			memset(XFS_DFORK_DPTR(dip) + size, 0,
-					XFS_DFORK_DSIZE(dip, mp) - size);
-		}
-		return 1;
+		memset(XFS_DFORK_DPTR(dip) + size, 0,
+				XFS_DFORK_DSIZE(dip, mp) - size);
 	}
 }
 
@@ -2365,11 +2363,10 @@ process_inode(
 	xfs_dinode_t 		*dip,
 	bool			free_inode)
 {
-	int			success;
+	int			rval = 1;
 	bool			crc_was_ok = false; /* no recalc by default */
 	bool			need_new_crc = false;
 
-	success = 1;
 	cur_ino = XFS_AGINO_TO_INO(mp, agno, agino);
 
 	/* we only care about crc recalculation if we will modify the inode. */
@@ -2390,32 +2387,34 @@ process_inode(
 	/* copy appropriate data fork metadata */
 	switch (be16_to_cpu(dip->di_mode) & S_IFMT) {
 		case S_IFDIR:
-			success = process_inode_data(dip, TYP_DIR2);
+			rval = process_inode_data(dip, TYP_DIR2);
 			if (dip->di_format == XFS_DINODE_FMT_LOCAL)
 				need_new_crc = 1;
 			break;
 		case S_IFLNK:
-			success = process_inode_data(dip, TYP_SYMLINK);
+			rval = process_inode_data(dip, TYP_SYMLINK);
 			if (dip->di_format == XFS_DINODE_FMT_LOCAL)
 				need_new_crc = 1;
 			break;
 		case S_IFREG:
-			success = process_inode_data(dip, TYP_DATA);
+			rval = process_inode_data(dip, TYP_DATA);
 			break;
 		case S_IFIFO:
 		case S_IFCHR:
 		case S_IFBLK:
 		case S_IFSOCK:
-			success = process_dev_inode(dip);
+			process_dev_inode(dip);
 			need_new_crc = 1;
 			break;
 		default:
 			break;
 	}
 	nametable_clear();
+	if (!rval)
+		goto done;
 
 	/* copy extended attributes if they exist and forkoff is valid */
-	if (success && XFS_DFORK_DSIZE(dip, mp) < XFS_LITINO(mp)) {
+	if (XFS_DFORK_DSIZE(dip, mp) < XFS_LITINO(mp)) {
 		attr_data.remote_val_count = 0;
 		switch (dip->di_aformat) {
 			case XFS_DINODE_FMT_LOCAL:
@@ -2425,11 +2424,11 @@ process_inode(
 				break;
 
 			case XFS_DINODE_FMT_EXTENTS:
-				success = process_exinode(dip, TYP_ATTR);
+				rval = process_exinode(dip, TYP_ATTR);
 				break;
 
 			case XFS_DINODE_FMT_BTREE:
-				success = process_btinode(dip, TYP_ATTR);
+				rval = process_btinode(dip, TYP_ATTR);
 				break;
 		}
 		nametable_clear();
@@ -2442,7 +2441,8 @@ done:
 
 	if (crc_was_ok && need_new_crc)
 		libxfs_dinode_calc_crc(mp, dip);
-	return success;
+
+	return rval;
 }
 
 static uint32_t	inodes_copied;
@@ -2541,7 +2541,7 @@ copy_inode_chunk(
 
 			/* process_inode handles free inodes, too */
 			if (!process_inode(agno, agino + ioff + i, dip,
-			    XFS_INOBT_IS_FREE_DISK(rp, ioff + i)))
+					XFS_INOBT_IS_FREE_DISK(rp, ioff + i)))
 				goto pop_out;
 
 			inodes_copied++;
@@ -2800,7 +2800,7 @@ copy_ino(
 	xfs_agblock_t		agbno;
 	xfs_agino_t		agino;
 	int			offset;
-	int			rval = 0;
+	int			rval = 1;
 
 	if (ino == 0 || ino == NULLFSINO)
 		return 1;
Signature · 1 line
2.35.1
#3 lore raw

Re: [PATCH 1/4] metadump: handle corruption errors without aborting

Quoted 27 lines · Darrick J. Wong
Quoted 19 lines · Dave Chinner

From: Dave Chinner <[email protected]>

Sean Caron reported that a metadump terminated after givin gthis warning:

xfs_metadump: inode 2216156864 has unexpected extents

Metadump is supposed to ignore corruptions and continue dumping the filesystem as best it can. Whilst it warns about many situations where it can't fully dump structures, it should stop processing that structure and continue with the next one until the entire filesystem has been processed.

Unfortunately, some warning conditions also return an "abort" error status, causing metadump to abort if that condition is hit. Most of these abort conditions should really be "continue on next object" conditions so that the we attempt to dump the rest of the filesystem.

Quoted 6 lines

Fix the returns for warnings that incorrectly cause aborts such that the only abort conditions are read errors when "stop-on-read-error" semantics are specified. Also make the return values consistently mean abort/continue rather than returning -errno to mean "stop because read error" and then trying to infer what the error means in callers without the context it occurred in.

Quoted 2 lines

I was almost about to say "This variable should be named success", but then noticed that there already /are/ variables named success. Yuck.

Yeah, mess.

Quoted 1 line

rval==0 means abort? and rval!=0 means continue? If so,

Same as it was before.

Quoted 1 line

Ta.

-Dave.

Signature · 2 lines
Dave Chinner
[email protected]
#4 lore raw

PATCH 2/4 metadump: be careful zeroing corrupt inode forks

In reply to Dave Chinner

From: Dave Chinner <[email protected]>

When a corrupt inode fork is encountered, we can zero beyond the end of the inode if the fork pointers are sufficiently trashed. We should not trust the fork pointers when corruption is detected and skip the zeroing in this case. We want metadump to capture the corruption and so skipping the zeroing will give us the best chance of preserving the corruption in a meaningful state for diagnosis.

---
 db/metadump.c | 49 +++++++++++++++++++++++++++++++++++++++----------
 1 file changed, 39 insertions(+), 10 deletions(-)
db/metadump.c +39 -10
index a21baa2070d9..3948d36e4d5c 100644
@@ -2308,18 +2308,34 @@ process_inode_data(
 {
 	switch (dip->di_format) {
 		case XFS_DINODE_FMT_LOCAL:
-			if (obfuscate || zero_stale_data)
-				switch (itype) {
-					case TYP_DIR2:
-						process_sf_dir(dip);
-						break;
+			if (!(obfuscate || zero_stale_data))
+				break;
+
+			/*
+			 * If the fork size is invalid, we can't safely do
+			 * anything with this fork. Leave it alone to preserve
+			 * the information for diagnostic purposes.
+			 */
+			if (XFS_DFORK_DSIZE(dip, mp) > XFS_LITINO(mp)) {
+				print_warning(
+"Invalid data fork size (%d) in inode %llu, preserving contents!",
+						XFS_DFORK_DSIZE(dip, mp),
+						(long long)cur_ino);
+				break;
+			}
 
-					case TYP_SYMLINK:
-						process_sf_symlink(dip);
-						break;
+			switch (itype) {
+				case TYP_DIR2:
+					process_sf_dir(dip);
+					break;
 
-					default: ;
-				}
+				case TYP_SYMLINK:
+					process_sf_symlink(dip);
+					break;
+
+				default:
+					break;
+			}
 			break;
 
 		case XFS_DINODE_FMT_EXTENTS:
@@ -2341,6 +2357,19 @@ process_dev_inode(
 				      (unsigned long long)cur_ino);
 		return;
 	}
+
+	/*
+	 * If the fork size is invalid, we can't safely do anything with
+	 * this fork. Leave it alone to preserve the information for diagnostic
+	 * purposes.
+	 */
+	if (XFS_DFORK_DSIZE(dip, mp) > XFS_LITINO(mp)) {
+		print_warning(
+"Invalid data fork size (%d) in inode %llu, preserving contents!",
+				XFS_DFORK_DSIZE(dip, mp), (long long)cur_ino);
+		return;
+	}
+
 	if (zero_stale_data) {
 		unsigned int	size = sizeof(xfs_dev_t);
 
Signature · 1 line
2.35.1
Reviewed-by on v1 2/4
#5 lore raw

Re: [PATCH 2/4] metadump: be careful zeroing corrupt inode forks

Quoted 11 lines · Dave Chinner

From: Dave Chinner <[email protected]>

When a corrupt inode fork is encountered, we can zero beyond the end of the inode if the fork pointers are sufficiently trashed. We should not trust the fork pointers when corruption is detected and skip the zeroing in this case. We want metadump to capture the corruption and so skipping the zeroing will give us the best chance of preserving the corruption in a meaningful state for diagnosis.

Hmm. I /think/ the only real change here is the addition of the DFORK_DSIZE > LITINO warning, right? The rest is just reindenting the loop body?

If so, LGTM.

--D

Quoted 76 lines
---
 db/metadump.c | 49 +++++++++++++++++++++++++++++++++++++++----------
 1 file changed, 39 insertions(+), 10 deletions(-)
db/metadump.c +39 -10
index a21baa2070d9..3948d36e4d5c 100644
@@ -2308,18 +2308,34 @@ process_inode_data(
 {
 	switch (dip->di_format) {
 		case XFS_DINODE_FMT_LOCAL:
-			if (obfuscate || zero_stale_data)
-				switch (itype) {
-					case TYP_DIR2:
-						process_sf_dir(dip);
-						break;
+			if (!(obfuscate || zero_stale_data))
+				break;
+
+			/*
+			 * If the fork size is invalid, we can't safely do
+			 * anything with this fork. Leave it alone to preserve
+			 * the information for diagnostic purposes.
+			 */
+			if (XFS_DFORK_DSIZE(dip, mp) > XFS_LITINO(mp)) {
+				print_warning(
+"Invalid data fork size (%d) in inode %llu, preserving contents!",
+						XFS_DFORK_DSIZE(dip, mp),
+						(long long)cur_ino);
+				break;
+			}
 
-					case TYP_SYMLINK:
-						process_sf_symlink(dip);
-						break;
+			switch (itype) {
+				case TYP_DIR2:
+					process_sf_dir(dip);
+					break;
 
-					default: ;
-				}
+				case TYP_SYMLINK:
+					process_sf_symlink(dip);
+					break;
+
+				default:
+					break;
+			}
 			break;
 
 		case XFS_DINODE_FMT_EXTENTS:
@@ -2341,6 +2357,19 @@ process_dev_inode(
 				      (unsigned long long)cur_ino);
 		return;
 	}
+
+	/*
+	 * If the fork size is invalid, we can't safely do anything with
+	 * this fork. Leave it alone to preserve the information for diagnostic
+	 * purposes.
+	 */
+	if (XFS_DFORK_DSIZE(dip, mp) > XFS_LITINO(mp)) {
+		print_warning(
+"Invalid data fork size (%d) in inode %llu, preserving contents!",
+				XFS_DFORK_DSIZE(dip, mp), (long long)cur_ino);
+		return;
+	}
+
 	if (zero_stale_data) {
 		unsigned int	size = sizeof(xfs_dev_t);
 
Signature · 1 line
2.35.1
#6 lore raw

Re: [PATCH 2/4] metadump: be careful zeroing corrupt inode forks

Quoted 10 lines · Darrick J. Wong
Quoted 9 lines · Dave Chinner

From: Dave Chinner <[email protected]>

When a corrupt inode fork is encountered, we can zero beyond the end of the inode if the fork pointers are sufficiently trashed. We should not trust the fork pointers when corruption is detected and skip the zeroing in this case. We want metadump to capture the corruption and so skipping the zeroing will give us the best chance of preserving the corruption in a meaningful state for diagnosis.

Quoted 6 lines
Quoted 2 lines

Hmm. I /think/ the only real change here is the addition of the DFORK_DSIZE > LITINO warning, right? The rest is just reindenting the loop body?

Yes.

Quoted 2 lines

If so, LGTM.

Thanks!

-Dave.

Signature · 2 lines
Dave Chinner
[email protected]
#7 lore raw

PATCH 3/4 xfs_io: add a quiet option to bulkstat

In reply to Dave Chinner

From: Dave Chinner <[email protected]>

This is purely for driving the kernel bulkstat operations as hard as userspace can drive them - we don't care about the actual output, just want to drive maximum IO rates through the inode cache.

Bulkstat at 3.4 million inodes a second via xfs_io currently burns about 30% of CPU time just formatting and outputting the stat information to stdout and dumping it to /dev/null.

wall time rate IOPS bandwidth
unpatched 17.823s 3.4M/s 70k 1.9GB/s
with -q 15.682 6.1M/s 150k 3.5GB/s

The disks are at about 30% of max bandwidth and only at 70kiops, so this CPU can be used to drive the kernel and IO subsystem harder.

Wall time doesn't really go down on this specific test because the increase in inode cache turn-over (about 10GB/s of cached metadata (in-core inodes and buffers) is being cycled through memory on a machine with 16GB of RAM) and that hammers memory reclaim into a utter mess that often takes seconds for it to recover from...

---
 io/bulkstat.c     | 9 ++++++++-
 man/man8/xfs_io.8 | 6 +++++-
 2 files changed, 13 insertions(+), 2 deletions(-)
io/bulkstat.c +8 -1
index 201470b29223..411942006591 100644
@@ -67,6 +67,7 @@ bulkstat_help(void)
 "\n"
 "   -a <agno>  Only iterate this AG.\n"
 "   -d         Print debugging output.\n"
+"   -q         Be quiet, no output.\n"
 "   -e <ino>   Stop after this inode.\n"
 "   -n <nr>    Ask for this many results at once.\n"
 "   -s <ino>   Inode to start with.\n"
@@ -104,11 +105,12 @@ bulkstat_f(
 	uint32_t		ver = 0;
 	bool			has_agno = false;
 	bool			debug = false;
+	bool			quiet = false;
 	unsigned int		i;
 	int			c;
 	int			ret;
 
-	while ((c = getopt(argc, argv, "a:de:n:s:v:")) != -1) {
+	while ((c = getopt(argc, argv, "a:de:n:qs:v:")) != -1) {
 		switch (c) {
 		case 'a':
 			agno = cvt_u32(optarg, 10);
@@ -135,6 +137,9 @@ bulkstat_f(
 				return 1;
 			}
 			break;
+		case 'q':
+			quiet = true;
+			break;
 		case 's':
 			startino = cvt_u64(optarg, 10);
 			if (errno) {
@@ -198,6 +203,8 @@ _("bulkstat: startino=%lld flags=0x%x agno=%u ret=%d icount=%u ocount=%u\n"),
 		for (i = 0; i < breq->hdr.ocount; i++) {
 			if (breq->bulkstat[i].bs_ino > endino)
 				break;
+			if (quiet)
+				continue;
 			dump_bulkstat(&breq->bulkstat[i]);
 		}
 	}
man/man8/xfs_io.8 +5 -1
index e3c5d3ea99dd..d876490bf65d 100644
@@ -1143,7 +1143,7 @@ for the current memory mapping.
 
 .SH FILESYSTEM COMMANDS
 .TP
-.BI "bulkstat [ \-a " agno " ] [ \-d ] [ \-e " endino " ] [ \-n " batchsize " ] [ \-s " startino " ] [ \-v " version" ]
+.BI "bulkstat [ \-a " agno " ] [ \-d ] [ \-e " endino " ] [ \-n " batchsize " ] [ \-q ] [ \-s " startino " ] [ \-v " version" ]
 Display raw stat information about a bunch of inodes in an XFS filesystem.
 Options are as follows:
 .RS 1.0i
@@ -1164,6 +1164,10 @@ Defaults to stopping when the system call stops returning results.
 Retrieve at most this many records per call.
 Defaults to 4,096.
 .TP
+.BI \-q
+Run quietly.
+Does not parse or output retrieved bulkstat information.
+.TP
 .BI \-s " startino"
 Display inode allocation records starting with this inode.
 Defaults to the first inode in the filesystem.
Signature · 1 line
2.35.1
Reviewed-by on v1 3/4
#8 lore raw

Re: [PATCH 3/4] xfs_io: add a quiet option to bulkstat

Quoted 17 lines · Dave Chinner

From: Dave Chinner <[email protected]>

This is purely for driving the kernel bulkstat operations as hard as userspace can drive them - we don't care about the actual output, just want to drive maximum IO rates through the inode cache.

Bulkstat at 3.4 million inodes a second via xfs_io currently burns about 30% of CPU time just formatting and outputting the stat information to stdout and dumping it to /dev/null.

wall time rate IOPS bandwidth
unpatched 17.823s 3.4M/s 70k 1.9GB/s
with -q 15.682 6.1M/s 150k 3.5GB/s

The disks are at about 30% of max bandwidth and only at 70kiops, so this CPU can be used to drive the kernel and IO subsystem harder.

Quoted 7 lines

Wall time doesn't really go down on this specific test because the increase in inode cache turn-over (about 10GB/s of cached metadata (in-core inodes and buffers) is being cycled through memory on a machine with 16GB of RAM) and that hammers memory reclaim into a utter mess that often takes seconds for it to recover from...

Heh, moar bulkstat.

--D

Quoted 77 lines
---
 io/bulkstat.c     | 9 ++++++++-
 man/man8/xfs_io.8 | 6 +++++-
 2 files changed, 13 insertions(+), 2 deletions(-)
io/bulkstat.c +8 -1
index 201470b29223..411942006591 100644
@@ -67,6 +67,7 @@ bulkstat_help(void)
 "\n"
 "   -a <agno>  Only iterate this AG.\n"
 "   -d         Print debugging output.\n"
+"   -q         Be quiet, no output.\n"
 "   -e <ino>   Stop after this inode.\n"
 "   -n <nr>    Ask for this many results at once.\n"
 "   -s <ino>   Inode to start with.\n"
@@ -104,11 +105,12 @@ bulkstat_f(
 	uint32_t		ver = 0;
 	bool			has_agno = false;
 	bool			debug = false;
+	bool			quiet = false;
 	unsigned int		i;
 	int			c;
 	int			ret;
 
-	while ((c = getopt(argc, argv, "a:de:n:s:v:")) != -1) {
+	while ((c = getopt(argc, argv, "a:de:n:qs:v:")) != -1) {
 		switch (c) {
 		case 'a':
 			agno = cvt_u32(optarg, 10);
@@ -135,6 +137,9 @@ bulkstat_f(
 				return 1;
 			}
 			break;
+		case 'q':
+			quiet = true;
+			break;
 		case 's':
 			startino = cvt_u64(optarg, 10);
 			if (errno) {
@@ -198,6 +203,8 @@ _("bulkstat: startino=%lld flags=0x%x agno=%u ret=%d icount=%u ocount=%u\n"),
 		for (i = 0; i < breq->hdr.ocount; i++) {
 			if (breq->bulkstat[i].bs_ino > endino)
 				break;
+			if (quiet)
+				continue;
 			dump_bulkstat(&breq->bulkstat[i]);
 		}
 	}
man/man8/xfs_io.8 +5 -1
index e3c5d3ea99dd..d876490bf65d 100644
@@ -1143,7 +1143,7 @@ for the current memory mapping.
 
 .SH FILESYSTEM COMMANDS
 .TP
-.BI "bulkstat [ \-a " agno " ] [ \-d ] [ \-e " endino " ] [ \-n " batchsize " ] [ \-s " startino " ] [ \-v " version" ]
+.BI "bulkstat [ \-a " agno " ] [ \-d ] [ \-e " endino " ] [ \-n " batchsize " ] [ \-q ] [ \-s " startino " ] [ \-v " version" ]
 Display raw stat information about a bunch of inodes in an XFS filesystem.
 Options are as follows:
 .RS 1.0i
@@ -1164,6 +1164,10 @@ Defaults to stopping when the system call stops returning results.
 Retrieve at most this many records per call.
 Defaults to 4,096.
 .TP
+.BI \-q
+Run quietly.
+Does not parse or output retrieved bulkstat information.
+.TP
 .BI \-s " startino"
 Display inode allocation records starting with this inode.
 Defaults to the first inode in the filesystem.
Signature · 1 line
2.35.1
#9 lore raw

PATCH 4/4 xfsprogs: autoconf modernisation

In reply to Dave Chinner

From: Dave Chinner <[email protected]>

Because apparently AC_TRY_COMPILE and AC_TRY_LINK has been deprecated and made obsolete.

.....
configure.ac:164: warning: The macro `AC_TRY_COMPILE' is obsolete. configure.ac:164: You should run autoupdate. ./lib/autoconf/general.m4:2847: AC_TRY_COMPILE is expanded from... m4/package_libcdev.m4:68: AC_HAVE_GETMNTENT is expanded from... configure.ac:164: the top level
configure.ac:165: warning: The macro `AC_TRY_LINK' is obsolete. configure.ac:165: You should run autoupdate. ./lib/autoconf/general.m4:2920: AC_TRY_LINK is expanded from... m4/package_libcdev.m4:84: AC_HAVE_FALLOCATE is expanded from... configure.ac:165: the top level
.....

But "autoupdate" does nothing to fix this, so I have to manually do these conversions:

- AC_TRY_COMPILE -> AC_COMPILE_IFELSE
- AC_TRY_LINK -> AC_LINK_IFELSE

because I have nothing better to do than fix currently working code.

Also, running autoupdate forces the minimum pre-req to be autoconf 2.71 because it replaces other stuff...

---
 configure.ac          |   8 +--
 m4/package_attr.m4    |   8 ++-
 m4/package_libcdev.m4 | 158 ++++++++++++++++++++++++++----------------
 m4/package_types.m4   |   8 ++-
 m4/package_urcu.m4    |  18 +++--
 5 files changed, 123 insertions(+), 77 deletions(-)
configure.ac +4 -4
index 4278145fe74b..36e42394a9df 100644
@@ -1,13 +1,13 @@
-AC_INIT([xfsprogs], [5.15.0], [[email protected]])
-AC_PREREQ(2.50)
+AC_INIT([xfsprogs],[5.15.0],[[email protected]])
+AC_PREREQ([2.71])
 AC_CONFIG_AUX_DIR([.])
 AC_CONFIG_MACRO_DIR([m4])
 AC_CONFIG_SRCDIR([include/libxfs.h])
-AC_CONFIG_HEADER(include/platform_defs.h)
+AC_CONFIG_HEADERS([include/platform_defs.h])
 AC_PREFIX_DEFAULT(/usr)
 
 AC_PROG_INSTALL
-AC_PROG_LIBTOOL
+LT_INIT
 
 AC_PROG_CC
 AC_ARG_VAR(BUILD_CC, [C compiler for build tools])
m4/package_attr.m4 +5 -3
index 432492311d18..05e02b38fb5a 100644
@@ -8,15 +8,17 @@ AC_DEFUN([AC_PACKAGE_WANT_ATTRIBUTES_H],
 #
 AC_DEFUN([AC_HAVE_LIBATTR],
   [ AC_MSG_CHECKING([for struct attrlist_cursor])
-    AC_TRY_COMPILE([
+    AC_COMPILE_IFELSE(
+    [	AC_LANG_PROGRAM([[
 #include <sys/types.h>
 #include <attr/attributes.h>
-       ], [
+	]], [[
 struct attrlist_cursor *cur;
 struct attrlist *list;
 struct attrlist_ent *ent;
 int flags = ATTR_ROOT;
-       ], have_libattr=yes
+	]])
+    ], have_libattr=yes
           AC_MSG_RESULT(yes),
           AC_MSG_RESULT(no))
     AC_SUBST(have_libattr)
m4/package_libcdev.m4 +98 -60

304 lines not on this page · raw message

m4/package_types.m4 +5 -3
index 1c35839319d6..6e817a310f79 100644
@@ -4,9 +4,11 @@
 AH_TEMPLATE([HAVE_UMODE_T], [Whether you have umode_t])
 AC_DEFUN([AC_TYPE_UMODE_T],
   [ AC_MSG_CHECKING([for umode_t])
-    AC_TRY_COMPILE([
+    AC_COMPILE_IFELSE(
+    [	AC_LANG_PROGRAM([[
 #include <asm/types.h>
-    ], [
-         umode_t umode;
+	]], [[
+umode_t umode;
+	]])
     ], AC_DEFINE(HAVE_UMODE_T) AC_MSG_RESULT(yes) , AC_MSG_RESULT(no))
   ])
m4/package_urcu.m4 +11 -7
index f8e798b66136..ef116e0cda76 100644
@@ -10,11 +10,13 @@ AC_DEFUN([AC_PACKAGE_NEED_URCU_H],
 
 AC_DEFUN([AC_PACKAGE_NEED_RCU_INIT],
   [ AC_MSG_CHECKING([for liburcu])
-    AC_TRY_COMPILE([
+    AC_COMPILE_IFELSE(
+    [	AC_LANG_PROGRAM([[
 #define _GNU_SOURCE
 #include <urcu.h>
-    ], [
-       rcu_init();
+	]], [[
+rcu_init();
+	]])
     ], liburcu=-lurcu
        AC_MSG_RESULT(yes),
        AC_MSG_RESULT(no))
@@ -28,12 +30,14 @@ AC_DEFUN([AC_PACKAGE_NEED_RCU_INIT],
 #
 AC_DEFUN([AC_HAVE_LIBURCU_ATOMIC64],
   [ AC_MSG_CHECKING([for atomic64_t support in liburcu])
-    AC_TRY_LINK([
+    AC_LINK_IFELSE(
+    [	AC_LANG_PROGRAM([[
 #define _GNU_SOURCE
 #include <urcu.h>
-    ], [
-       long long f = 3;
-       uatomic_inc(&f);
+	]], [[
+long long f = 3;
+uatomic_inc(&f);
+	]])
     ], have_liburcu_atomic64=yes
        AC_MSG_RESULT(yes),
        AC_MSG_RESULT(no))
Signature · 1 line
2.35.1
Reviewed-by on v1 4/4
#10 lore raw

Re: [PATCH 4/4] xfsprogs: autoconf modernisation

Quoted 24 lines · Dave Chinner

From: Dave Chinner <[email protected]>

Because apparently AC_TRY_COMPILE and AC_TRY_LINK has been deprecated and made obsolete.

.....
configure.ac:164: warning: The macro `AC_TRY_COMPILE' is obsolete. configure.ac:164: You should run autoupdate. ./lib/autoconf/general.m4:2847: AC_TRY_COMPILE is expanded from... m4/package_libcdev.m4:68: AC_HAVE_GETMNTENT is expanded from... configure.ac:164: the top level
configure.ac:165: warning: The macro `AC_TRY_LINK' is obsolete. configure.ac:165: You should run autoupdate. ./lib/autoconf/general.m4:2920: AC_TRY_LINK is expanded from... m4/package_libcdev.m4:84: AC_HAVE_FALLOCATE is expanded from... configure.ac:165: the top level
.....

But "autoupdate" does nothing to fix this, so I have to manually do these conversions:

- AC_TRY_COMPILE -> AC_COMPILE_IFELSE
- AC_TRY_LINK -> AC_LINK_IFELSE

Quoted 7 lines

because I have nothing better to do than fix currently working code.

Also, running autoupdate forces the minimum pre-req to be autoconf 2.71 because it replaces other stuff...

I hate autoconf, and this seems like stupid pedantry on their part...

--D

Quoted 443 lines
---
 configure.ac          |   8 +--
 m4/package_attr.m4    |   8 ++-
 m4/package_libcdev.m4 | 158 ++++++++++++++++++++++++++----------------
 m4/package_types.m4   |   8 ++-
 m4/package_urcu.m4    |  18 +++--
 5 files changed, 123 insertions(+), 77 deletions(-)
configure.ac +4 -4
index 4278145fe74b..36e42394a9df 100644
@@ -1,13 +1,13 @@
-AC_INIT([xfsprogs], [5.15.0], [[email protected]])
-AC_PREREQ(2.50)
+AC_INIT([xfsprogs],[5.15.0],[[email protected]])
+AC_PREREQ([2.71])
 AC_CONFIG_AUX_DIR([.])
 AC_CONFIG_MACRO_DIR([m4])
 AC_CONFIG_SRCDIR([include/libxfs.h])
-AC_CONFIG_HEADER(include/platform_defs.h)
+AC_CONFIG_HEADERS([include/platform_defs.h])
 AC_PREFIX_DEFAULT(/usr)
 
 AC_PROG_INSTALL
-AC_PROG_LIBTOOL
+LT_INIT
 
 AC_PROG_CC
 AC_ARG_VAR(BUILD_CC, [C compiler for build tools])
m4/package_attr.m4 +5 -3
index 432492311d18..05e02b38fb5a 100644
@@ -8,15 +8,17 @@ AC_DEFUN([AC_PACKAGE_WANT_ATTRIBUTES_H],
 #
 AC_DEFUN([AC_HAVE_LIBATTR],
   [ AC_MSG_CHECKING([for struct attrlist_cursor])
-    AC_TRY_COMPILE([
+    AC_COMPILE_IFELSE(
+    [	AC_LANG_PROGRAM([[
 #include <sys/types.h>
 #include <attr/attributes.h>
-       ], [
+	]], [[
 struct attrlist_cursor *cur;
 struct attrlist *list;
 struct attrlist_ent *ent;
 int flags = ATTR_ROOT;
-       ], have_libattr=yes
+	]])
+    ], have_libattr=yes
           AC_MSG_RESULT(yes),
           AC_MSG_RESULT(no))
     AC_SUBST(have_libattr)
m4/package_libcdev.m4 +98 -60
index adab9bb9773a..94d76c7b3a19 100644
@@ -3,11 +3,13 @@
 #
 AC_DEFUN([AC_HAVE_FADVISE],
   [ AC_MSG_CHECKING([for fadvise ])
-    AC_TRY_COMPILE([
+    AC_COMPILE_IFELSE(
+    [	AC_LANG_PROGRAM([[
 #define _GNU_SOURCE
 #include <fcntl.h>
-    ], [
-	posix_fadvise(0, 1, 0, POSIX_FADV_NORMAL);
+	]], [[
+posix_fadvise(0, 1, 0, POSIX_FADV_NORMAL);
+	]])
     ],	have_fadvise=yes
 	AC_MSG_RESULT(yes),
 	AC_MSG_RESULT(no))
@@ -19,11 +21,13 @@ AC_DEFUN([AC_HAVE_FADVISE],
 #
 AC_DEFUN([AC_HAVE_MADVISE],
   [ AC_MSG_CHECKING([for madvise ])
-    AC_TRY_COMPILE([
+    AC_COMPILE_IFELSE(
+    [	AC_LANG_PROGRAM([[
 #define _GNU_SOURCE
 #include <sys/mman.h>
-    ], [
-	posix_madvise(0, 0, MADV_NORMAL);
+	]], [[
+posix_madvise(0, 0, MADV_NORMAL);
+	]])
     ],	have_madvise=yes
 	AC_MSG_RESULT(yes),
 	AC_MSG_RESULT(no))
@@ -35,11 +39,13 @@ AC_DEFUN([AC_HAVE_MADVISE],
 #
 AC_DEFUN([AC_HAVE_MINCORE],
   [ AC_MSG_CHECKING([for mincore ])
-    AC_TRY_COMPILE([
+    AC_COMPILE_IFELSE(
+    [	AC_LANG_PROGRAM([[
 #define _GNU_SOURCE
 #include <sys/mman.h>
-    ], [
-	mincore(0, 0, 0);
+	]], [[
+mincore(0, 0, 0);
+	]])
     ],	have_mincore=yes
 	AC_MSG_RESULT(yes),
 	AC_MSG_RESULT(no))
@@ -51,11 +57,13 @@ AC_DEFUN([AC_HAVE_MINCORE],
 #
 AC_DEFUN([AC_HAVE_SENDFILE],
   [ AC_MSG_CHECKING([for sendfile ])
-    AC_TRY_COMPILE([
+    AC_COMPILE_IFELSE(
+    [	AC_LANG_PROGRAM([[
 #define _GNU_SOURCE
 #include <sys/sendfile.h>
-    ], [
-         sendfile(0, 0, 0, 0);
+	]], [[
+sendfile(0, 0, 0, 0);
+	]])
     ],	have_sendfile=yes
 	AC_MSG_RESULT(yes),
 	AC_MSG_RESULT(no))
@@ -67,11 +75,13 @@ AC_DEFUN([AC_HAVE_SENDFILE],
 #
 AC_DEFUN([AC_HAVE_GETMNTENT],
   [ AC_MSG_CHECKING([for getmntent ])
-    AC_TRY_COMPILE([
+    AC_COMPILE_IFELSE(
+    [	AC_LANG_PROGRAM([[
 #include <stdio.h>
 #include <mntent.h>
-    ], [
-         getmntent(0);
+	]], [[
+getmntent(0);
+	]])
     ], have_getmntent=yes
        AC_MSG_RESULT(yes),
        AC_MSG_RESULT(no))
@@ -83,12 +93,14 @@ AC_DEFUN([AC_HAVE_GETMNTENT],
 #
 AC_DEFUN([AC_HAVE_FALLOCATE],
   [ AC_MSG_CHECKING([for fallocate])
-    AC_TRY_LINK([
+    AC_LINK_IFELSE(
+    [	AC_LANG_PROGRAM([[
 #define _GNU_SOURCE
 #include <fcntl.h>
 #include <linux/falloc.h>
-    ], [
-         fallocate(0, 0, 0, 0);
+	]], [[
+fallocate(0, 0, 0, 0);
+	]])
     ], have_fallocate=yes
        AC_MSG_RESULT(yes),
        AC_MSG_RESULT(no))
@@ -100,13 +112,15 @@ AC_DEFUN([AC_HAVE_FALLOCATE],
 #
 AC_DEFUN([AC_HAVE_FIEMAP],
   [ AC_MSG_CHECKING([for fiemap])
-    AC_TRY_LINK([
+    AC_LINK_IFELSE(
+    [	AC_LANG_PROGRAM([[
 #define _GNU_SOURCE
 #include <linux/fs.h>
 #include <linux/fiemap.h>
-    ], [
-         struct fiemap *fiemap;
-         ioctl(0, FS_IOC_FIEMAP, (unsigned long)fiemap);
+	]], [[
+struct fiemap *fiemap;
+ioctl(0, FS_IOC_FIEMAP, (unsigned long)fiemap);
+	]])
     ], have_fiemap=yes
        AC_MSG_RESULT(yes),
        AC_MSG_RESULT(no))
@@ -118,12 +132,14 @@ AC_DEFUN([AC_HAVE_FIEMAP],
 #
 AC_DEFUN([AC_HAVE_PREADV],
   [ AC_MSG_CHECKING([for preadv])
-    AC_TRY_LINK([
+    AC_LINK_IFELSE(
+    [	AC_LANG_PROGRAM([[
 #define _BSD_SOURCE
 #define _DEFAULT_SOURCE
 #include <sys/uio.h>
-    ], [
-         preadv(0, 0, 0, 0);
+	]], [[
+preadv(0, 0, 0, 0);
+	]])
     ], have_preadv=yes
        AC_MSG_RESULT(yes),
        AC_MSG_RESULT(no))
@@ -135,11 +151,13 @@ AC_DEFUN([AC_HAVE_PREADV],
 #
 AC_DEFUN([AC_HAVE_PWRITEV2],
   [ AC_MSG_CHECKING([for pwritev2])
-    AC_TRY_LINK([
+    AC_LINK_IFELSE(
+    [	AC_LANG_PROGRAM([[
 #define _BSD_SOURCE
 #include <sys/uio.h>
-    ], [
-         pwritev2(0, 0, 0, 0, 0);
+	]], [[
+pwritev2(0, 0, 0, 0, 0);
+	]])
     ], have_pwritev2=yes
        AC_MSG_RESULT(yes),
        AC_MSG_RESULT(no))
@@ -151,12 +169,14 @@ AC_DEFUN([AC_HAVE_PWRITEV2],
 #
 AC_DEFUN([AC_HAVE_COPY_FILE_RANGE],
   [ AC_MSG_CHECKING([for copy_file_range])
-    AC_TRY_LINK([
+    AC_LINK_IFELSE(
+    [	AC_LANG_PROGRAM([[
 #define _GNU_SOURCE
 #include <sys/syscall.h>
 #include <unistd.h>
-    ], [
-         syscall(__NR_copy_file_range, 0, 0, 0, 0, 0, 0);
+	]], [[
+syscall(__NR_copy_file_range, 0, 0, 0, 0, 0, 0);
+	]])
     ], have_copy_file_range=yes
        AC_MSG_RESULT(yes),
        AC_MSG_RESULT(no))
@@ -168,11 +188,13 @@ AC_DEFUN([AC_HAVE_COPY_FILE_RANGE],
 #
 AC_DEFUN([AC_HAVE_SYNC_FILE_RANGE],
   [ AC_MSG_CHECKING([for sync_file_range])
-    AC_TRY_LINK([
+    AC_LINK_IFELSE(
+    [	AC_LANG_PROGRAM([[
 #define _GNU_SOURCE
 #include <fcntl.h>
-    ], [
-         sync_file_range(0, 0, 0, 0);
+	]], [[
+sync_file_range(0, 0, 0, 0);
+	]])
     ], have_sync_file_range=yes
        AC_MSG_RESULT(yes),
        AC_MSG_RESULT(no))
@@ -184,11 +206,13 @@ AC_DEFUN([AC_HAVE_SYNC_FILE_RANGE],
 #
 AC_DEFUN([AC_HAVE_SYNCFS],
   [ AC_MSG_CHECKING([for syncfs])
-    AC_TRY_LINK([
+    AC_LINK_IFELSE(
+    [	AC_LANG_PROGRAM([[
 #define _GNU_SOURCE
 #include <unistd.h>
-    ], [
-         syncfs(0);
+	]], [[
+syncfs(0);
+	]])
     ], have_syncfs=yes
        AC_MSG_RESULT(yes),
        AC_MSG_RESULT(no))
@@ -200,10 +224,12 @@ AC_DEFUN([AC_HAVE_SYNCFS],
 #
 AC_DEFUN([AC_HAVE_READDIR],
   [ AC_MSG_CHECKING([for readdir])
-    AC_TRY_LINK([
+    AC_LINK_IFELSE(
+    [	AC_LANG_PROGRAM([[
 #include <dirent.h>
-    ], [
-         readdir(0);
+	]], [[
+readdir(0);
+	]])
     ], have_readdir=yes
        AC_MSG_RESULT(yes),
        AC_MSG_RESULT(no))
@@ -304,15 +330,17 @@ AC_DEFUN([AC_NEED_INTERNAL_FSCRYPT_ADD_KEY_ARG],
 #
 AC_DEFUN([AC_HAVE_GETFSMAP],
   [ AC_MSG_CHECKING([for GETFSMAP])
-    AC_TRY_LINK([
+    AC_LINK_IFELSE(
+    [	AC_LANG_PROGRAM([[
 #define _GNU_SOURCE
 #include <sys/syscall.h>
 #include <unistd.h>
 #include <linux/fs.h>
 #include <linux/fsmap.h>
-    ], [
-         unsigned long x = FS_IOC_GETFSMAP;
-         struct fsmap_head fh;
+	]], [[
+unsigned long x = FS_IOC_GETFSMAP;
+struct fsmap_head fh;
+	]])
     ], have_getfsmap=yes
        AC_MSG_RESULT(yes),
        AC_MSG_RESULT(no))
@@ -338,11 +366,13 @@ AC_DEFUN([AC_HAVE_STATFS_FLAGS],
 #
 AC_DEFUN([AC_HAVE_MAP_SYNC],
   [ AC_MSG_CHECKING([for MAP_SYNC])
-    AC_TRY_COMPILE([
+    AC_COMPILE_IFELSE(
+    [	AC_LANG_PROGRAM([[
 #include <asm-generic/mman.h>
 #include <asm-generic/mman-common.h>
-    ], [
-        int flags = MAP_SYNC | MAP_SHARED_VALIDATE;
+	]], [[
+int flags = MAP_SYNC | MAP_SHARED_VALIDATE;
+	]])
     ], have_map_sync=yes
 	AC_MSG_RESULT(yes),
 	AC_MSG_RESULT(no))
@@ -354,13 +384,15 @@ AC_DEFUN([AC_HAVE_MAP_SYNC],
 #
 AC_DEFUN([AC_HAVE_MALLINFO],
   [ AC_MSG_CHECKING([for mallinfo ])
-    AC_TRY_COMPILE([
+    AC_COMPILE_IFELSE(
+    [	AC_LANG_PROGRAM([[
 #include <malloc.h>
-    ], [
-         struct mallinfo test;
+	]], [[
+struct mallinfo test;
 
-         test.arena = 0; test.hblkhd = 0; test.uordblks = 0; test.fordblks = 0;
-         test = mallinfo();
+test.arena = 0; test.hblkhd = 0; test.uordblks = 0; test.fordblks = 0;
+test = mallinfo();
+	]])
     ], have_mallinfo=yes
        AC_MSG_RESULT(yes),
        AC_MSG_RESULT(no))
@@ -400,10 +432,13 @@ AC_DEFUN([AC_HAVE_FSTATAT],
 #
 AC_DEFUN([AC_HAVE_SG_IO],
   [ AC_MSG_CHECKING([for struct sg_io_hdr ])
-    AC_TRY_COMPILE([#include <scsi/sg.h>],
-    [
-         struct sg_io_hdr hdr;
-         ioctl(0, SG_IO, &hdr);
+    AC_COMPILE_IFELSE(
+    [	AC_LANG_PROGRAM([[
+#include <scsi/sg.h>
+	]], [[
+struct sg_io_hdr hdr;
+ioctl(0, SG_IO, &hdr);
+	]])
     ], have_sg_io=yes
        AC_MSG_RESULT(yes),
        AC_MSG_RESULT(no))
@@ -415,10 +450,13 @@ AC_DEFUN([AC_HAVE_SG_IO],
 #
 AC_DEFUN([AC_HAVE_HDIO_GETGEO],
   [ AC_MSG_CHECKING([for struct hd_geometry ])
-    AC_TRY_COMPILE([#include <linux/hdreg.h>],
-    [
-         struct hd_geometry hdr;
-         ioctl(0, HDIO_GETGEO, &hdr);
+    AC_COMPILE_IFELSE(
+    [	AC_LANG_PROGRAM([[
+#include <linux/hdreg.h>,
+	]], [[
+struct hd_geometry hdr;
+ioctl(0, HDIO_GETGEO, &hdr);
+	]])
     ], have_hdio_getgeo=yes
        AC_MSG_RESULT(yes),
        AC_MSG_RESULT(no))
m4/package_types.m4 +5 -3
index 1c35839319d6..6e817a310f79 100644
@@ -4,9 +4,11 @@
 AH_TEMPLATE([HAVE_UMODE_T], [Whether you have umode_t])
 AC_DEFUN([AC_TYPE_UMODE_T],
   [ AC_MSG_CHECKING([for umode_t])
-    AC_TRY_COMPILE([
+    AC_COMPILE_IFELSE(
+    [	AC_LANG_PROGRAM([[
 #include <asm/types.h>
-    ], [
-         umode_t umode;
+	]], [[
+umode_t umode;
+	]])
     ], AC_DEFINE(HAVE_UMODE_T) AC_MSG_RESULT(yes) , AC_MSG_RESULT(no))
   ])
m4/package_urcu.m4 +11 -7
index f8e798b66136..ef116e0cda76 100644
@@ -10,11 +10,13 @@ AC_DEFUN([AC_PACKAGE_NEED_URCU_H],
 
 AC_DEFUN([AC_PACKAGE_NEED_RCU_INIT],
   [ AC_MSG_CHECKING([for liburcu])
-    AC_TRY_COMPILE([
+    AC_COMPILE_IFELSE(
+    [	AC_LANG_PROGRAM([[
 #define _GNU_SOURCE
 #include <urcu.h>
-    ], [
-       rcu_init();
+	]], [[
+rcu_init();
+	]])
     ], liburcu=-lurcu
        AC_MSG_RESULT(yes),
        AC_MSG_RESULT(no))
@@ -28,12 +30,14 @@ AC_DEFUN([AC_PACKAGE_NEED_RCU_INIT],
 #
 AC_DEFUN([AC_HAVE_LIBURCU_ATOMIC64],
   [ AC_MSG_CHECKING([for atomic64_t support in liburcu])
-    AC_TRY_LINK([
+    AC_LINK_IFELSE(
+    [	AC_LANG_PROGRAM([[
 #define _GNU_SOURCE
 #include <urcu.h>
-    ], [
-       long long f = 3;
-       uatomic_inc(&f);
+	]], [[
+long long f = 3;
+uatomic_inc(&f);
+	]])
     ], have_liburcu_atomic64=yes
        AC_MSG_RESULT(yes),
        AC_MSG_RESULT(no))
Signature · 1 line
2.35.1
#11 lore raw

Re: [PATCH 4/4] xfsprogs: autoconf modernisation

Quoted 28 lines · Darrick J. Wong
Quoted 27 lines · Dave Chinner

From: Dave Chinner <[email protected]>

Because apparently AC_TRY_COMPILE and AC_TRY_LINK has been deprecated and made obsolete.

.....
configure.ac:164: warning: The macro `AC_TRY_COMPILE' is obsolete. configure.ac:164: You should run autoupdate. ./lib/autoconf/general.m4:2847: AC_TRY_COMPILE is expanded from... m4/package_libcdev.m4:68: AC_HAVE_GETMNTENT is expanded from... configure.ac:164: the top level
configure.ac:165: warning: The macro `AC_TRY_LINK' is obsolete. configure.ac:165: You should run autoupdate. ./lib/autoconf/general.m4:2920: AC_TRY_LINK is expanded from... m4/package_libcdev.m4:84: AC_HAVE_FALLOCATE is expanded from... configure.ac:165: the top level
.....

But "autoupdate" does nothing to fix this, so I have to manually do these conversions:

- AC_TRY_COMPILE -> AC_COMPILE_IFELSE
- AC_TRY_LINK -> AC_LINK_IFELSE

because I have nothing better to do than fix currently working code.

Quoted 6 lines
Quoted 4 lines

Also, running autoupdate forces the minimum pre-req to be autoconf 2.71 because it replaces other stuff...

I hate autoconf, and this seems like stupid pedantry on their part...

Same, and yes, I really don't see the point of forcing everyone to update code like this when it largely could have been handled simply by rewriting the AC_TRY_COMPILE macro to use the AC_LANG_PROGRAM macro internally.

Cheers,

Dave.

Signature · 2 lines
Dave Chinner
[email protected]
#12 lore raw

Re: [PATCH 4/4] xfsprogs: autoconf modernisation

In reply to Dave Chinner
Quoted 21 lines · Dave Chinner

From: Dave Chinner <[email protected]>

Because apparently AC_TRY_COMPILE and AC_TRY_LINK has been deprecated and made obsolete.

.....
configure.ac:164: warning: The macro `AC_TRY_COMPILE' is obsolete. configure.ac:164: You should run autoupdate. ./lib/autoconf/general.m4:2847: AC_TRY_COMPILE is expanded from... m4/package_libcdev.m4:68: AC_HAVE_GETMNTENT is expanded from... configure.ac:164: the top level
configure.ac:165: warning: The macro `AC_TRY_LINK' is obsolete. configure.ac:165: You should run autoupdate. ./lib/autoconf/general.m4:2920: AC_TRY_LINK is expanded from... m4/package_libcdev.m4:84: AC_HAVE_FALLOCATE is expanded from... configure.ac:165: the top level
.....

But "autoupdate" does nothing to fix this, so I have to manually do these conversions:

Quoted 8 lines

- AC_TRY_COMPILE -> AC_COMPILE_IFELSE
- AC_TRY_LINK -> AC_LINK_IFELSE

because I have nothing better to do than fix currently working code.

Also, running autoupdate forces the minimum pre-req to be autoconf 2.71 because it replaces other stuff...

Bleah, to that part. 2.71 isn't even available on Fedora Core 35 which was released 6 months ago.
I'm afraid this will break lots of builds in not-very-old environments.

I'm inclined to look into whether I can just replace the obsolete macros to shut up the warnings for now, does that seem reasonable?

And then bumping the 2.50 minimum to the 8-year-old 2.69 is probably wise ;)

Thanks,
-Eric

#13 lore raw

Re: [PATCH 4/4] xfsprogs: autoconf modernisation

Quoted 6 lines · Eric Sandeen
Quoted 2 lines

Also, running autoupdate forces the minimum pre-req to be autoconf 2.71 because it replaces other stuff...

Bleah, to that part. 2.71 isn't even available on Fedora Core 35 which was released 6 months ago.
I'm afraid this will break lots of builds in not-very-old environments.

Quoted 7 lines

I'm inclined to look into whether I can just replace the obsolete macros to shut up the warnings for now, does that seem reasonable?

And then bumping the 2.50 minimum to the 8-year-old 2.69 is probably wise ;)

Thanks,
-Eric

Actually, I think that 2.71 from autoupdate is gratuitous, all your changes seem fine under the (ancient) 2.69.

So I'm inclined to merge this patch as is, but with a 2.69 minimum, as the current 2.50 version requirement is for something released around the turn of the century...

Any concerns or complaints?

-Eric

#14 lore raw

Re: [PATCH 4/4] xfsprogs: autoconf modernisation

Quoted 15 lines · Eric Sandeen
Quoted 6 lines · Eric Sandeen
Quoted 2 lines

Also, running autoupdate forces the minimum pre-req to be autoconf 2.71 because it replaces other stuff...

Bleah, to that part. 2.71 isn't even available on Fedora Core 35 which was released 6 months ago.
I'm afraid this will break lots of builds in not-very-old environments.

Quoted 7 lines

I'm inclined to look into whether I can just replace the obsolete macros to shut up the warnings for now, does that seem reasonable?

And then bumping the 2.50 minimum to the 8-year-old 2.69 is probably wise ;)

Thanks,
-Eric

Quoted 8 lines

Actually, I think that 2.71 from autoupdate is gratuitous, all your changes seem fine under the (ancient) 2.69.

So I'm inclined to merge this patch as is, but with a 2.69 minimum, as the current 2.50 version requirement is for something released around the turn of the century...

Any concerns or complaints?

Not from me.

Cheers,

Dave.

Signature · 2 lines
Dave Chinner
[email protected]
#15 lore raw

Re: [PATCH 4/4] xfsprogs: autoconf modernisation

In reply to Eric Sandeen
Quoted 6 lines · Eric Sandeen

Actually, I think that 2.71 from autoupdate is gratuitous, all your changes seem fine under the (ancient) 2.69.

So I'm inclined to merge this patch as is, but with a 2.69 minimum, as the current 2.50 version requirement is for something released around the turn of the century...

Sounds good.

#16 lore raw

Re: [PATCH 4/4] xfsprogs: autoconf modernisation

In reply to Dave Chinner
Quoted 18 lines · Dave Chinner

From: Dave Chinner <[email protected]>

Because apparently AC_TRY_COMPILE and AC_TRY_LINK has been deprecated and made obsolete.

.....
configure.ac:164: warning: The macro `AC_TRY_COMPILE' is obsolete. configure.ac:164: You should run autoupdate. ./lib/autoconf/general.m4:2847: AC_TRY_COMPILE is expanded from... m4/package_libcdev.m4:68: AC_HAVE_GETMNTENT is expanded from... configure.ac:164: the top level
configure.ac:165: warning: The macro `AC_TRY_LINK' is obsolete. configure.ac:165: You should run autoupdate. ./lib/autoconf/general.m4:2920: AC_TRY_LINK is expanded from... m4/package_libcdev.m4:84: AC_HAVE_FALLOCATE is expanded from... configure.ac:165: the top level
.....

Quoted 5 lines

But "autoupdate" does nothing to fix this, so I have to manually do these conversions:

- AC_TRY_COMPILE -> AC_COMPILE_IFELSE
- AC_TRY_LINK -> AC_LINK_IFELSE

Note for the next time we have to do this: I started rebasing djwong-dev on this one patch, and noticed my autoupdate accepts file paths, which means that one can do things like:

$ autoupdate configure.ac m4/*.m4

instead of doing this by hand.

--D

Quoted 450 lines

because I have nothing better to do than fix currently working code.

Also, running autoupdate forces the minimum pre-req to be autoconf 2.71 because it replaces other stuff...

---
 configure.ac          |   8 +--
 m4/package_attr.m4    |   8 ++-
 m4/package_libcdev.m4 | 158 ++++++++++++++++++++++++++----------------
 m4/package_types.m4   |   8 ++-
 m4/package_urcu.m4    |  18 +++--
 5 files changed, 123 insertions(+), 77 deletions(-)
configure.ac +4 -4
index 4278145fe74b..36e42394a9df 100644
@@ -1,13 +1,13 @@
-AC_INIT([xfsprogs], [5.15.0], [[email protected]])
-AC_PREREQ(2.50)
+AC_INIT([xfsprogs],[5.15.0],[[email protected]])
+AC_PREREQ([2.71])
 AC_CONFIG_AUX_DIR([.])
 AC_CONFIG_MACRO_DIR([m4])
 AC_CONFIG_SRCDIR([include/libxfs.h])
-AC_CONFIG_HEADER(include/platform_defs.h)
+AC_CONFIG_HEADERS([include/platform_defs.h])
 AC_PREFIX_DEFAULT(/usr)
 
 AC_PROG_INSTALL
-AC_PROG_LIBTOOL
+LT_INIT
 
 AC_PROG_CC
 AC_ARG_VAR(BUILD_CC, [C compiler for build tools])
m4/package_attr.m4 +5 -3
index 432492311d18..05e02b38fb5a 100644
@@ -8,15 +8,17 @@ AC_DEFUN([AC_PACKAGE_WANT_ATTRIBUTES_H],
 #
 AC_DEFUN([AC_HAVE_LIBATTR],
   [ AC_MSG_CHECKING([for struct attrlist_cursor])
-    AC_TRY_COMPILE([
+    AC_COMPILE_IFELSE(
+    [	AC_LANG_PROGRAM([[
 #include <sys/types.h>
 #include <attr/attributes.h>
-       ], [
+	]], [[
 struct attrlist_cursor *cur;
 struct attrlist *list;
 struct attrlist_ent *ent;
 int flags = ATTR_ROOT;
-       ], have_libattr=yes
+	]])
+    ], have_libattr=yes
           AC_MSG_RESULT(yes),
           AC_MSG_RESULT(no))
     AC_SUBST(have_libattr)
m4/package_libcdev.m4 +98 -60
index adab9bb9773a..94d76c7b3a19 100644
@@ -3,11 +3,13 @@
 #
 AC_DEFUN([AC_HAVE_FADVISE],
   [ AC_MSG_CHECKING([for fadvise ])
-    AC_TRY_COMPILE([
+    AC_COMPILE_IFELSE(
+    [	AC_LANG_PROGRAM([[
 #define _GNU_SOURCE
 #include <fcntl.h>
-    ], [
-	posix_fadvise(0, 1, 0, POSIX_FADV_NORMAL);
+	]], [[
+posix_fadvise(0, 1, 0, POSIX_FADV_NORMAL);
+	]])
     ],	have_fadvise=yes
 	AC_MSG_RESULT(yes),
 	AC_MSG_RESULT(no))
@@ -19,11 +21,13 @@ AC_DEFUN([AC_HAVE_FADVISE],
 #
 AC_DEFUN([AC_HAVE_MADVISE],
   [ AC_MSG_CHECKING([for madvise ])
-    AC_TRY_COMPILE([
+    AC_COMPILE_IFELSE(
+    [	AC_LANG_PROGRAM([[
 #define _GNU_SOURCE
 #include <sys/mman.h>
-    ], [
-	posix_madvise(0, 0, MADV_NORMAL);
+	]], [[
+posix_madvise(0, 0, MADV_NORMAL);
+	]])
     ],	have_madvise=yes
 	AC_MSG_RESULT(yes),
 	AC_MSG_RESULT(no))
@@ -35,11 +39,13 @@ AC_DEFUN([AC_HAVE_MADVISE],
 #
 AC_DEFUN([AC_HAVE_MINCORE],
   [ AC_MSG_CHECKING([for mincore ])
-    AC_TRY_COMPILE([
+    AC_COMPILE_IFELSE(
+    [	AC_LANG_PROGRAM([[
 #define _GNU_SOURCE
 #include <sys/mman.h>
-    ], [
-	mincore(0, 0, 0);
+	]], [[
+mincore(0, 0, 0);
+	]])
     ],	have_mincore=yes
 	AC_MSG_RESULT(yes),
 	AC_MSG_RESULT(no))
@@ -51,11 +57,13 @@ AC_DEFUN([AC_HAVE_MINCORE],
 #
 AC_DEFUN([AC_HAVE_SENDFILE],
   [ AC_MSG_CHECKING([for sendfile ])
-    AC_TRY_COMPILE([
+    AC_COMPILE_IFELSE(
+    [	AC_LANG_PROGRAM([[
 #define _GNU_SOURCE
 #include <sys/sendfile.h>
-    ], [
-         sendfile(0, 0, 0, 0);
+	]], [[
+sendfile(0, 0, 0, 0);
+	]])
     ],	have_sendfile=yes
 	AC_MSG_RESULT(yes),
 	AC_MSG_RESULT(no))
@@ -67,11 +75,13 @@ AC_DEFUN([AC_HAVE_SENDFILE],
 #
 AC_DEFUN([AC_HAVE_GETMNTENT],
   [ AC_MSG_CHECKING([for getmntent ])
-    AC_TRY_COMPILE([
+    AC_COMPILE_IFELSE(
+    [	AC_LANG_PROGRAM([[
 #include <stdio.h>
 #include <mntent.h>
-    ], [
-         getmntent(0);
+	]], [[
+getmntent(0);
+	]])
     ], have_getmntent=yes
        AC_MSG_RESULT(yes),
        AC_MSG_RESULT(no))
@@ -83,12 +93,14 @@ AC_DEFUN([AC_HAVE_GETMNTENT],
 #
 AC_DEFUN([AC_HAVE_FALLOCATE],
   [ AC_MSG_CHECKING([for fallocate])
-    AC_TRY_LINK([
+    AC_LINK_IFELSE(
+    [	AC_LANG_PROGRAM([[
 #define _GNU_SOURCE
 #include <fcntl.h>
 #include <linux/falloc.h>
-    ], [
-         fallocate(0, 0, 0, 0);
+	]], [[
+fallocate(0, 0, 0, 0);
+	]])
     ], have_fallocate=yes
        AC_MSG_RESULT(yes),
        AC_MSG_RESULT(no))
@@ -100,13 +112,15 @@ AC_DEFUN([AC_HAVE_FALLOCATE],
 #
 AC_DEFUN([AC_HAVE_FIEMAP],
   [ AC_MSG_CHECKING([for fiemap])
-    AC_TRY_LINK([
+    AC_LINK_IFELSE(
+    [	AC_LANG_PROGRAM([[
 #define _GNU_SOURCE
 #include <linux/fs.h>
 #include <linux/fiemap.h>
-    ], [
-         struct fiemap *fiemap;
-         ioctl(0, FS_IOC_FIEMAP, (unsigned long)fiemap);
+	]], [[
+struct fiemap *fiemap;
+ioctl(0, FS_IOC_FIEMAP, (unsigned long)fiemap);
+	]])
     ], have_fiemap=yes
        AC_MSG_RESULT(yes),
        AC_MSG_RESULT(no))
@@ -118,12 +132,14 @@ AC_DEFUN([AC_HAVE_FIEMAP],
 #
 AC_DEFUN([AC_HAVE_PREADV],
   [ AC_MSG_CHECKING([for preadv])
-    AC_TRY_LINK([
+    AC_LINK_IFELSE(
+    [	AC_LANG_PROGRAM([[
 #define _BSD_SOURCE
 #define _DEFAULT_SOURCE
 #include <sys/uio.h>
-    ], [
-         preadv(0, 0, 0, 0);
+	]], [[
+preadv(0, 0, 0, 0);
+	]])
     ], have_preadv=yes
        AC_MSG_RESULT(yes),
        AC_MSG_RESULT(no))
@@ -135,11 +151,13 @@ AC_DEFUN([AC_HAVE_PREADV],
 #
 AC_DEFUN([AC_HAVE_PWRITEV2],
   [ AC_MSG_CHECKING([for pwritev2])
-    AC_TRY_LINK([
+    AC_LINK_IFELSE(
+    [	AC_LANG_PROGRAM([[
 #define _BSD_SOURCE
 #include <sys/uio.h>
-    ], [
-         pwritev2(0, 0, 0, 0, 0);
+	]], [[
+pwritev2(0, 0, 0, 0, 0);
+	]])
     ], have_pwritev2=yes
        AC_MSG_RESULT(yes),
        AC_MSG_RESULT(no))
@@ -151,12 +169,14 @@ AC_DEFUN([AC_HAVE_PWRITEV2],
 #
 AC_DEFUN([AC_HAVE_COPY_FILE_RANGE],
   [ AC_MSG_CHECKING([for copy_file_range])
-    AC_TRY_LINK([
+    AC_LINK_IFELSE(
+    [	AC_LANG_PROGRAM([[
 #define _GNU_SOURCE
 #include <sys/syscall.h>
 #include <unistd.h>
-    ], [
-         syscall(__NR_copy_file_range, 0, 0, 0, 0, 0, 0);
+	]], [[
+syscall(__NR_copy_file_range, 0, 0, 0, 0, 0, 0);
+	]])
     ], have_copy_file_range=yes
        AC_MSG_RESULT(yes),
        AC_MSG_RESULT(no))
@@ -168,11 +188,13 @@ AC_DEFUN([AC_HAVE_COPY_FILE_RANGE],
 #
 AC_DEFUN([AC_HAVE_SYNC_FILE_RANGE],
   [ AC_MSG_CHECKING([for sync_file_range])
-    AC_TRY_LINK([
+    AC_LINK_IFELSE(
+    [	AC_LANG_PROGRAM([[
 #define _GNU_SOURCE
 #include <fcntl.h>
-    ], [
-         sync_file_range(0, 0, 0, 0);
+	]], [[
+sync_file_range(0, 0, 0, 0);
+	]])
     ], have_sync_file_range=yes
        AC_MSG_RESULT(yes),
        AC_MSG_RESULT(no))
@@ -184,11 +206,13 @@ AC_DEFUN([AC_HAVE_SYNC_FILE_RANGE],
 #
 AC_DEFUN([AC_HAVE_SYNCFS],
   [ AC_MSG_CHECKING([for syncfs])
-    AC_TRY_LINK([
+    AC_LINK_IFELSE(
+    [	AC_LANG_PROGRAM([[
 #define _GNU_SOURCE
 #include <unistd.h>
-    ], [
-         syncfs(0);
+	]], [[
+syncfs(0);
+	]])
     ], have_syncfs=yes
        AC_MSG_RESULT(yes),
        AC_MSG_RESULT(no))
@@ -200,10 +224,12 @@ AC_DEFUN([AC_HAVE_SYNCFS],
 #
 AC_DEFUN([AC_HAVE_READDIR],
   [ AC_MSG_CHECKING([for readdir])
-    AC_TRY_LINK([
+    AC_LINK_IFELSE(
+    [	AC_LANG_PROGRAM([[
 #include <dirent.h>
-    ], [
-         readdir(0);
+	]], [[
+readdir(0);
+	]])
     ], have_readdir=yes
        AC_MSG_RESULT(yes),
        AC_MSG_RESULT(no))
@@ -304,15 +330,17 @@ AC_DEFUN([AC_NEED_INTERNAL_FSCRYPT_ADD_KEY_ARG],
 #
 AC_DEFUN([AC_HAVE_GETFSMAP],
   [ AC_MSG_CHECKING([for GETFSMAP])
-    AC_TRY_LINK([
+    AC_LINK_IFELSE(
+    [	AC_LANG_PROGRAM([[
 #define _GNU_SOURCE
 #include <sys/syscall.h>
 #include <unistd.h>
 #include <linux/fs.h>
 #include <linux/fsmap.h>
-    ], [
-         unsigned long x = FS_IOC_GETFSMAP;
-         struct fsmap_head fh;
+	]], [[
+unsigned long x = FS_IOC_GETFSMAP;
+struct fsmap_head fh;
+	]])
     ], have_getfsmap=yes
        AC_MSG_RESULT(yes),
        AC_MSG_RESULT(no))
@@ -338,11 +366,13 @@ AC_DEFUN([AC_HAVE_STATFS_FLAGS],
 #
 AC_DEFUN([AC_HAVE_MAP_SYNC],
   [ AC_MSG_CHECKING([for MAP_SYNC])
-    AC_TRY_COMPILE([
+    AC_COMPILE_IFELSE(
+    [	AC_LANG_PROGRAM([[
 #include <asm-generic/mman.h>
 #include <asm-generic/mman-common.h>
-    ], [
-        int flags = MAP_SYNC | MAP_SHARED_VALIDATE;
+	]], [[
+int flags = MAP_SYNC | MAP_SHARED_VALIDATE;
+	]])
     ], have_map_sync=yes
 	AC_MSG_RESULT(yes),
 	AC_MSG_RESULT(no))
@@ -354,13 +384,15 @@ AC_DEFUN([AC_HAVE_MAP_SYNC],
 #
 AC_DEFUN([AC_HAVE_MALLINFO],
   [ AC_MSG_CHECKING([for mallinfo ])
-    AC_TRY_COMPILE([
+    AC_COMPILE_IFELSE(
+    [	AC_LANG_PROGRAM([[
 #include <malloc.h>
-    ], [
-         struct mallinfo test;
+	]], [[
+struct mallinfo test;
 
-         test.arena = 0; test.hblkhd = 0; test.uordblks = 0; test.fordblks = 0;
-         test = mallinfo();
+test.arena = 0; test.hblkhd = 0; test.uordblks = 0; test.fordblks = 0;
+test = mallinfo();
+	]])
     ], have_mallinfo=yes
        AC_MSG_RESULT(yes),
        AC_MSG_RESULT(no))
@@ -400,10 +432,13 @@ AC_DEFUN([AC_HAVE_FSTATAT],
 #
 AC_DEFUN([AC_HAVE_SG_IO],
   [ AC_MSG_CHECKING([for struct sg_io_hdr ])
-    AC_TRY_COMPILE([#include <scsi/sg.h>],
-    [
-         struct sg_io_hdr hdr;
-         ioctl(0, SG_IO, &hdr);
+    AC_COMPILE_IFELSE(
+    [	AC_LANG_PROGRAM([[
+#include <scsi/sg.h>
+	]], [[
+struct sg_io_hdr hdr;
+ioctl(0, SG_IO, &hdr);
+	]])
     ], have_sg_io=yes
        AC_MSG_RESULT(yes),
        AC_MSG_RESULT(no))
@@ -415,10 +450,13 @@ AC_DEFUN([AC_HAVE_SG_IO],
 #
 AC_DEFUN([AC_HAVE_HDIO_GETGEO],
   [ AC_MSG_CHECKING([for struct hd_geometry ])
-    AC_TRY_COMPILE([#include <linux/hdreg.h>],
-    [
-         struct hd_geometry hdr;
-         ioctl(0, HDIO_GETGEO, &hdr);
+    AC_COMPILE_IFELSE(
+    [	AC_LANG_PROGRAM([[
+#include <linux/hdreg.h>,
+	]], [[
+struct hd_geometry hdr;
+ioctl(0, HDIO_GETGEO, &hdr);
+	]])
     ], have_hdio_getgeo=yes
        AC_MSG_RESULT(yes),
        AC_MSG_RESULT(no))
m4/package_types.m4 +5 -3
index 1c35839319d6..6e817a310f79 100644
@@ -4,9 +4,11 @@
 AH_TEMPLATE([HAVE_UMODE_T], [Whether you have umode_t])
 AC_DEFUN([AC_TYPE_UMODE_T],
   [ AC_MSG_CHECKING([for umode_t])
-    AC_TRY_COMPILE([
+    AC_COMPILE_IFELSE(
+    [	AC_LANG_PROGRAM([[
 #include <asm/types.h>
-    ], [
-         umode_t umode;
+	]], [[
+umode_t umode;
+	]])
     ], AC_DEFINE(HAVE_UMODE_T) AC_MSG_RESULT(yes) , AC_MSG_RESULT(no))
   ])
m4/package_urcu.m4 +11 -7
index f8e798b66136..ef116e0cda76 100644
@@ -10,11 +10,13 @@ AC_DEFUN([AC_PACKAGE_NEED_URCU_H],
 
 AC_DEFUN([AC_PACKAGE_NEED_RCU_INIT],
   [ AC_MSG_CHECKING([for liburcu])
-    AC_TRY_COMPILE([
+    AC_COMPILE_IFELSE(
+    [	AC_LANG_PROGRAM([[
 #define _GNU_SOURCE
 #include <urcu.h>
-    ], [
-       rcu_init();
+	]], [[
+rcu_init();
+	]])
     ], liburcu=-lurcu
        AC_MSG_RESULT(yes),
        AC_MSG_RESULT(no))
@@ -28,12 +30,14 @@ AC_DEFUN([AC_PACKAGE_NEED_RCU_INIT],
 #
 AC_DEFUN([AC_HAVE_LIBURCU_ATOMIC64],
   [ AC_MSG_CHECKING([for atomic64_t support in liburcu])
-    AC_TRY_LINK([
+    AC_LINK_IFELSE(
+    [	AC_LANG_PROGRAM([[
 #define _GNU_SOURCE
 #include <urcu.h>
-    ], [
-       long long f = 3;
-       uatomic_inc(&f);
+	]], [[
+long long f = 3;
+uatomic_inc(&f);
+	]])
     ], have_liburcu_atomic64=yes
        AC_MSG_RESULT(yes),
        AC_MSG_RESULT(no))
Signature · 1 line
2.35.1