public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: Lukas Czerner <lczerner@redhat.com>
To: linux-ext4@vger.kernel.org
Cc: tytso@mit.edu, xiaoqiangnk@gmail.com,
	Lukas Czerner <lczerner@redhat.com>
Subject: [PATCH] resize: Do not fail if EXT4_IOC_RESIZE_FS ioctl doesn't exist
Date: Fri, 14 Oct 2011 17:49:34 +0200	[thread overview]
Message-ID: <1318607374-17246-1-git-send-email-lczerner@redhat.com> (raw)

Commit 9f6ba888f027ba4daf57ac61a11a6dce98e42347 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.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
---

Btw I can not find the new kernel code anywhere. It is not in Linus tree,
it also is not in the github ext4 master, nor dev tree. Where it is then ?
The problem is that the recent released e2fsprogs are broken for all
kernels. To be more specific, resize2fs is broken for all kernels.


 resize/online.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/resize/online.c b/resize/online.c
index 77290c2..1a77839 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"));
-- 
1.7.4.4


             reply	other threads:[~2011-10-14 15:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-14 15:49 Lukas Czerner [this message]
2011-10-14 16:11 ` [PATCH] resize: Do not fail if EXT4_IOC_RESIZE_FS ioctl doesn't exist Eric Sandeen
2011-10-16  7:31 ` Amir Goldstein
2011-10-16 10:39   ` Lukas Czerner
2011-10-17  1:29 ` Yongqiang Yang
2011-10-17  6:56   ` Lukas Czerner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1318607374-17246-1-git-send-email-lczerner@redhat.com \
    --to=lczerner@redhat.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    --cc=xiaoqiangnk@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox