All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: Denis Karpov <ext-denis.2.karpov@nokia.com>
Cc: axboe@kernel.dk, akpm@linux-foundation.org,
	hirofumi@mail.parknet.co.jp, linux-ext4@vger.kernel.org,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	adrian.hunter@nokia.com, artem.bityutskiy@nokia.com,
	tytso@mit.edu
Subject: Re: [PATCH 4/4] EXT2: add 'notify' mount option
Date: Wed, 10 Jun 2009 23:03:13 +0200	[thread overview]
Message-ID: <20090610210313.GD1381@ucw.cz> (raw)
In-Reply-To: <60607de38c1ebbd1ba1cb33d85f1dcdec77f3c61.1244049681.git.ext-denis.2.karpov@nokia.com>

On Wed 2009-06-03 18:05:18, Denis Karpov wrote:
> Implement EXT2 fs mount option 'notify'. The effect of this option
> is that a notification is sent to userspace on errors that indicate
> filesystem damage/inconsistency. Generic filesystem corruption
> notification mechnism is used.

By the time you start checking volume, you may have already damaged
data, right?

(Imagine two inodes pointing to same block, lets say /etc/shadow and
/tmp/foo. Writes to /tmp/foo will now kill your passwords. fsck would
duplicate the blocks, but I do not think internal checking in ext2
would catch it soon enough).

> Signed-off-by: Denis Karpov <ext-denis.2.karpov@nokia.com>
> ---
>  fs/ext2/super.c         |   15 ++++++++++++++-
>  include/linux/ext2_fs.h |    2 +-
>  2 files changed, 15 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/ext2/super.c b/fs/ext2/super.c
> index 5c4afe6..04802cd 100644
> --- a/fs/ext2/super.c
> +++ b/fs/ext2/super.c
> @@ -32,6 +32,7 @@
>  #include <linux/mount.h>
>  #include <linux/log2.h>
>  #include <linux/quotaops.h>
> +#include <linux/genhd.h>
>  #include <asm/uaccess.h>
>  #include "ext2.h"
>  #include "xattr.h"
> @@ -68,6 +69,8 @@ void ext2_error (struct super_block * sb, const char * function,
>  		printk("Remounting filesystem read-only\n");
>  		sb->s_flags |= MS_RDONLY;
>  	}
> +	if (test_opt(sb, ERR_NOTIFY))
> +		notify_part_fs_unclean(part_to_dev(sb->s_bdev->bd_part), 1);
>  }
>  
>  void ext2_warning (struct super_block * sb, const char * function,
> @@ -81,6 +84,8 @@ void ext2_warning (struct super_block * sb, const char * function,
>  	vprintk(fmt, args);
>  	printk("\n");
>  	va_end(args);
> +	if (test_opt(sb, ERR_NOTIFY))
> +		notify_part_fs_unclean(part_to_dev(sb->s_bdev->bd_part), 1);
>  }
>  
>  void ext2_update_dynamic_rev(struct super_block *sb)
> @@ -289,6 +294,9 @@ static int ext2_show_options(struct seq_file *seq, struct vfsmount *vfs)
>  	if (!test_opt(sb, RESERVATION))
>  		seq_puts(seq, ",noreservation");
>  
> +	if (!test_opt(sb, ERR_NOTIFY))
> +		seq_puts(seq, ",notify");
> +
>  	return 0;
>  }
>  
> @@ -391,7 +399,8 @@ enum {
>  	Opt_err_ro, Opt_nouid32, Opt_nocheck, Opt_debug,
>  	Opt_oldalloc, Opt_orlov, Opt_nobh, Opt_user_xattr, Opt_nouser_xattr,
>  	Opt_acl, Opt_noacl, Opt_xip, Opt_ignore, Opt_err, Opt_quota,
> -	Opt_usrquota, Opt_grpquota, Opt_reservation, Opt_noreservation
> +	Opt_usrquota, Opt_grpquota, Opt_reservation, Opt_noreservation,
> +	Opt_err_notify,
>  };
>  
>  static const match_table_t tokens = {
> @@ -425,6 +434,7 @@ static const match_table_t tokens = {
>  	{Opt_usrquota, "usrquota"},
>  	{Opt_reservation, "reservation"},
>  	{Opt_noreservation, "noreservation"},
> +	{Opt_err_notify, "notify"},
>  	{Opt_err, NULL}
>  };
>  
> @@ -565,6 +575,9 @@ static int parse_options (char * options,
>  			clear_opt(sbi->s_mount_opt, RESERVATION);
>  			printk("reservations OFF\n");
>  			break;
> +		case Opt_err_notify:
> +			set_opt(sbi->s_mount_opt, ERR_NOTIFY);
> +			break;
>  		case Opt_ignore:
>  			break;
>  		default:
> diff --git a/include/linux/ext2_fs.h b/include/linux/ext2_fs.h
> index 121720d..ecec20b 100644
> --- a/include/linux/ext2_fs.h
> +++ b/include/linux/ext2_fs.h
> @@ -347,7 +347,7 @@ struct ext2_inode {
>  #define EXT2_MOUNT_USRQUOTA		0x020000  /* user quota */
>  #define EXT2_MOUNT_GRPQUOTA		0x040000  /* group quota */
>  #define EXT2_MOUNT_RESERVATION		0x080000  /* Preallocation */
> -
> +#define EXT2_MOUNT_ERR_NOTIFY		0x100000  /* Error notifications */
>  
>  #define clear_opt(o, opt)		o &= ~EXT2_MOUNT_##opt
>  #define set_opt(o, opt)			o |= EXT2_MOUNT_##opt

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

  parent reply	other threads:[~2009-06-10 21:03 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-03 15:05 [PATCH 0/4] FS: userspace notification of errors Denis Karpov
2009-06-03 15:05 ` [PATCH 1/4] FS: filesystem corruption notification Denis Karpov
2009-06-03 15:05   ` [PATCH 2/4] FAT: generalize errors and warning printing Denis Karpov
2009-06-03 15:05   ` [PATCH 3/4] FAT: add 'notify' mount option Denis Karpov
2009-06-03 18:59     ` Andrew Morton
2009-06-03 15:05   ` [PATCH 4/4] EXT2: " Denis Karpov
2009-06-03 19:00     ` Andrew Morton
2009-06-10 21:03     ` Pavel Machek [this message]
2009-06-03 18:58   ` [PATCH 1/4] FS: filesystem corruption notification Andrew Morton
2009-06-03 15:36 ` [PATCH 0/4] FS: userspace notification of errors Eric Sandeen
2009-06-03 18:56 ` Andrew Morton
2009-06-04  1:59   ` Jamie Lokier
2009-06-04  5:57   ` Artem Bityutskiy
2009-06-04  5:57     ` Artem Bityutskiy
2009-06-04 14:27     ` Denis Karpov
2009-06-10 21:03       ` Pavel Machek
2009-06-10 21:03         ` Pavel Machek
2009-06-10 21:05     ` Pavel Machek
2009-06-04 12:53   ` Kay Sievers
2009-06-04 12:53     ` Kay Sievers
2009-06-04 14:29     ` Russell Cattelan
2009-06-05  7:25     ` Jon Masters
2009-06-05 11:07     ` Artem Bityutskiy
2009-06-05 11:07       ` Artem Bityutskiy
2009-06-05 11:51       ` Denis Karpov
2009-06-05 13:06         ` Kay Sievers
2009-06-05 13:06           ` Kay Sievers
2009-06-09 13:49           ` Jan Kara
2009-06-05 13:06         ` Kay Sievers
2009-06-03 22:30 ` Jan Kara
2009-06-04  6:10   ` Artem Bityutskiy
2009-06-04  6:10     ` Artem Bityutskiy

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=20090610210313.GD1381@ucw.cz \
    --to=pavel@ucw.cz \
    --cc=adrian.hunter@nokia.com \
    --cc=akpm@linux-foundation.org \
    --cc=artem.bityutskiy@nokia.com \
    --cc=axboe@kernel.dk \
    --cc=ext-denis.2.karpov@nokia.com \
    --cc=hirofumi@mail.parknet.co.jp \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tytso@mit.edu \
    /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.