* [PATCH] mke2fs: Don't erase flash device if "-n" is given
@ 2011-06-07 16:22 Andreas Dilger
2011-06-07 16:58 ` Eric Sandeen
0 siblings, 1 reply; 3+ messages in thread
From: Andreas Dilger @ 2011-06-07 16:22 UTC (permalink / raw)
To: tytso, linux-ext4; +Cc: Andreas Dilger
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>
---
misc/mke2fs.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/misc/mke2fs.c b/misc/mke2fs.c
index ddfa929..9472016 100644
--- a/misc/mke2fs.c
+++ b/misc/mke2fs.c
@@ -2132,7 +2132,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_device(fs);
if (!retval && io_channel_discard_zeroes_data(fs->io)) {
if (verbose)
--
1.7.3.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] mke2fs: Don't erase flash device if "-n" is given
2011-06-07 16:22 [PATCH] mke2fs: Don't erase flash device if "-n" is given Andreas Dilger
@ 2011-06-07 16:58 ` Eric Sandeen
2011-06-07 17:37 ` Ted Ts'o
0 siblings, 1 reply; 3+ messages in thread
From: Eric Sandeen @ 2011-06-07 16:58 UTC (permalink / raw)
To: Andreas Dilger; +Cc: tytso, linux-ext4
On 6/7/11 11:22 AM, Andreas Dilger wrote:
> 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.
Oh, crud.
> 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>
> ---
> misc/mke2fs.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/misc/mke2fs.c b/misc/mke2fs.c
> index ddfa929..9472016 100644
> --- a/misc/mke2fs.c
> +++ b/misc/mke2fs.c
> @@ -2132,7 +2132,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_device(fs);
> if (!retval && io_channel_discard_zeroes_data(fs->io)) {
> if (verbose)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mke2fs: Don't erase flash device if "-n" is given
2011-06-07 16:58 ` Eric Sandeen
@ 2011-06-07 17:37 ` Ted Ts'o
0 siblings, 0 replies; 3+ messages in thread
From: Ted Ts'o @ 2011-06-07 17:37 UTC (permalink / raw)
To: Eric Sandeen; +Cc: Andreas Dilger, linux-ext4
On Tue, Jun 07, 2011 at 11:58:40AM -0500, Eric Sandeen wrote:
> On 6/7/11 11:22 AM, Andreas Dilger wrote:
> > 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.
>
> Oh, crud.
I guess that means we should probably release e2fsprogs 1.41.15.
> > 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>
Added to the maint branch, thanks.
- Ted
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-06-07 17:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-07 16:22 [PATCH] mke2fs: Don't erase flash device if "-n" is given Andreas Dilger
2011-06-07 16:58 ` Eric Sandeen
2011-06-07 17:37 ` Ted Ts'o
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).