* [PATCH] resize2fs: If resize2fs fails, tell the user to run e2fsck
@ 2009-07-10 18:07 Theodore Ts'o
2009-07-10 18:09 ` Eric Sandeen
2009-07-10 18:42 ` Andreas Dilger
0 siblings, 2 replies; 4+ messages in thread
From: Theodore Ts'o @ 2009-07-10 18:07 UTC (permalink / raw)
To: Ext4 Developers List; +Cc: Theodore Ts'o
If the resize operation fails in the middle of the operation, mark the
filesystem as needing to be checked, and tell the user that they
should run e2fsck -fy on the device.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
---
resize/main.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/resize/main.c b/resize/main.c
index 2dae161..990a967 100644
--- a/resize/main.c
+++ b/resize/main.c
@@ -455,7 +455,12 @@ int main (int argc, char ** argv)
if (retval) {
com_err(program_name, retval, _("while trying to resize %s"),
device_name);
- ext2fs_close (fs);
+ fprintf(stderr,
+ _("Please run 'e2fsck -fy %s' to fix the filesystem\n"
+ "after the aborted resize operation"), device_name);
+ fs->super->s_state |= EXT2_ERROR_FS;
+ ext2fs_mark_super_dirty(fs);
+ ext2fs_close(fs);
exit(1);
}
printf(_("The filesystem on %s is now %u blocks long.\n\n"),
--
1.6.3.2.1.gb9f7d.dirty
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] resize2fs: If resize2fs fails, tell the user to run e2fsck
2009-07-10 18:07 [PATCH] resize2fs: If resize2fs fails, tell the user to run e2fsck Theodore Ts'o
@ 2009-07-10 18:09 ` Eric Sandeen
2009-07-10 18:42 ` Andreas Dilger
1 sibling, 0 replies; 4+ messages in thread
From: Eric Sandeen @ 2009-07-10 18:09 UTC (permalink / raw)
To: Theodore Ts'o; +Cc: Ext4 Developers List
Theodore Ts'o wrote:
> If the resize operation fails in the middle of the operation, mark the
> filesystem as needing to be checked, and tell the user that they
> should run e2fsck -fy on the device.
>
> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Good plan.
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
> ---
> resize/main.c | 7 ++++++-
> 1 files changed, 6 insertions(+), 1 deletions(-)
>
> diff --git a/resize/main.c b/resize/main.c
> index 2dae161..990a967 100644
> --- a/resize/main.c
> +++ b/resize/main.c
> @@ -455,7 +455,12 @@ int main (int argc, char ** argv)
> if (retval) {
> com_err(program_name, retval, _("while trying to resize %s"),
> device_name);
> - ext2fs_close (fs);
> + fprintf(stderr,
> + _("Please run 'e2fsck -fy %s' to fix the filesystem\n"
> + "after the aborted resize operation"), device_name);
> + fs->super->s_state |= EXT2_ERROR_FS;
> + ext2fs_mark_super_dirty(fs);
> + ext2fs_close(fs);
> exit(1);
> }
> printf(_("The filesystem on %s is now %u blocks long.\n\n"),
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] resize2fs: If resize2fs fails, tell the user to run e2fsck
2009-07-10 18:07 [PATCH] resize2fs: If resize2fs fails, tell the user to run e2fsck Theodore Ts'o
2009-07-10 18:09 ` Eric Sandeen
@ 2009-07-10 18:42 ` Andreas Dilger
2009-07-11 18:25 ` Theodore Tso
1 sibling, 1 reply; 4+ messages in thread
From: Andreas Dilger @ 2009-07-10 18:42 UTC (permalink / raw)
To: Theodore Ts'o; +Cc: Ext4 Developers List
On Jul 10, 2009 14:07 -0400, Theodore Ts'o wrote:
> If the resize operation fails in the middle of the operation, mark the
> filesystem as needing to be checked, and tell the user that they
> should run e2fsck -fy on the device.
Isn't it a bit late to mark the filesystem inconsistent AFTER the resize
failed? If resize2fs dies for some reason it won't be marked. It makes
more sense to mark the filesystem in error at the start (at first change
at least) and then clear it if there was no error.
> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
> ---
> resize/main.c | 7 ++++++-
> 1 files changed, 6 insertions(+), 1 deletions(-)
>
> diff --git a/resize/main.c b/resize/main.c
> index 2dae161..990a967 100644
> --- a/resize/main.c
> +++ b/resize/main.c
> @@ -455,7 +455,12 @@ int main (int argc, char ** argv)
> if (retval) {
> com_err(program_name, retval, _("while trying to resize %s"),
> device_name);
> - ext2fs_close (fs);
> + fprintf(stderr,
> + _("Please run 'e2fsck -fy %s' to fix the filesystem\n"
> + "after the aborted resize operation"), device_name);
> + fs->super->s_state |= EXT2_ERROR_FS;
> + ext2fs_mark_super_dirty(fs);
> + ext2fs_close(fs);
> exit(1);
> }
> printf(_("The filesystem on %s is now %u blocks long.\n\n"),
> --
> 1.6.3.2.1.gb9f7d.dirty
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
Cheers, Andreas
--
Andreas Dilger
Sr. Staff Engineer, Lustre Group
Sun Microsystems of Canada, Inc.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] resize2fs: If resize2fs fails, tell the user to run e2fsck
2009-07-10 18:42 ` Andreas Dilger
@ 2009-07-11 18:25 ` Theodore Tso
0 siblings, 0 replies; 4+ messages in thread
From: Theodore Tso @ 2009-07-11 18:25 UTC (permalink / raw)
To: Andreas Dilger; +Cc: Ext4 Developers List
On Fri, Jul 10, 2009 at 12:42:55PM -0600, Andreas Dilger wrote:
> On Jul 10, 2009 14:07 -0400, Theodore Ts'o wrote:
> > If the resize operation fails in the middle of the operation, mark the
> > filesystem as needing to be checked, and tell the user that they
> > should run e2fsck -fy on the device.
>
> Isn't it a bit late to mark the filesystem inconsistent AFTER the resize
> failed? If resize2fs dies for some reason it won't be marked. It makes
> more sense to mark the filesystem in error at the start (at first change
> at least) and then clear it if there was no error.
Good point.
- Ted
>From 96cdb37e27ff101fb23cefe422b4f77fb55209be Mon Sep 17 00:00:00 2001
From: Theodore Ts'o <tytso@mit.edu>
Date: Fri, 10 Jul 2009 13:14:00 -0400
Subject: [PATCH -V2] resize2fs: If resize2fs fails, tell the user to run e2fsck
If the resize operation fails in the middle of the operation, mark the
filesystem as needing to be checked, and tell the user that they
should run e2fsck -fy on the device.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
---
resize/main.c | 9 +++++++--
resize/resize2fs.c | 5 +++++
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/resize/main.c b/resize/main.c
index 2dae161..c6cbb5e 100644
--- a/resize/main.c
+++ b/resize/main.c
@@ -445,7 +445,8 @@ int main (int argc, char ** argv)
device_name);
exit(1);
}
- printf("Resizing the filesystem on %s to %u (%dk) blocks.\n",
+ printf(_("Resizing the filesystem on "
+ "%s to %u (%dk) blocks.\n"),
device_name, new_size, fs->blocksize / 1024);
retval = resize_fs(fs, &new_size, flags,
((flags & RESIZE_PERCENT_COMPLETE) ?
@@ -455,7 +456,11 @@ int main (int argc, char ** argv)
if (retval) {
com_err(program_name, retval, _("while trying to resize %s"),
device_name);
- ext2fs_close (fs);
+ fprintf(stderr,
+ _("Please run 'e2fsck -fy %s' to fix the filesystem\n"
+ "after the aborted resize operation.\n"),
+ device_name);
+ ext2fs_close(fs);
exit(1);
}
printf(_("The filesystem on %s is now %u blocks long.\n\n"),
diff --git a/resize/resize2fs.c b/resize/resize2fs.c
index d907c9c..c0b00b6 100644
--- a/resize/resize2fs.c
+++ b/resize/resize2fs.c
@@ -84,6 +84,10 @@ errcode_t resize_fs(ext2_filsys fs, blk_t *new_size, int flags,
if (retval)
return retval;
+ fs->super->s_state |= EXT2_ERROR_FS;
+ ext2fs_mark_super_dirty(fs);
+ ext2fs_flush(fs);
+
/*
* Create the data structure
*/
@@ -153,6 +157,7 @@ errcode_t resize_fs(ext2_filsys fs, blk_t *new_size, int flags,
if (retval)
goto errout;
+ rfs->new_fs->super->s_state &= ~EXT2_ERROR_FS;
rfs->new_fs->flags &= ~EXT2_FLAG_MASTER_SB_ONLY;
retval = ext2fs_close(rfs->new_fs);
if (retval)
--
1.6.3.2.1.gb9f7d.dirty
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-07-11 18:25 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-10 18:07 [PATCH] resize2fs: If resize2fs fails, tell the user to run e2fsck Theodore Ts'o
2009-07-10 18:09 ` Eric Sandeen
2009-07-10 18:42 ` Andreas Dilger
2009-07-11 18:25 ` Theodore Tso
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).