public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Fix ea-in-inode default ACL creation
@ 2005-01-20 18:22 Andreas Gruenbacher
  2005-01-20 18:56 ` Valdis.Kletnieks
  2005-01-21 21:36 ` Stephen C. Tweedie
  0 siblings, 2 replies; 8+ messages in thread
From: Andreas Gruenbacher @ 2005-01-20 18:22 UTC (permalink / raw)
  To: Andrew Morton, Linus Torvalds
  Cc: Andrew Tridgell, Stephen C. Tweedie, Andreas Dilger, Alex Tomas,
	linux-kernel

Hello,

here is another nastiness.

When a new inode is created, ext3_new_inode sets the EXT3_STATE_NEW
flag, which tells ext3_do_update_inode to zero out the inode before
filling in the inode's data. When a file is created in a directory with
a default acl, the new inode inherits the directory's default acl; this
generates attributes. The attributes are created before
ext3_do_update_inode is called to write out the inode. In case of
in-inode attributes, the new inode's attributes are written, and then
zeroed out again by ext3_do_update_inode. Bad thing.

Fix this by recognizing the EXT3_STATE_NEW case in
ext3_xattr_set_handle, and zeroing out the inode there already when
necessary.

Signed-off-by: Andreas Gruenbacher <agruen@suse.de>

Index: linux-2.6.11-latest/fs/ext3/xattr.c
===================================================================
--- linux-2.6.11-latest.orig/fs/ext3/xattr.c
+++ linux-2.6.11-latest/fs/ext3/xattr.c
@@ -954,6 +954,13 @@ ext3_xattr_set_handle(handle_t *handle, 
 	error = ext3_get_inode_loc(inode, &is.iloc);
 	if (error)
 		goto cleanup;
+
+	if (EXT3_I(inode)->i_state & EXT3_STATE_NEW) {
+		struct ext3_inode *raw_inode = ext3_raw_inode(&is.iloc);
+		memset(raw_inode, 0, EXT3_SB(inode->i_sb)->s_inode_size);
+		EXT3_I(inode)->i_state &= ~EXT3_STATE_NEW;
+	}
+
 	error = ext3_xattr_ibody_find(inode, &i, &is);
 	if (error)
 		goto cleanup;


-- 
Andreas Gruenbacher <agruen@suse.de>
SUSE Labs, SUSE LINUX GMBH


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

end of thread, other threads:[~2005-01-21 22:20 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-20 18:22 Fix ea-in-inode default ACL creation Andreas Gruenbacher
2005-01-20 18:56 ` Valdis.Kletnieks
2005-01-20 19:07   ` Andreas Dilger
2005-01-20 19:09   ` Andreas Gruenbacher
2005-01-20 19:21     ` Valdis.Kletnieks
2005-01-21 21:36 ` Stephen C. Tweedie
2005-01-21 21:48   ` Andreas Gruenbacher
2005-01-21 22:06     ` Stephen C. Tweedie

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