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]
Date:   Sat, 14 May 2022 04:17:09 +0000
From:   "Kiselev, Oleg" <okiselev@...zon.com>
To:     "linux-ext4@...r.kernel.org" <linux-ext4@...r.kernel.org>
CC:     Theodore Ts'o <tytso@....edu>
Subject: [PATCH] resize2fs: trim resize to cluster boundary


This patch rounds down the size provided to resize2fs to the nearest
cluster boundary for bigalloc filesystems.  This is similar to the
trimming already done for page boundary alignment.  Aligning the size in
the user space provides the right value feedback from the resize2fs
command, which is a better user experience than trimming the size
in the kernel.

Signed-off-by: Oleg Kiselev <okiselev@...zon.com>
---
 resize/main.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/resize/main.c b/resize/main.c
index bceaa1677e21..93a1d5a260e1 100644
--- a/resize/main.c
+++ b/resize/main.c
@@ -537,6 +537,12 @@ int main (int argc, char ** argv)
 			goto errout;
 		}
 	}
+
+	/* If using cluster allocations, trim down to a cluster boundary */
+	if (ext2fs_has_feature_bigalloc(fs->super)) {
+		new_size &= ~((blk64_t)(1 << fs->cluster_ratio_bits) - 1);
+	}
+
 	new_group_desc_count = ext2fs_div64_ceil(new_size -
 				fs->super->s_first_data_block,
 						 EXT2_BLOCKS_PER_GROUP(fs->super));
--
2.32.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ