summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Czerner <lczerner@redhat.com>2011-10-16 18:18:51 -0400
committerTheodore Ts'o <tytso@mit.edu>2011-10-16 18:18:51 -0400
commitcacad7d641ef821ca7983d9dc0304baa9beaf3de (patch)
tree098f25055fe3c9d74382a312f99541baaf253606
parent3871db6d14e4fb1e0a9f269cf7873eaaa9174f94 (diff)
downloade2fsprogs-cacad7d641ef821ca7983d9dc0304baa9beaf3de.tar.gz
resize2fs: Do not fail if EXT4_IOC_RESIZE_FS ioctl doesn't exist
Commit 9f6ba888f027ba added support for new online resize ioctl EXT4_IOC_RESIZE_FS. It is also trying to avoid failure when this ioctl() is not supported by the kernel however it is checking wrong error code (EINVAL). When the ioctl does not exist, errno is set to ENOTTY, so we should check for that, rather than EINVAL which means that ioctl arguments are not valid. So change the code to check for ENOTTY and allow resize2fs to try to use the old approach. Also add some comments. Addresses-Red-Hat-Bugzilla: #746284 Addresses-Debian-Bug: #644989 Signed-off-by: Lukas Czerner <lczerner@redhat.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
-rw-r--r--resize/online.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/resize/online.c b/resize/online.c
index 77290c28..1a77839e 100644
--- a/resize/online.c
+++ b/resize/online.c
@@ -72,7 +72,12 @@ errcode_t online_resize_fs(ext2_filsys fs, const char *mtpt,
}
if (ioctl(fd, EXT4_IOC_RESIZE_FS, new_size)) {
- if (errno != EINVAL) {
+ /*
+ * If kernel does not support EXT4_IOC_RESIZE_FS, use the
+ * old online resize. Note that the old approach does not
+ * handle >32 bit file systems
+ */
+ if (errno != ENOTTY) {
if (errno == EPERM)
com_err(program_name, 0,
_("Permission denied to resize filesystem"));