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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 12 Aug 2011 18:42:59 +0200
From:	Lukas Czerner <lczerner@...hat.com>
To:	linux-ext4@...r.kernel.org
Cc:	tytso@....edu, adilger@...ger.ca,
	Lukas Czerner <lczerner@...hat.com>
Subject: [PATCH 4/5 v2] e2fsck: do not attempt to discard if -n was specified

If '-n' option is specified there should be no changes made to the file
system hence we should not attempt to discard the file system. This
commit adds a check into the e2fsck_discard_blocks() condition so it skip
discard if E2F_OPT_NO flag is set.

Signed-off-by: Lukas Czerner <lczerner@...hat.com>
---
v2: This is the actually the first version of the patch

 e2fsck/pass5.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/e2fsck/pass5.c b/e2fsck/pass5.c
index f9d746c..cf37556 100644
--- a/e2fsck/pass5.c
+++ b/e2fsck/pass5.c
@@ -87,7 +87,8 @@ static void e2fsck_discard_blocks(e2fsck_t ctx, io_manager manager,
 	if (ext2fs_test_changed(ctx->fs))
 		ctx->options &= ~E2F_OPT_DISCARD;
 
-	if ((ctx->options & E2F_OPT_DISCARD) &&
+	if (!(ctx->options & E2F_OPT_NO) &&
+	    (ctx->options & E2F_OPT_DISCARD) &&
 	    (io_channel_discard(fs->io, start, count)))
 		ctx->options &= ~E2F_OPT_DISCARD;
 }
@@ -331,11 +332,9 @@ redo_counts:
 			if (first_free > i)
 				first_free = i;
 		} else {
-			if ((i > first_free) &&
-			   (ctx->options & E2F_OPT_DISCARD)) {
+			if (i > first_free)
 				e2fsck_discard_blocks(ctx, manager, first_free,
 						      (i - first_free));
-			}
 			first_free = ext2fs_blocks_count(fs->super);
 		}
 		blocks ++;
-- 
1.7.4.4

--
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