Whamcloud - gitweb
- xattr_sem protects block-stored EAs only.
authoralex <alex>
Sun, 12 Oct 2003 12:49:50 +0000 (12:49 +0000)
committeralex <alex>
Sun, 12 Oct 2003 12:49:50 +0000 (12:49 +0000)
  fast EAs are protected by inode->i_sem only

lustre/kernel_patches/patches/ext3-ea-in-inode-2.4.18-chaos.patch
lustre/kernel_patches/patches/ext3-ea-in-inode-2.4.20.patch
lustre/kernel_patches/patches/ext3-ea-in-inode-2.4.22-rh.patch

index 9daff50..bc6ee77 100644 (file)
@@ -1,13 +1,13 @@
  fs/ext3/ialloc.c          |    6 
  fs/ext3/inode.c           |   10 
  fs/ext3/super.c           |    4 
- fs/ext3/xattr.c           |  600 +++++++++++++++++++++++++++++++++++++++++++++-
+ fs/ext3/xattr.c           |  598 +++++++++++++++++++++++++++++++++++++++++++++-
  include/linux/ext3_fs.h   |    2 
  include/linux/ext3_fs_i.h |    3 
- 6 files changed, 613 insertions(+), 12 deletions(-)
+ 6 files changed, 613 insertions(+), 10 deletions(-)
 
---- linux-2.4.18-chaos-uml/fs/ext3/ialloc.c~ext3-ea-in-inode-2.4.18-chaos      2003-09-17 18:58:19.000000000 +0400
-+++ linux-2.4.18-chaos-uml-alexey/fs/ext3/ialloc.c     2003-09-17 18:58:39.000000000 +0400
+--- linux-2.4.18-chaos/fs/ext3/ialloc.c~ext3-ea-in-inode-2.4.18-chaos  2003-10-08 10:38:03.000000000 +0400
++++ linux-2.4.18-chaos-alexey/fs/ext3/ialloc.c 2003-10-08 15:08:45.000000000 +0400
 @@ -586,6 +586,12 @@ repeat:
        insert_inode_hash(inode);
        inode->i_generation = sbi->s_next_generation++;
@@ -21,8 +21,8 @@
        ei->i_state = EXT3_STATE_NEW;
        err = ext3_get_inode_loc_new(inode, &iloc, 1);
        if (err) goto fail;
---- linux-2.4.18-chaos-uml/fs/ext3/inode.c~ext3-ea-in-inode-2.4.18-chaos       2003-09-17 18:58:19.000000000 +0400
-+++ linux-2.4.18-chaos-uml-alexey/fs/ext3/inode.c      2003-09-17 19:34:47.000000000 +0400
+--- linux-2.4.18-chaos/fs/ext3/inode.c~ext3-ea-in-inode-2.4.18-chaos   2003-10-08 10:38:03.000000000 +0400
++++ linux-2.4.18-chaos-alexey/fs/ext3/inode.c  2003-10-08 15:08:45.000000000 +0400
 @@ -2459,6 +2459,11 @@ void ext3_read_inode(struct inode * inod
                ei->i_data[block] = iloc.raw_inode->i_block[block];
        INIT_LIST_HEAD(&ei->i_orphan);
@@ -54,8 +54,8 @@
        BUFFER_TRACE(bh, "call ext3_journal_dirty_metadata");
        rc = ext3_journal_dirty_metadata(handle, bh);
        if (!err)
---- linux-2.4.18-chaos-uml/fs/ext3/xattr.c~ext3-ea-in-inode-2.4.18-chaos       2003-09-17 18:58:16.000000000 +0400
-+++ linux-2.4.18-chaos-uml-alexey/fs/ext3/xattr.c      2003-09-17 19:35:21.000000000 +0400
+--- linux-2.4.18-chaos/fs/ext3/xattr.c~ext3-ea-in-inode-2.4.18-chaos   2003-10-08 10:38:01.000000000 +0400
++++ linux-2.4.18-chaos-alexey/fs/ext3/xattr.c  2003-10-12 16:16:44.000000000 +0400
 @@ -102,6 +102,9 @@
  static int ext3_xattr_set2(handle_t *, struct inode *, struct buffer_head *,
                           struct ext3_xattr_header *);
   * ext3_xattr_set()
   *
   * Create, replace or remove an extended attribute for this inode. Buffer
-@@ -583,6 +1067,102 @@ static void ext3_xattr_update_super_bloc
+@@ -583,6 +1067,100 @@ static void ext3_xattr_update_super_bloc
   */
  int
  ext3_xattr_set(handle_t *handle, struct inode *inode, int name_index,
 +      name_len = strlen(name);
 +      if (name_len > 255 || value_len > inode->i_sb->s_blocksize)
 +              return -ERANGE;
-+      ext3_xattr_lock();
 +
 +      /* try to find attribute in inode body */
 +      err = ext3_xattr_ibody_find(inode, name_index, name, &entry, &free1);
 +      }
 +
 +finish:       
-+      ext3_xattr_unlock();
 +      return err;
 +}
 +
               const char *name, void *value, size_t value_len, int flags)
  {
        struct super_block *sb = inode->i_sb;
-@@ -619,7 +1199,6 @@ ext3_xattr_set(handle_t *handle, struct 
+@@ -619,6 +1197,7 @@ ext3_xattr_set(handle_t *handle, struct 
        name_len = strlen(name);
        if (name_len > 255 || value_len > sb->s_blocksize)
                return -ERANGE;
--      ext3_xattr_lock();
++
+       ext3_xattr_lock();
  
        if (EXT3_I(inode)->i_file_acl) {
-               /* The inode already has an extended attribute block. */
-@@ -819,7 +1398,6 @@ cleanup:
+@@ -819,6 +1398,7 @@ cleanup:
        brelse(bh);
        if (!(bh && header == HDR(bh)))
                kfree(header);
--      ext3_xattr_unlock();
++
+       ext3_xattr_unlock();
  
        return error;
- }
---- linux-2.4.18-chaos-uml/include/linux/ext3_fs.h~ext3-ea-in-inode-2.4.18-chaos       2003-09-17 18:58:19.000000000 +0400
-+++ linux-2.4.18-chaos-uml-alexey/include/linux/ext3_fs.h      2003-09-17 18:58:39.000000000 +0400
+--- linux-2.4.18-chaos/include/linux/ext3_fs.h~ext3-ea-in-inode-2.4.18-chaos   2003-10-08 10:38:03.000000000 +0400
++++ linux-2.4.18-chaos-alexey/include/linux/ext3_fs.h  2003-10-08 15:08:45.000000000 +0400
 @@ -264,6 +264,8 @@ struct ext3_inode {
                        __u32   m_i_reserved2[2];
                } masix2;
  };
  
  #define i_size_high   i_dir_acl
---- linux-2.4.18-chaos-uml/include/linux/ext3_fs_i.h~ext3-ea-in-inode-2.4.18-chaos     2003-09-17 18:58:18.000000000 +0400
-+++ linux-2.4.18-chaos-uml-alexey/include/linux/ext3_fs_i.h    2003-09-17 18:58:39.000000000 +0400
+--- linux-2.4.18-chaos/include/linux/ext3_fs_i.h~ext3-ea-in-inode-2.4.18-chaos 2003-10-08 10:38:03.000000000 +0400
++++ linux-2.4.18-chaos-alexey/include/linux/ext3_fs_i.h        2003-10-08 15:08:45.000000000 +0400
 @@ -62,6 +62,9 @@ struct ext3_inode_info {
         */
        loff_t  i_disksize;
        /*
         * truncate_sem is for serialising ext3_truncate() against
         * ext3_getblock().  In the 2.4 ext2 design, great chunks of inode's
---- linux-2.4.18-chaos-uml/fs/ext3/super.c~ext3-ea-in-inode-2.4.18-chaos       2003-09-17 18:58:18.000000000 +0400
-+++ linux-2.4.18-chaos-uml-alexey/fs/ext3/super.c      2003-09-17 18:59:14.000000000 +0400
+--- linux-2.4.18-chaos/fs/ext3/super.c~ext3-ea-in-inode-2.4.18-chaos   2003-10-08 10:38:03.000000000 +0400
++++ linux-2.4.18-chaos-alexey/fs/ext3/super.c  2003-10-08 15:08:45.000000000 +0400
 @@ -1292,7 +1292,9 @@ struct super_block * ext3_read_super (st
        } else {
                sbi->s_inode_size = le16_to_cpu(es->s_inode_size);
index f150020..0053d92 100644 (file)
@@ -1,13 +1,13 @@
  fs/ext3/ialloc.c          |    6 
  fs/ext3/inode.c           |   12 
  fs/ext3/super.c           |    6 
- fs/ext3/xattr.c           |  600 +++++++++++++++++++++++++++++++++++++++++++++-
+ fs/ext3/xattr.c           |  597 +++++++++++++++++++++++++++++++++++++++++++++-
  include/linux/ext3_fs.h   |    2 
  include/linux/ext3_fs_i.h |    3 
- 6 files changed, 616 insertions(+), 13 deletions(-)
+ 6 files changed, 615 insertions(+), 11 deletions(-)
 
---- linux-2.4.20-vanilla/fs/ext3/ialloc.c~ext3-ea-in-inode-2.4.20      2003-09-17 21:06:28.000000000 +0400
-+++ linux-2.4.20-vanilla-alexey/fs/ext3/ialloc.c       2003-09-17 21:16:16.000000000 +0400
+--- linux-2.4.20/fs/ext3/ialloc.c~ext3-ea-in-inode-2.4.20      2003-10-08 23:18:08.000000000 +0400
++++ linux-2.4.20-alexey/fs/ext3/ialloc.c       2003-10-12 16:25:21.000000000 +0400
 @@ -577,6 +577,12 @@ repeat:
        insert_inode_hash(inode);
        inode->i_generation = sb->u.ext3_sb.s_next_generation++;
@@ -21,8 +21,8 @@
        inode->u.ext3_i.i_state = EXT3_STATE_NEW;
        err = ext3_get_inode_loc_new(inode, &iloc, 1);
        if (err) goto fail;
---- linux-2.4.20-vanilla/fs/ext3/inode.c~ext3-ea-in-inode-2.4.20       2003-09-17 21:06:28.000000000 +0400
-+++ linux-2.4.20-vanilla-alexey/fs/ext3/inode.c        2003-09-17 21:16:16.000000000 +0400
+--- linux-2.4.20/fs/ext3/inode.c~ext3-ea-in-inode-2.4.20       2003-10-08 23:18:08.000000000 +0400
++++ linux-2.4.20-alexey/fs/ext3/inode.c        2003-10-12 16:25:21.000000000 +0400
 @@ -2209,6 +2209,12 @@ void ext3_read_inode(struct inode * inod
                inode->u.ext3_i.i_data[block] = iloc.raw_inode->i_block[block];
        INIT_LIST_HEAD(&inode->u.ext3_i.i_orphan);
@@ -56,8 +56,8 @@
        BUFFER_TRACE(bh, "call ext3_journal_dirty_metadata");
        rc = ext3_journal_dirty_metadata(handle, bh);
        if (!err)
---- linux-2.4.20-vanilla/fs/ext3/xattr.c~ext3-ea-in-inode-2.4.20       2003-09-17 21:06:27.000000000 +0400
-+++ linux-2.4.20-vanilla-alexey/fs/ext3/xattr.c        2003-09-17 21:17:55.000000000 +0400
+--- linux-2.4.20/fs/ext3/xattr.c~ext3-ea-in-inode-2.4.20       2003-10-08 23:18:06.000000000 +0400
++++ linux-2.4.20-alexey/fs/ext3/xattr.c        2003-10-12 16:26:31.000000000 +0400
 @@ -100,6 +100,9 @@
  static int ext3_xattr_set2(handle_t *, struct inode *, struct buffer_head *,
                           struct ext3_xattr_header *);
   * ext3_xattr_set()
   *
   * Create, replace or remove an extended attribute for this inode. Buffer
-@@ -566,6 +1050,102 @@ static void ext3_xattr_update_super_bloc
+@@ -566,6 +1050,100 @@ static void ext3_xattr_update_super_bloc
   */
  int
  ext3_xattr_set(handle_t *handle, struct inode *inode, int name_index,
 +      name_len = strlen(name);
 +      if (name_len > 255 || value_len > inode->i_sb->s_blocksize)
 +              return -ERANGE;
-+      down(&ext3_xattr_sem);
 +
 +      /* try to find attribute in inode body */
 +      err = ext3_xattr_ibody_find(inode, name_index, name, &entry, &free1);
 +      }
 +
 +finish:       
-+      up(&ext3_xattr_sem);
 +      return err;
 +}
 +
               const char *name, const void *value, size_t value_len, int flags)
  {
        struct super_block *sb = inode->i_sb;
-@@ -603,7 +1183,6 @@ ext3_xattr_set(handle_t *handle, struct 
+@@ -603,6 +1181,7 @@ ext3_xattr_set(handle_t *handle, struct 
        name_len = strlen(name);
        if (name_len > 255 || value_len > sb->s_blocksize)
                return -ERANGE;
--      down(&ext3_xattr_sem);
++
+       down(&ext3_xattr_sem);
  
        if (block) {
-               /* The inode already has an extended attribute block. */
-@@ -801,7 +1380,6 @@ cleanup:
-       brelse(bh);
-       if (!(bh && header == HDR(bh)))
-               kfree(header);
--      up(&ext3_xattr_sem);
-       return error;
- }
---- linux-2.4.20-vanilla/include/linux/ext3_fs.h~ext3-ea-in-inode-2.4.20       2003-09-17 21:16:09.000000000 +0400
-+++ linux-2.4.20-vanilla-alexey/include/linux/ext3_fs.h        2003-09-17 21:16:16.000000000 +0400
+--- linux-2.4.20/include/linux/ext3_fs.h~ext3-ea-in-inode-2.4.20       2003-10-08 23:18:08.000000000 +0400
++++ linux-2.4.20-alexey/include/linux/ext3_fs.h        2003-10-12 16:35:46.000000000 +0400
 @@ -264,6 +264,8 @@ struct ext3_inode {
                        __u32   m_i_reserved2[2];
                } masix2;
  };
  
  #define i_size_high   i_dir_acl
---- linux-2.4.20-vanilla/include/linux/ext3_fs_i.h~ext3-ea-in-inode-2.4.20     2003-09-17 21:14:55.000000000 +0400
-+++ linux-2.4.20-vanilla-alexey/include/linux/ext3_fs_i.h      2003-09-17 21:16:16.000000000 +0400
+--- linux-2.4.20/include/linux/ext3_fs_i.h~ext3-ea-in-inode-2.4.20     2001-11-22 22:46:19.000000000 +0300
++++ linux-2.4.20-alexey/include/linux/ext3_fs_i.h      2003-10-12 16:34:14.000000000 +0400
 @@ -62,6 +62,9 @@ struct ext3_inode_info {
         */
        loff_t  i_disksize;
        /*
         * truncate_sem is for serialising ext3_truncate() against
         * ext3_getblock().  In the 2.4 ext2 design, great chunks of inode's
---- linux-2.4.20-vanilla/fs/ext3/super.c~ext3-ea-in-inode-2.4.20       2003-09-17 21:06:29.000000000 +0400
-+++ linux-2.4.20-vanilla-alexey/fs/ext3/super.c        2003-09-17 21:34:13.000000000 +0400
+--- linux-2.4.20/fs/ext3/super.c~ext3-ea-in-inode-2.4.20       2003-10-08 23:18:09.000000000 +0400
++++ linux-2.4.20-alexey/fs/ext3/super.c        2003-10-12 16:25:21.000000000 +0400
 @@ -1292,8 +1292,10 @@ struct super_block * ext3_read_super (st
        } else {
                sbi->s_inode_size = le16_to_cpu(es->s_inode_size);
index d48fbd2..5800fe0 100644 (file)
@@ -1,10 +1,10 @@
  fs/ext3/ialloc.c          |    6 
  fs/ext3/inode.c           |   12 
  fs/ext3/super.c           |    6 
- fs/ext3/xattr.c           |  600 +++++++++++++++++++++++++++++++++++++++++++++-
+ fs/ext3/xattr.c           |  597 +++++++++++++++++++++++++++++++++++++++++++++-
  include/linux/ext3_fs.h   |    2 
  include/linux/ext3_fs_i.h |    3 
- 6 files changed, 616 insertions(+), 13 deletions(-)
+ 6 files changed, 615 insertions(+), 11 deletions(-)
 
 --- linux-2.4.22-ac1/fs/ext3/ialloc.c~ext3-ea-in-inode-2.4.22-rh       2003-10-08 13:57:56.000000000 +0400
 +++ linux-2.4.22-ac1-alexey/fs/ext3/ialloc.c   2003-10-08 15:13:31.000000000 +0400
@@ -72,7 +72,7 @@
                                sbi->s_inode_size);
                        goto failed_mount;
 --- linux-2.4.22-ac1/fs/ext3/xattr.c~ext3-ea-in-inode-2.4.22-rh        2003-10-08 13:57:56.000000000 +0400
-+++ linux-2.4.22-ac1-alexey/fs/ext3/xattr.c    2003-10-08 15:13:31.000000000 +0400
++++ linux-2.4.22-ac1-alexey/fs/ext3/xattr.c    2003-10-12 16:36:07.000000000 +0400
 @@ -100,6 +100,9 @@
  static int ext3_xattr_set2(handle_t *, struct inode *, struct buffer_head *,
                           struct ext3_xattr_header *);
   * ext3_xattr_set()
   *
   * Create, replace or remove an extended attribute for this inode. Buffer
-@@ -566,6 +1050,102 @@ static void ext3_xattr_update_super_bloc
+@@ -566,6 +1050,100 @@ static void ext3_xattr_update_super_bloc
   */
  int
  ext3_xattr_set(handle_t *handle, struct inode *inode, int name_index,
 +      name_len = strlen(name);
 +      if (name_len > 255 || value_len > inode->i_sb->s_blocksize)
 +              return -ERANGE;
-+      down(&ext3_xattr_sem);
 +
 +      /* try to find attribute in inode body */
 +      err = ext3_xattr_ibody_find(inode, name_index, name, &entry, &free1);
 +      }
 +
 +finish:       
-+      up(&ext3_xattr_sem);
 +      return err;
 +}
 +
               const char *name, const void *value, size_t value_len, int flags)
  {
        struct super_block *sb = inode->i_sb;
-@@ -603,7 +1183,6 @@ ext3_xattr_set(handle_t *handle, struct 
+@@ -603,6 +1181,7 @@ ext3_xattr_set(handle_t *handle, struct 
        name_len = strlen(name);
        if (name_len > 255 || value_len > sb->s_blocksize)
                return -ERANGE;
--      down(&ext3_xattr_sem);
++
+       down(&ext3_xattr_sem);
  
        if (block) {
-               /* The inode already has an extended attribute block. */
-@@ -801,7 +1380,6 @@ cleanup:
-       brelse(bh);
-       if (!(bh && header == HDR(bh)))
-               kfree(header);
--      up(&ext3_xattr_sem);
-       return error;
- }
 --- linux-2.4.22-ac1/include/linux/ext3_fs.h~ext3-ea-in-inode-2.4.22-rh        2003-10-08 13:57:57.000000000 +0400
 +++ linux-2.4.22-ac1-alexey/include/linux/ext3_fs.h    2003-10-08 15:13:31.000000000 +0400
 @@ -265,6 +265,8 @@ struct ext3_inode {