Patchwork [RESEND] mke2fs: fix force option to create filesystem on mounted device

login
register
mail settings
Submitter Kazuya Mio
Date Oct. 25, 2013, 8:40 a.m.
Message ID <526A2E83.5050102@sx.jp.nec.com>
Download mbox | patch
Permalink /patch/286101/
State Superseded
Headers show

Comments

Kazuya Mio - Oct. 25, 2013, 8:40 a.m.
According to mke2fs man, we can create a filesystem on the mounted device
when -FF option is specified.
However, currently we have to specify -F option third to force mke2fs.
This patch fixes the problem.

Signed-off-by: Kazuya Mio <k-mio@sx.jp.nec.com>
Reviewed-by: Zheng Liu <wenqing.lz@taobao.com>
---
 misc/util.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

--
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
Carlos Maiolino - Oct. 25, 2013, 3:30 p.m.
Looks good,

Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>

On Fri, Oct 25, 2013 at 05:40:35PM +0900, Kazuya Mio wrote:
> According to mke2fs man, we can create a filesystem on the mounted device
> when -FF option is specified.
> However, currently we have to specify -F option third to force mke2fs.
> This patch fixes the problem.
> 
> Signed-off-by: Kazuya Mio <k-mio@sx.jp.nec.com>
> Reviewed-by: Zheng Liu <wenqing.lz@taobao.com>
> ---
>  misc/util.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/misc/util.c b/misc/util.c
> index 6c93e1c..40c8858 100644
> --- a/misc/util.c
> +++ b/misc/util.c
> @@ -150,7 +150,7 @@ void check_mount(const char *device, int force, const char *type)
>  	}
>  	if (mount_flags & EXT2_MF_MOUNTED) {
>  		fprintf(stderr, _("%s is mounted; "), device);
> -		if (force > 2) {
> +		if (force >= 2) {
>  			fputs(_("mke2fs forced anyway.  Hope /etc/mtab is "
>  				"incorrect.\n"), stderr);
>  			return;
> @@ -162,7 +162,7 @@ void check_mount(const char *device, int force, const char *type)
>  	if (mount_flags & EXT2_MF_BUSY) {
>  		fprintf(stderr, _("%s is apparently in use by the system; "),
>  			device);
> -		if (force > 2) {
> +		if (force >= 2) {
>  			fputs(_("mke2fs forced anyway.\n"), stderr);
>  			return;
>  		}
> --
> 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

Patch

diff --git a/misc/util.c b/misc/util.c
index 6c93e1c..40c8858 100644
--- a/misc/util.c
+++ b/misc/util.c
@@ -150,7 +150,7 @@  void check_mount(const char *device, int force, const char *type)
 	}
 	if (mount_flags & EXT2_MF_MOUNTED) {
 		fprintf(stderr, _("%s is mounted; "), device);
-		if (force > 2) {
+		if (force >= 2) {
 			fputs(_("mke2fs forced anyway.  Hope /etc/mtab is "
 				"incorrect.\n"), stderr);
 			return;
@@ -162,7 +162,7 @@  void check_mount(const char *device, int force, const char *type)
 	if (mount_flags & EXT2_MF_BUSY) {
 		fprintf(stderr, _("%s is apparently in use by the system; "),
 			device);
-		if (force > 2) {
+		if (force >= 2) {
 			fputs(_("mke2fs forced anyway.\n"), stderr);
 			return;
 		}