All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ext3: set i_extra_isize of 11th inode
@ 2010-08-20  2:20 Masayoshi MIZUMA
  2010-08-20  7:42 ` Andreas Dilger
  0 siblings, 1 reply; 21+ messages in thread
From: Masayoshi MIZUMA @ 2010-08-20  2:20 UTC (permalink / raw)
  To: Andreas Dilger, Andrew Morton, Jan Kara; +Cc: linux-ext4

Hi,

In ext3 filesystem, if following conditions 1., 2., 3. and 4. is satisfied,
getfattr can't search the extended attribute (EA) after remount.

Condition:
    1. the inode size is over 128 byte
    2. "lost+found" whose inode number is 11 was removed 
    3. the 11th inode is used for a file.
    4. the EA locates in-inode

This happens because of following logic:
    i_extra_isize is set to over 0 by ext3_new_inode() when we create
    a file whose inode number is 11 after removing "lost+found". 
    Therefore setfattr creates the EA in-inode.
    After remount, i_extra_isize of 11th inode is set to 0 by ext3_iget()
    when we lookup the file, so getfattr tries to search the EA out-inode.
    However, the EA locates in-inode, so getfattr can't search the EA.

How to reproduce:
    1. mkfs.ext3 -I 256 /dev/sdXX
    2. mount -o acl,user_xattr  /dev/sdXX /TEST
    3. rm -rf /TEST/*
    4. touch /TEST/file (whose inode number is 11)
    5. cd /TEST; setfattr -n user.foo0 -v bar0 file
    6. cd /TEST; getfattr -d file
       -> can see foo0/bar0
    7. umount  /dev/sdXX
    8. mount -o acl,user_xattr /dev/sdXX /TEST
    9. cd /TEST; getfattr -d file
       -> can't see foo0/bar0

Though the 11th inode is used for "lost+found" normally, the other
file can also use it. Therefore, i_extra_isize of 11th inode should be set
to the suitable value by ext3_iget().

Signed-off-by: Masayoshi MIZUMA <m.mizuma@jp.fujitsu.com>
---
 fs/ext3/inode.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c
index 735f019..85e8574 100644
--- a/fs/ext3/inode.c
+++ b/fs/ext3/inode.c
@@ -2881,8 +2881,7 @@ struct inode *ext3_iget(struct super_block *sb, unsigned long ino)
 		atomic_set(&ei->i_datasync_tid, tid);
 	}
 
-	if (inode->i_ino >= EXT3_FIRST_INO(inode->i_sb) + 1 &&
-	    EXT3_INODE_SIZE(inode->i_sb) > EXT3_GOOD_OLD_INODE_SIZE) {
+	if (EXT3_INODE_SIZE(inode->i_sb) > EXT3_GOOD_OLD_INODE_SIZE) {
 		/*
 		 * When mke2fs creates big inodes it does not zero out
 		 * the unused bytes above EXT3_GOOD_OLD_INODE_SIZE,
-- 
1.6.2.5

Thanks,
Masayoshi


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

end of thread, other threads:[~2010-09-09 19:23 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-20  2:20 [PATCH] ext3: set i_extra_isize of 11th inode Masayoshi MIZUMA
2010-08-20  7:42 ` Andreas Dilger
2010-08-23  0:16   ` Masayoshi MIZUMA
2010-08-23  0:50     ` [PATCH] [RESEND] " Masayoshi MIZUMA
2010-08-24 13:17       ` Jan Kara
2010-08-25  0:05         ` Masayoshi MIZUMA
2010-08-25 23:04           ` Jan Kara
2010-08-25 23:39             ` Andreas Dilger
2010-08-26  0:36               ` Ted Ts'o
2010-08-26  0:55                 ` Andreas Dilger
2010-08-26  1:21                   ` Ted Ts'o
2010-08-26  1:51                     ` Andreas Dilger
2010-08-26  1:25                   ` Masayoshi MIZUMA
2010-08-26 12:27               ` Jan Kara
2010-08-26 23:59                 ` Andreas Dilger
2010-08-27 13:58                   ` Jan Kara
2010-08-27 18:57                     ` Andreas Dilger
2010-09-09 16:38                       ` Jan Kara
2010-09-09 19:23                         ` Andreas Dilger
2010-08-26  0:26             ` Masayoshi MIZUMA
2010-08-26 12:29               ` Jan Kara

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.