All of lore.kernel.org
 help / color / mirror / Atom feed
From: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
To: Denis Karpov <ext-denis.2.karpov@nokia.com>
Cc: lkml@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	adrian.hunter@nokia.com, artem.bityutskiy@nokia.com
Subject: Re: [PATCH 1/5] FAT: add 'errors' mount option
Date: Wed, 03 Jun 2009 11:49:22 +0900	[thread overview]
Message-ID: <87fxeinia5.fsf@devron.myhome.or.jp> (raw)
In-Reply-To: <d5dd6887ad284b7528bf70aa21bd33dd9c98eb4c.1243863850.git.ext-denis.2.karpov@nokia.com> (Denis Karpov's message of "Mon, 1 Jun 2009 17:28:10 +0300")

Denis Karpov <ext-denis.2.karpov@nokia.com> writes:

> +#define FAT_ERRORS_CONT		0x1
> +#define FAT_ERRORS_PANIC	0x2
> +#define FAT_ERRORS_RO		0x4

I think this should be scalar? (i.e. 1, 2, 3)

>  struct fat_mount_options {
>  	uid_t fs_uid;
>  	gid_t fs_gid;
> @@ -39,7 +43,8 @@ struct fat_mount_options {
>  		 nocase:1,	  /* Does this need case conversion? 0=need case conversion*/
>  		 usefree:1,	  /* Use free_clusters for FAT32 */
>  		 tz_utc:1,	  /* Filesystem timestamps are in UTC */
> -		 rodir:1;	  /* allow ATTR_RO for directory */
> +		 rodir:1,	  /* allow ATTR_RO for directory */
> +		 errors:3;	  /* On error: continue, panic, go ro */
>  };

Please use "unsigned char errors", instead of bit filed. Below of
name_check would have 1 byte hole.

> @@ -834,6 +834,12 @@ static int fat_show_options(struct seq_file *m, struct vfsmount *mnt)
>  		seq_puts(m, ",flush");
>  	if (opts->tz_utc)
>  		seq_puts(m, ",tz=UTC");
> +	if (opts->errors & FAT_ERRORS_CONT)
> +		seq_puts(m, ",errors=continue");
> +	if (opts->errors & FAT_ERRORS_PANIC)
> +		seq_puts(m, ",errors=panic");
> +	if (opts->errors & FAT_ERRORS_RO)
> +		seq_puts(m, ",errors=ro");

Also this should be scalar?

	if (opts->errors == FAT_ERRORS_CONT)
		seq_puts(m, ",errors=continue");
	else if (opts->errors == FAT_ERRORS_PANIC)
		seq_puts(m, ",errors=panic");
	else
		seq_puts(m, ",errors=ro");

>  static const match_table_t fat_tokens = {
> @@ -882,6 +889,9 @@ static const match_table_t fat_tokens = {
>  	{Opt_obsolate, "posix"},
>  	{Opt_flush, "flush"},
>  	{Opt_tz_utc, "tz=UTC"},
> +	{Opt_err_cont, "errors=continue"},
> +	{Opt_err_panic, "errors=panic"},
> +	{Opt_err_ro, "errors=remount-ro"},
>  	{Opt_err, NULL},
>  };
>  static const match_table_t msdos_tokens = {
> @@ -889,6 +899,9 @@ static const match_table_t msdos_tokens = {
>  	{Opt_nodots, "dotsOK=no"},
>  	{Opt_dots, "dots"},
>  	{Opt_dots, "dotsOK=yes"},
> +	{Opt_err_cont, "errors=continue"},
> +	{Opt_err_panic, "errors=panic"},
> +	{Opt_err_ro, "errors=remount-ro"},
>  	{Opt_err, NULL}
>  };
>  static const match_table_t vfat_tokens = {
> @@ -919,6 +932,9 @@ static const match_table_t vfat_tokens = {
>  	{Opt_nonumtail_yes, "nonumtail=true"},
>  	{Opt_nonumtail_yes, "nonumtail"},
>  	{Opt_rodir, "rodir"},
> +	{Opt_err_cont, "errors=continue"},
> +	{Opt_err_panic, "errors=panic"},
> +	{Opt_err_ro, "errors=remount-ro"},
>  	{Opt_err, NULL}
>  };

"fat_tokens" is used for the both of vfat and msdos. So, you don't need
to add those to "msdos/vfat_tokens".

> @@ -1043,6 +1059,15 @@ static int parse_options(char *options, int is_vfat, int silent, int *debug,
>  		case Opt_tz_utc:
>  			opts->tz_utc = 1;
>  			break;
> +		case Opt_err_cont:
> +			opts->errors = FAT_ERRORS_CONT;
> +			break;
> +		case Opt_err_panic:
> +			opts->errors = FAT_ERRORS_PANIC;
> +			break;
> +		case Opt_err_ro:
> +			opts->errors = FAT_ERRORS_RO;
> +			break;
>  
>  		/* msdos specific */
>  		case Opt_dots:
> @@ -1128,6 +1153,9 @@ out:
>  		opts->allow_utime = ~opts->fs_dmask & (S_IWGRP | S_IWOTH);
>  	if (opts->unicode_xlate)
>  		opts->utf8 = 0;
> +	/* Default behavior on fs errors - go r/o */
> +	if (!opts->errors)
> +		opts->errors = FAT_ERRORS_RO;

Is there any reason opts->errors isn't initialized with FAT_ERRORS_RO
like other options?

> +	if (sbi->options.errors & FAT_ERRORS_PANIC)
> +		panic("    FAT fs panic from previous error\n");
> +	if ((sbi->options.errors & FAT_ERRORS_RO) &&
> +				!(s->s_flags & MS_RDONLY)) {
>  		s->s_flags |= MS_RDONLY;
>  		printk(KERN_ERR "    File system has been set read-only\n");
>  	}
>  }

Also, scalar?
-- 
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

  parent reply	other threads:[~2009-06-03  2:49 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-01 14:28 [PATCH 0/5] FAT errors, user space notifications Denis Karpov
2009-06-01 14:28 ` [PATCH 1/5] FAT: add 'errors' mount option Denis Karpov
2009-06-01 14:34   ` Denis Karpov
2009-06-01 14:28   ` [PATCH 2/5] FS: filesystem corruption notification Denis Karpov
2009-06-01 14:34     ` Denis Karpov
2009-06-01 14:28   ` [PATCH 3/5] FAT: generalize errors and warning printing Denis Karpov
2009-06-01 14:34     ` Denis Karpov
2009-06-01 14:28   ` [PATCH 4/5] FAT: add 'notify' mount option Denis Karpov
2009-06-01 14:34     ` Denis Karpov
2009-06-01 14:28   ` [PATCH 5/5] EXT2: " Denis Karpov
2009-06-01 14:34     ` Denis Karpov
2009-06-03  2:49   ` OGAWA Hirofumi [this message]
2009-06-03  9:20     ` [PATCH 1/5] FAT: add 'errors' " Denis Karpov
2009-06-04  3:54       ` OGAWA Hirofumi
2009-06-03  3:08 ` [PATCH 0/5] FAT errors, user space notifications OGAWA Hirofumi
2009-06-03 11:36   ` Denis Karpov
2009-06-03 15:13     ` OGAWA Hirofumi
  -- strict thread matches above, loose matches on Subject: below --
2009-06-01 14:34 [PATCH 0/5] FAT errors, userspace notifications Denis Karpov
2009-06-10 21:01 ` Pavel Machek

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=87fxeinia5.fsf@devron.myhome.or.jp \
    --to=hirofumi@mail.parknet.co.jp \
    --cc=adrian.hunter@nokia.com \
    --cc=artem.bityutskiy@nokia.com \
    --cc=ext-denis.2.karpov@nokia.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=lkml@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.