-Index: linux-stage/fs/ext3/ialloc.c
+Index: linux-2.6.9-67.0.20/fs/ext3/ialloc.c
===================================================================
---- linux-stage.orig/fs/ext3/ialloc.c 2005-10-04 16:53:24.000000000 -0600
-+++ linux-stage/fs/ext3/ialloc.c 2005-10-04 17:07:25.000000000 -0600
-@@ -629,6 +629,9 @@
+--- linux-2.6.9-67.0.20.orig/fs/ext3/ialloc.c
++++ linux-2.6.9-67.0.20/fs/ext3/ialloc.c
+@@ -632,6 +632,9 @@ got:
spin_unlock(&sbi->s_next_gen_lock);
ei->i_state = EXT3_STATE_NEW;
ret = inode;
if(DQUOT_ALLOC_INODE(inode)) {
-Index: linux-stage/fs/ext3/inode.c
+Index: linux-2.6.9-67.0.20/fs/ext3/inode.c
===================================================================
---- linux-stage.orig/fs/ext3/inode.c 2005-10-04 17:00:22.000000000 -0600
-+++ linux-stage/fs/ext3/inode.c 2005-10-04 17:07:25.000000000 -0600
-@@ -2274,7 +2274,7 @@
+--- linux-2.6.9-67.0.20.orig/fs/ext3/inode.c
++++ linux-2.6.9-67.0.20/fs/ext3/inode.c
+@@ -2275,7 +2275,7 @@ static unsigned long ext3_get_inode_bloc
* trying to determine the inode's location on-disk and no read need be
* performed.
*/
struct ext3_iloc *iloc, int in_mem)
{
unsigned long block;
-@@ -2484,6 +2484,11 @@ void ext3_read_inode(struct inode * inod
+@@ -2485,6 +2485,11 @@ void ext3_read_inode(struct inode * inod
ei->i_data[block] = raw_inode->i_block[block];
INIT_LIST_HEAD(&ei->i_orphan);
if (S_ISREG(inode->i_mode)) {
inode->i_op = &ext3_file_inode_operations;
inode->i_fop = &ext3_file_operations;
-@@ -2619,6 +2624,9 @@ static int ext3_do_update_inode(handle_t
+@@ -2620,6 +2625,9 @@ static int ext3_do_update_inode(handle_t
} else for (block = 0; block < EXT3_N_BLOCKS; block++)
raw_inode->i_block[block] = ei->i_data[block];
BUFFER_TRACE(bh, "call ext3_journal_dirty_metadata");
rc = ext3_journal_dirty_metadata(handle, bh);
if (!err)
-@@ -2849,7 +2857,8 @@ ext3_reserve_inode_write(handle_t *handl
+@@ -2850,7 +2858,8 @@ ext3_reserve_inode_write(handle_t *handl
{
int err = 0;
if (handle) {
if (!err) {
BUFFER_TRACE(iloc->bh, "get_write_access");
err = ext3_journal_get_write_access(handle, iloc->bh);
-Index: linux-stage/fs/ext3/xattr.c
+Index: linux-2.6.9-67.0.20/fs/ext3/xattr.c
===================================================================
---- linux-stage.orig/fs/ext3/xattr.c 2005-10-04 16:50:11.000000000 -0600
-+++ linux-stage/fs/ext3/xattr.c 2005-10-04 17:19:43.000000000 -0600
-@@ -149,17 +149,12 @@
+--- linux-2.6.9-67.0.20.orig/fs/ext3/xattr.c
++++ linux-2.6.9-67.0.20/fs/ext3/xattr.c
+@@ -149,17 +149,12 @@ ext3_listxattr(struct dentry *dentry, ch
}
/*
void *buffer, size_t buffer_size)
{
struct buffer_head *bh = NULL;
-@@ -173,7 +168,6 @@
+@@ -173,7 +168,6 @@ ext3_xattr_get(struct inode *inode, int
if (name == NULL)
return -EINVAL;
error = -ENODATA;
if (!EXT3_I(inode)->i_file_acl)
goto cleanup;
-@@ -246,15 +240,87 @@
+@@ -246,15 +240,87 @@ found:
cleanup:
brelse(bh);
* provided, or compute the buffer size required.
* Buffer is NULL to compute the size of the buffer required.
*
-@@ -262,7 +328,31 @@
+@@ -262,7 +328,31 @@ cleanup:
* used / required on success.
*/
int
{
struct buffer_head *bh = NULL;
struct ext3_xattr_entry *entry;
-@@ -273,7 +363,6 @@
+@@ -273,7 +363,6 @@ ext3_xattr_list(struct inode *inode, cha
ea_idebug(inode, "buffer=%p, buffer_size=%ld",
buffer, (long)buffer_size);
error = 0;
if (!EXT3_I(inode)->i_file_acl)
goto cleanup;
-@@ -330,11 +419,149 @@
+@@ -330,11 +419,149 @@ bad_block: ext3_error(inode->i_sb, "ext3
cleanup:
brelse(bh);
/*
* If the EXT3_FEATURE_COMPAT_EXT_ATTR feature of this file system is
* not set, set it.
-@@ -356,6 +583,279 @@
+@@ -356,6 +583,279 @@ static void ext3_xattr_update_super_bloc
}
/*
+ if (value) {
+ int offs = min_offs - value_len;
+ /* use last to create new entry */
++ memset(last, 0, esize);
+ last->e_name_len = strlen(name);
+ last->e_name_index = name_index;
+ last->e_value_offs = cpu_to_le16(offs);
+ last->e_value_size = cpu_to_le32(value_len);
+ last->e_hash = last->e_value_block = 0;
-+ memset(last->e_name, 0, esize);
+ memcpy(last->e_name, name, last->e_name_len);
+ if (start + offs + value_len > end)
+ printk("ALERT at %s:%d: 0x%p + %d + %zd > 0x%p\n",
* ext3_xattr_set_handle()
*
* Create, replace or remove an extended attribute for this inode. Buffer
-@@ -369,6 +869,104 @@
+@@ -369,6 +869,110 @@ static void ext3_xattr_update_super_bloc
*/
int
ext3_xattr_set_handle(handle_t *handle, struct inode *inode, int name_index,
+ } else if (!found && (flags & XATTR_REPLACE)) {
+ err = -ENODATA;
+ goto finish;
++ } else if (!found && !value) {
++ err = 0;
++ goto finish;
+ }
+
+ /* check if we have enough space to store attribute */
+ }
+ }
+
-+ /* try to store EA in inode body */
-+ err = ext3_xattr_ibody_set(handle, inode, name_index, name,
-+ value, value_len, flags);
-+ if (err) {
-+ /* can't store EA in inode body */
-+ /* try to store in block */
-+ err = ext3_xattr_block_set(handle, inode, name_index,
-+ name, value, value_len, flags);
++ /* Add entry if value is provided */
++ if (value != NULL) {
++ /* try to store EA in inode body */
++ err = ext3_xattr_ibody_set(handle, inode, name_index, name,
++ value, value_len, flags);
++ if (err) {
++ /* can't store EA in inode body */
++ /* try to store in block */
++ err = ext3_xattr_block_set(handle, inode, name_index,
++ name, value, value_len, flags);
++ }
+ }
+
+finish:
const char *name, const void *value, size_t value_len,
int flags)
{
-@@ -391,22 +989,7 @@
+@@ -391,22 +995,7 @@ ext3_xattr_set_handle(handle_t *handle,
* towards the end of the block).
* end -- Points right after the block pointed to by header.
*/
if (EXT3_I(inode)->i_file_acl) {
/* The inode already has an extended attribute block. */
bh = sb_bread(sb, EXT3_I(inode)->i_file_acl);
-@@ -638,7 +1221,6 @@
+@@ -638,7 +1227,6 @@ cleanup:
brelse(bh);
if (!(bh && header == HDR(bh)))
kfree(header);
return error;
}
-Index: linux-stage/fs/ext3/xattr.h
+Index: linux-2.6.9-67.0.20/fs/ext3/xattr.h
===================================================================
---- linux-stage.orig/fs/ext3/xattr.h 2005-10-04 16:50:11.000000000 -0600
-+++ linux-stage/fs/ext3/xattr.h 2005-10-04 17:07:25.000000000 -0600
-@@ -67,7 +67,8 @@
+--- linux-2.6.9-67.0.20.orig/fs/ext3/xattr.h
++++ linux-2.6.9-67.0.20/fs/ext3/xattr.h
+@@ -67,7 +67,8 @@ extern ssize_t ext3_listxattr(struct den
extern int ext3_xattr_get(struct inode *, int, const char *, void *, size_t);
extern int ext3_xattr_list(struct inode *, char *, size_t);
extern int ext3_xattr_set(struct inode *, int, const char *, const void *, size_t, int);
extern void ext3_xattr_delete_inode(handle_t *, struct inode *);
extern void ext3_xattr_put_super(struct super_block *);
-Index: linux-stage/include/linux/ext3_fs.h
+Index: linux-2.6.9-67.0.20/include/linux/ext3_fs.h
===================================================================
---- linux-stage.orig/include/linux/ext3_fs.h 2005-10-04 16:53:29.000000000 -0600
-+++ linux-stage/include/linux/ext3_fs.h 2005-10-04 17:07:25.000000000 -0600
-@@ -293,6 +293,8 @@
+--- linux-2.6.9-67.0.20.orig/include/linux/ext3_fs.h
++++ linux-2.6.9-67.0.20/include/linux/ext3_fs.h
+@@ -293,6 +293,8 @@ struct ext3_inode {
__u32 m_i_reserved2[2];
} masix2;
} osd2; /* OS dependent 2 */
};
#define i_size_high i_dir_acl
-@@ -757,6 +759,7 @@
+@@ -757,6 +759,7 @@ extern unsigned long ext3_count_free (st
extern int ext3_forget(handle_t *, int, struct inode *, struct buffer_head *, int);
extern struct buffer_head * ext3_getblk (handle_t *, struct inode *, long, int, int *);
extern struct buffer_head * ext3_bread (handle_t *, struct inode *, int, int, int *);
extern void ext3_read_inode (struct inode *);
extern int ext3_write_inode (struct inode *, int);
-Index: linux-stage/include/linux/ext3_fs_i.h
+Index: linux-2.6.9-67.0.20/include/linux/ext3_fs_i.h
===================================================================
---- linux-stage.orig/include/linux/ext3_fs_i.h 2005-10-04 16:50:11.000000000 -0600
-+++ linux-stage/include/linux/ext3_fs_i.h 2005-10-04 17:07:25.000000000 -0600
-@@ -113,6 +113,9 @@
+--- linux-2.6.9-67.0.20.orig/include/linux/ext3_fs_i.h
++++ linux-2.6.9-67.0.20/include/linux/ext3_fs_i.h
+@@ -113,6 +113,9 @@ struct ext3_inode_info {
*/
loff_t i_disksize;