summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2011-11-20 16:13:06 -0500
committerTheodore Ts'o <tytso@mit.edu>2011-11-20 16:16:41 -0500
commit3f6fbf95c0f1c1dc2fc70692ee3e6c49f170df80 (patch)
tree1d6a18e57bf909d90e3d30aa307cf33c880f8ebc
parent13dcce8bb46961fcab14e87343e25aaebef7f44c (diff)
downloade2fsprogs-3f6fbf95c0f1c1dc2fc70692ee3e6c49f170df80.tar.gz
resize2fs: treat EINVAL to mean the new resize ioctl does not exist
Linux's compat_sys_ioctl() function, which is run when executing a ioctl using a 32-bit binary on a 64-bit kernel, returns EINVAL when an inode does not exist. Sigh. See /usr/src/linux/fs/compat_ioctl.c. This is probably a kernel bug, but work around it for now. Addresses-Debian-Bug: #644989 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
-rw-r--r--resize/online.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/resize/online.c b/resize/online.c
index 1a77839e..966ea1e0 100644
--- a/resize/online.c
+++ b/resize/online.c
@@ -76,8 +76,17 @@ errcode_t online_resize_fs(ext2_filsys fs, const char *mtpt,
* 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
+ *
+ * Sigh, if we are running a 32-bit binary on a 64-bit
+ * kernel (which happens all the time on the MIPS
+ * architecture in Debian, but can happen on other CPU
+ * architectures as well) we will get EINVAL returned
+ * when an ioctl doesn't exist, at least up to Linux
+ * 3.1. See compat_sys_ioctl() in fs/compat_ioctl.c
+ * in the kernel sources. This is probably a kernel
+ * bug, but work around it here.
*/
- if (errno != ENOTTY) {
+ if ((errno != ENOTTY) && (errno != EINVAL)) {
if (errno == EPERM)
com_err(program_name, 0,
_("Permission denied to resize filesystem"));