Please don't reply to lustre-devel. Instead, comment in Bugzilla by using the 
following link:
https://bugzilla.lustre.org/show_bug.cgi?id=10651



(In reply to comment #18)
> >@@ -591,9 +593,17 @@ got:
> >+    if (EXT3_HAS_RO_COMPAT_FEATURE(sb, EXT3_FEATURE_RO_COMPAT_EXTRA_ISIZE)) 
> >{
> >+            ei->i_extra_isize = MAX(sb->s_min_extra_isize,
> >+                                    MAX(sb->s_want_extra_isize,
> >+                                            sizeof(struct ext3_inode) -
> >+                                                 EXT3_GOOD_OLD_INODE_SIZE));
> >+    }
> >+    else
> >+            ei->i_extra_isize =
> >+                     (EXT3_INODE_SIZE(inode->i_sb) > 
> >EXT3_GOOD_OLD_INODE_SIZE) ?
> >+                          sizeof(struct ext3_inode) - 
> >EXT3_GOOD_OLD_INODE_SIZE : 0;
> 
> Hmm, it seems concievable (though it would be incorrect) to have
> RO_COMPAT_EXTRA_ISIZE set on a filesystem with inodes of
> EXT3_GOOD_OLD_INODE_SIZE, and in this case the above would corrupt the
> filesystem.  How about in ext3_fill_super():
> 
>       /* determine the minimum size of new large inodes, if present */
>       if (EXT3_INODE_SIZE(inode->i_sb) > EXT3_GOOD_OLD_INODE_SIZE) {
>                 EXT3_SB(sb)->s_want_extra_isize = sizeof(struct ext3_inode) -
>                                                   EXT3_GOOD_OLD_INODE_SIZE;
>                 if (EXT3_HAS_RO_COMPAT_FEATURE(sb,
> EXT3_FEATURE_RO_COMPAT_EXTRA_ISIZE))
>                         if (EXT3_SB(sb)->s_want_extra_isize <
>                            
> le32_to_cpu(EXT3_SB(sb)->s_es->s_want_extra_isize))
>                                
> le32_to_cpu(EXT3_SB(sb)->s_es->s_want_extra_isize);
>                         if (EXT3_SB(sb)->s_want_extra_isize <
>                            
> le32_to_cpu(EXT3_SB(sb)->s_es->s_min_extra_isize))
>                                
> le32_to_cpu(EXT3_SB(sb)->s_es->s_min_extra_isize);
>        }
> 
> and here in ext3_new_inode() we only need:
> 
>       ei->i_extra_isize = EXT3_SB(sb)->s_want_extra_isize;
> 
> We _might_ want to change this so that it will take s_want_extra_isize from 
> the
> on-disk superblock each time, so that if tune2fs is used while the filesystem
> is in use then it will pick up this new value immediately.  We might also want
> to verify that s_{want,min}_extra_isize is small enough to fit in
> EXT3_INODE_SIZE() or it may cause data corruption.
> 

Well, we are using s_want_extra_isize from ext3_sb_info so that we don't have to
do the max() and byte-swapping operations as you have mentioned below. And what
if the new value that is entered is smaller than earlier value(maybe by 
mistake)? 

During verification, I think checking this condition should be enough, right?
if (EXT3_GOOD_OLD_INODE_SIZE + EXT3_SB(sb)->s_want_extra_isize <
EXT3_INODE_SIZE(inode->i_sb)).

_______________________________________________
Lustre-devel mailing list
[email protected]
https://mail.clusterfs.com/mailman/listinfo/lustre-devel

Reply via email to