summaryrefslogtreecommitdiffstats
path: root/daemon/ext2.c
diff options
context:
space:
mode:
authorRichard Jones <rjones@redhat.com>2010-03-24 23:28:14 +0000
committerRichard Jones <rjones@redhat.com>2010-03-24 23:28:14 +0000
commit00a9ae7365e6bad258bcf079a18dcae94d0853ad (patch)
treea113f1889d148db28e1217dced3e49887cb89c07 /daemon/ext2.c
parentc4e8aa245a243b020d6b7bd832674be871a43610 (diff)
downloadlibguestfs-00a9ae7365e6bad258bcf079a18dcae94d0853ad.tar.gz
libguestfs-00a9ae7365e6bad258bcf079a18dcae94d0853ad.tar.xz
libguestfs-00a9ae7365e6bad258bcf079a18dcae94d0853ad.zip
Fix lvresize test on RHEL 5, by fixing guestfs_e2fsck_l.
The problem is that mkfs was making an ext2 filesystem, which later we were checking with e4fsck. e4fsck corrects an "error" on the filesystem: /dev/VG/LV: Adding dirhash hint to filesystem. e4fsck returns 1 (errors corrected) which we were interpreting as an error return.
Diffstat (limited to 'daemon/ext2.c')
-rw-r--r--daemon/ext2.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/daemon/ext2.c b/daemon/ext2.c
index ff6459b4..c90ee05c 100644
--- a/daemon/ext2.c
+++ b/daemon/ext2.c
@@ -310,8 +310,15 @@ do_e2fsck_f (const char *device)
if (e2prog (prog) == -1)
return -1;
- r = command (NULL, &err, prog, "-p", "-f", device, NULL);
- if (r == -1) {
+ /* 0 = no errors, 1 = errors corrected.
+ *
+ * >= 4 means uncorrected or other errors.
+ *
+ * 2, 3 means errors were corrected and we require a reboot. This is
+ * a difficult corner case.
+ */
+ r = commandr (NULL, &err, prog, "-p", "-f", device, NULL);
+ if (r == -1 || r >= 2) {
reply_with_error ("%s", err);
free (err);
return -1;