Maxim Perevedentsev
2016-Jun-22 13:43 UTC
[Libguestfs] [PATCH] ext: change e2fsck retcode processing during resize
e2fsck returns 1 in case of "file system errors corrected". We treat it as success in normal e2fsck, but fail if e2fsck is run by resize2fs. Change 'manual' execution of e2fsck to dedicated function call. --- daemon/ext2.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/daemon/ext2.c b/daemon/ext2.c index 5dd67c7..95a65ae 100644 --- a/daemon/ext2.c +++ b/daemon/ext2.c @@ -192,24 +192,18 @@ do_get_e2uuid (const char *device) static int if_not_mounted_run_e2fsck (const char *device) { - CLEANUP_FREE char *err = NULL; - int r, mounted; + int r = 0, mounted; mounted = is_device_mounted (device); if (mounted == -1) return -1; if (!mounted) { - r = commandf (NULL, &err, - COMMAND_FLAG_FOLD_STDOUT_ON_STDERR, - str_e2fsck, "-fy", device, NULL); - if (r == -1) { - reply_with_error ("%s", err); - return -1; - } + optargs_bitmask = GUESTFS_E2FSCK_FORCEALL_BITMASK; + r = do_e2fsck (device, 0, 1); } - return 0; + return r; } int -- 1.8.3.1
Richard W.M. Jones
2016-Jun-22 14:17 UTC
Re: [Libguestfs] [PATCH] ext: change e2fsck retcode processing during resize
On Wed, Jun 22, 2016 at 04:43:13PM +0300, Maxim Perevedentsev wrote:> e2fsck returns 1 in case of "file system errors corrected". > We treat it as success in normal e2fsck, but fail if e2fsck > is run by resize2fs. > > Change 'manual' execution of e2fsck to dedicated function call. > --- > daemon/ext2.c | 14 ++++---------- > 1 file changed, 4 insertions(+), 10 deletions(-) > > diff --git a/daemon/ext2.c b/daemon/ext2.c > index 5dd67c7..95a65ae 100644 > --- a/daemon/ext2.c > +++ b/daemon/ext2.c > @@ -192,24 +192,18 @@ do_get_e2uuid (const char *device) > static int > if_not_mounted_run_e2fsck (const char *device) > { > - CLEANUP_FREE char *err = NULL; > - int r, mounted; > + int r = 0, mounted; > > mounted = is_device_mounted (device); > if (mounted == -1) > return -1; > > if (!mounted) { > - r = commandf (NULL, &err, > - COMMAND_FLAG_FOLD_STDOUT_ON_STDERR, > - str_e2fsck, "-fy", device, NULL); > - if (r == -1) { > - reply_with_error ("%s", err); > - return -1; > - } > + optargs_bitmask = GUESTFS_E2FSCK_FORCEALL_BITMASK; > + r = do_e2fsck (device, 0, 1); > } > > - return 0; > + return r;Looks OK to me, ACK. Thanks, Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 100 libraries supported. http://fedoraproject.org/wiki/MinGW
Apparently Analagous Threads
- [PATCH 0/5] Fixes to resize2fs (RHBZ#755729, RHBZ#801640)
- [PATCH v2 1/3] ext2: tweak the error returned message of resize2fs-M(BZ755729)
- [PATCH] Fix a bug in e2fsck execution code
- [PATCH] collect list of called external commands
- [PATCH 09/27] daemon: Reimplement ‘mount’, ‘mount_ro’, ‘mount_options’, ‘mount_vfs’ APIs in OCaml.