summaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
authorAndreas Dilger <adilger@whamcloud.com>2011-06-07 10:22:29 -0600
committerTheodore Ts'o <tytso@mit.edu>2011-06-07 13:37:03 -0400
commit8185ab9f38f0e9cd06feab9d8e59d059bde84bf6 (patch)
treecc15e47e67f295501669969e9f54dd1ad627e9db /misc
parentbcb942c2013a92ff9a627ee79f14e52dba097538 (diff)
downloade2fsprogs-8185ab9f38f0e9cd06feab9d8e59d059bde84bf6.tar.gz
mke2fs: Don't erase flash device if "-n" is given
If "mke2fs -n" is used, there should be no changes to the underlying device. Unfortunately, when the "discard" option was added in commit c7cd908be59f48c66b4f3ac9a631ffe3dde4f1ab, it did not check for the "-n" flag, and will discard all data on a flash device even if "-n" is given. Check for the "noaction" flag before discarding any filesystem data. Signed-off-by: Andreas Dilger <adilger@whamcloud.com> Reviewed-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'misc')
-rw-r--r--misc/mke2fs.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/misc/mke2fs.c b/misc/mke2fs.c
index c46df6ce..e28828ee 100644
--- a/misc/mke2fs.c
+++ b/misc/mke2fs.c
@@ -2142,7 +2142,7 @@ int main (int argc, char *argv[])
}
/* Can't undo discard ... */
- if (discard && (io_ptr != undo_io_manager)) {
+ if (!noaction && discard && (io_ptr != undo_io_manager)) {
retval = mke2fs_discard_blocks(fs);
if (!retval && mke2fs_discard_zeroes_data(fs)) {