lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <50F05175.8060502@redhat.com>
Date:	Fri, 11 Jan 2013 11:52:53 -0600
From:	Eric Sandeen <sandeen@...hat.com>
To:	ext4 development <linux-ext4@...r.kernel.org>
CC:	Carlos Maiolino <cmaiolino@...hat.com>
Subject: [PATCH] resize2fs: add debug switch to use old online interface

The old online resize ioctl interfaces are still present
in the kernel; add a debug switch to resize2fs to be able
to test them.

Signed-off-by: Eric Sandeen <sandeen@...hat.com>
---

diff --git a/resize/online.c b/resize/online.c
index d3d3546..9b38ac8 100644
--- a/resize/online.c
+++ b/resize/online.c
@@ -22,7 +22,7 @@ extern char *program_name;
 #define MAX_32_NUM ((((unsigned long long) 1) << 32) - 1)
 
 errcode_t online_resize_fs(ext2_filsys fs, const char *mtpt,
-			   blk64_t *new_size, int flags EXT2FS_ATTR((unused)))
+			   blk64_t *new_size, int flags)
 {
 #ifdef __linux__
 	struct ext2_new_group_input input;
@@ -94,9 +94,11 @@ errcode_t online_resize_fs(ext2_filsys fs, const char *mtpt,
 		exit(1);
 	}
 
-	if (ioctl(fd, EXT4_IOC_RESIZE_FS, new_size)) {
+	if (flags & RESIZE_DEBUG_OLD ||
+	    ioctl(fd, EXT4_IOC_RESIZE_FS, new_size)) {
 		/*
-		 * If kernel does not support EXT4_IOC_RESIZE_FS, use the
+		 * If kernel does not support EXT4_IOC_RESIZE_FS, or -d 16
+		 * is specified on the resize2fs command line, use the
 		 * old online resize. Note that the old approach does not
 		 * handle >32 bit file systems
 		 *
@@ -109,7 +111,9 @@ errcode_t online_resize_fs(ext2_filsys fs, const char *mtpt,
 		 * in the kernel sources.  This is probably a kernel
 		 * bug, but work around it here.
 		 */
-		if ((errno != ENOTTY) && (errno != EINVAL)) {
+		if (flags & RESIZE_DEBUG_OLD) {
+			printf("Old resize interface requested.\n");
+		} else if ((errno != ENOTTY) && (errno != EINVAL)) {
 			if (errno == EPERM)
 				com_err(program_name, 0,
 				_("Permission denied to resize filesystem"));
diff --git a/resize/resize2fs.8.in b/resize/resize2fs.8.in
index 9ff6e0a..766c4d8 100644
--- a/resize/resize2fs.8.in
+++ b/resize/resize2fs.8.in
@@ -99,6 +99,8 @@ from the following list:
 	4	\-\ Debug inode relocations
 .br
 	8	\-\ Debug moving the inode table
+.br
+	16	\-\ Debug old online resize interface
 .TP 
 .B \-f
 Forces resize2fs to proceed with the filesystem resize operation, overriding
diff --git a/resize/resize2fs.h b/resize/resize2fs.h
index 2184759..58fc04d 100644
--- a/resize/resize2fs.h
+++ b/resize/resize2fs.h
@@ -76,6 +76,8 @@ typedef struct ext2_sim_progress *ext2_sim_progmeter;
 #define RESIZE_DEBUG_BMOVE		0x0002
 #define RESIZE_DEBUG_INODEMAP		0x0004
 #define RESIZE_DEBUG_ITABLEMOVE		0x0008
+/* old online resize interface */
+#define RESIZE_DEBUG_OLD		0x0010
 
 #define RESIZE_PERCENT_COMPLETE		0x0100
 #define RESIZE_VERBOSE			0x0200


--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ