public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC][PATCH] Multiple mount protection
@ 2007-05-21 19:52 Kalpak Shah
  2007-05-22  7:15 ` Manoj Joseph
                   ` (2 more replies)
  0 siblings, 3 replies; 21+ messages in thread
From: Kalpak Shah @ 2007-05-21 19:52 UTC (permalink / raw)
  To: linux-ext4; +Cc: Andreas Dilger

Hi,

There have been reported instances of a filesystem having been mounted at 2 places at the same time causing a lot of damage to the filesystem. This patch reserves superblock fields and an INCOMPAT flag for adding multiple mount protection(MMP) support within the ext4 filesystem itself. The superblock will have a block number (s_mmp_block) which will hold a MMP structure which has a sequence number which will be periodically updated every 5 seconds by a mounted filesystem. Whenever a filesystem will be mounted it will wait for s_mmp_interval seconds to make sure that the MMP sequence does not change. To further make sure, we write a random sequence number into the MMP block and wait for another s_mmp_interval secs. If the sequence no. doesn't change then the mount will succeed. In case of failure, the nodename, bdevname and the time at which the MMP block was last updated will be displaye
 d. tune2fs can be used to set s_mmp_interval as desired.

It will also protect against running e2fsck on a mounted filesystem by adding similar logic to ext2fs_open().

Any comments or views are welcome!

Signed-off-by: Andreas Dilger <adilger@clusterfs.com>
Signed-off-by: Kalpak Shah <kalpak@clusterfs.com>

Index: e2fsprogs-1.40/lib/ext2fs/ext2_fs.h
===================================================================
--- e2fsprogs-1.40.orig/lib/ext2fs/ext2_fs.h
+++ e2fsprogs-1.40/lib/ext2fs/ext2_fs.h
@@ -568,8 +568,9 @@ struct ext2_super_block {
        __u16   s_want_extra_isize;     /* New inodes should reserve # bytes */
        __u32   s_flags;                /* Miscellaneous flags */
        __u16   s_raid_stride;          /* RAID stride */
-       __u16   s_pad;                  /* Padding */
-       __u32   s_reserved[166];        /* Padding to the end of the block */
+       __u16   s_mmp_interval;         /* Wait for # seconds in MMP checking */
+       __u64   s_mmp_block;            /* Block for multi-mount protection */
+       __u32   s_reserved[164];        /* Padding to the end of the block */
 };

 /*
@@ -631,10 +632,12 @@ struct ext2_super_block {
 #define EXT2_FEATURE_INCOMPAT_META_BG          0x0010
 #define EXT3_FEATURE_INCOMPAT_EXTENTS          0x0040
 #define EXT4_FEATURE_INCOMPAT_64BIT            0x0080
+#define EXT4_FEATURE_INCOMPAT_MMP              0x0100


 #define EXT2_FEATURE_COMPAT_SUPP       0
-#define EXT2_FEATURE_INCOMPAT_SUPP     (EXT2_FEATURE_INCOMPAT_FILETYPE)
+#define EXT2_FEATURE_INCOMPAT_SUPP     (EXT2_FEATURE_INCOMPAT_FILETYPE| \
+                                        EXT4_FEATURE_INCOMPAT_MMP)
 #define EXT2_FEATURE_RO_COMPAT_SUPP    (EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER| \
                                         EXT2_FEATURE_RO_COMPAT_LARGE_FILE| \
                                         EXT2_FEATURE_RO_COMPAT_BTREE_DIR)


Thanks,
Kalpak.

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

end of thread, other threads:[~2007-06-01 18:00 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-21 19:52 [RFC][PATCH] Multiple mount protection Kalpak Shah
2007-05-22  7:15 ` Manoj Joseph
2007-05-22  7:34   ` Kalpak Shah
2007-05-22  7:53     ` Manoj Joseph
2007-05-22  8:06       ` Kalpak Shah
2007-05-24 23:25     ` Karel Zak
2007-05-25  6:44       ` Kalpak Shah
2007-05-25 14:39 ` Theodore Tso
2007-05-25 19:31   ` Jim Garlick
2007-05-25 21:36   ` Kalpak Shah
2007-05-30 20:58     ` Kalpak Shah
2007-05-31 16:16       ` Theodore Tso
2007-05-31 21:09         ` Kalpak Shah
2007-06-01  8:46 ` Andi Kleen
2007-06-01  8:27   ` Kalpak Shah
2007-06-01  9:14   ` Andreas Dilger
2007-06-01 10:56     ` Andi Kleen
2007-06-01 11:41   ` Theodore Tso
2007-06-01 12:13     ` Andi Kleen
2007-06-01 13:52       ` Theodore Tso
2007-06-01 18:00         ` Andreas Dilger

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