public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] resize: Do not fail if EXT4_IOC_RESIZE_FS ioctl doesn't exist
@ 2011-10-14 15:49 Lukas Czerner
  2011-10-14 16:11 ` Eric Sandeen
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Lukas Czerner @ 2011-10-14 15:49 UTC (permalink / raw)
  To: linux-ext4; +Cc: tytso, xiaoqiangnk, Lukas Czerner

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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] resize: Do not fail if EXT4_IOC_RESIZE_FS ioctl doesn't exist
  2011-10-14 15:49 [PATCH] resize: Do not fail if EXT4_IOC_RESIZE_FS ioctl doesn't exist Lukas Czerner
@ 2011-10-14 16:11 ` Eric Sandeen
  2011-10-16  7:31 ` Amir Goldstein
  2011-10-17  1:29 ` Yongqiang Yang
  2 siblings, 0 replies; 6+ messages in thread
From: Eric Sandeen @ 2011-10-14 16:11 UTC (permalink / raw)
  To: Lukas Czerner; +Cc: linux-ext4, tytso, xiaoqiangnk

On 10/14/11 10:49 AM, Lukas Czerner wrote:
> 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>

Makes sense, thanks.

Reviewed-by: Eric Sandeen <sandeen@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"));


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] resize: Do not fail if EXT4_IOC_RESIZE_FS ioctl doesn't exist
  2011-10-14 15:49 [PATCH] resize: Do not fail if EXT4_IOC_RESIZE_FS ioctl doesn't exist Lukas Czerner
  2011-10-14 16:11 ` Eric Sandeen
@ 2011-10-16  7:31 ` Amir Goldstein
  2011-10-16 10:39   ` Lukas Czerner
  2011-10-17  1:29 ` Yongqiang Yang
  2 siblings, 1 reply; 6+ messages in thread
From: Amir Goldstein @ 2011-10-16  7:31 UTC (permalink / raw)
  To: Lukas Czerner, Theodore Tso; +Cc: linux-ext4, xiaoqiangnk

On Fri, Oct 14, 2011 at 5:49 PM, Lukas Czerner <lczerner@redhat.com> wrote:
> 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 ?

AFAIK, the latest version of the patches is here:
https://github.com/YANGYongqiang/ext4-patch-queue

and I suppose Ted should have it in patchworks as well.

Ted,

Are you planning to merge new online resize for 3.2?

Thanks,
Amir.



> 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
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] resize: Do not fail if EXT4_IOC_RESIZE_FS ioctl doesn't exist
  2011-10-16  7:31 ` Amir Goldstein
@ 2011-10-16 10:39   ` Lukas Czerner
  0 siblings, 0 replies; 6+ messages in thread
From: Lukas Czerner @ 2011-10-16 10:39 UTC (permalink / raw)
  To: Amir Goldstein; +Cc: Lukas Czerner, Theodore Tso, linux-ext4, xiaoqiangnk

[-- Attachment #1: Type: TEXT/PLAIN, Size: 2763 bytes --]

On Sun, 16 Oct 2011, Amir Goldstein wrote:

> On Fri, Oct 14, 2011 at 5:49 PM, Lukas Czerner <lczerner@redhat.com> wrote:
> > 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 ?
> 
> AFAIK, the latest version of the patches is here:
> https://github.com/YANGYongqiang/ext4-patch-queue
> 
> and I suppose Ted should have it in patchworks as well.
> 
> Ted,
> 
> Are you planning to merge new online resize for 3.2?

Thanks Amir,

also it would be nice if the kernel functionality was merged before the
corresponding user-space tools as I thought it is the right course of
action.

Also Ted, could you merge this patch ASAP, since the online resize2fs is
unusable in the current state.

Thanks!
-Lukas

> 
> Thanks,
> Amir.
> 
> 
> 
> > 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
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> >
> 

-- 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] resize: Do not fail if EXT4_IOC_RESIZE_FS ioctl doesn't exist
  2011-10-14 15:49 [PATCH] resize: Do not fail if EXT4_IOC_RESIZE_FS ioctl doesn't exist Lukas Czerner
  2011-10-14 16:11 ` Eric Sandeen
  2011-10-16  7:31 ` Amir Goldstein
@ 2011-10-17  1:29 ` Yongqiang Yang
  2011-10-17  6:56   ` Lukas Czerner
  2 siblings, 1 reply; 6+ messages in thread
From: Yongqiang Yang @ 2011-10-17  1:29 UTC (permalink / raw)
  To: Lukas Czerner; +Cc: linux-ext4, tytso

On Fri, Oct 14, 2011 at 11:49 PM, Lukas Czerner <lczerner@redhat.com> wrote:
> 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
> +                */
Great comment !
> +               if (errno != ENOTTY) {
In my working tree, it has been ENOTTY but there is no comment.  And I
found EINVAL was introduced in commit
200569608fc6e33f6546(https://github.com/tytso/e2fsprogs/commit/200569608fc6e33f6546c17999f14fb5dbb0b9b5)
to fix some bugs and reason is listed.


Yongqiang.
>                        if (errno == EPERM)
>                                com_err(program_name, 0,
>                                _("Permission denied to resize filesystem"));
> --
> 1.7.4.4
>
>



-- 
Best Wishes
Yongqiang Yang
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] resize: Do not fail if EXT4_IOC_RESIZE_FS ioctl doesn't exist
  2011-10-17  1:29 ` Yongqiang Yang
@ 2011-10-17  6:56   ` Lukas Czerner
  0 siblings, 0 replies; 6+ messages in thread
From: Lukas Czerner @ 2011-10-17  6:56 UTC (permalink / raw)
  To: Yongqiang Yang; +Cc: Lukas Czerner, linux-ext4, tytso

[-- Attachment #1: Type: TEXT/PLAIN, Size: 2418 bytes --]

On Mon, 17 Oct 2011, Yongqiang Yang wrote:

> On Fri, Oct 14, 2011 at 11:49 PM, Lukas Czerner <lczerner@redhat.com> wrote:
> > 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
> > +                */
> Great comment !
> > +               if (errno != ENOTTY) {
> In my working tree, it has been ENOTTY but there is no comment.  And I
> found EINVAL was introduced in commit
> 200569608fc6e33f6546(https://github.com/tytso/e2fsprogs/commit/200569608fc6e33f6546c17999f14fb5dbb0b9b5)
> to fix some bugs and reason is listed.

Oh, I am sorry. I have missed the line in git blame. You're right it was
originally ENOTTY, thanks!

-Lukas

> 
> 
> Yongqiang.
> >                        if (errno == EPERM)
> >                                com_err(program_name, 0,
> >                                _("Permission denied to resize filesystem"));
> > --
> > 1.7.4.4
> >
> >
> 
> 
> 
> 

-- 

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-10-17  6:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-14 15:49 [PATCH] resize: Do not fail if EXT4_IOC_RESIZE_FS ioctl doesn't exist Lukas Czerner
2011-10-14 16:11 ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox