Whamcloud - gitweb
LU-6722 ldiskfs: fix credits at ldiskfs_delete_inode
[fs/lustre-release.git] / ldiskfs / kernel_patches / patches / rhel7 / ext4-large-eas.patch
index 24976ee..20d5b1e 100644 (file)
@@ -119,6 +119,20 @@ Index: linux-stage/fs/ext4/inode.c
        inode->i_size = 0;
        err = ext4_mark_inode_dirty(handle, inode);
        if (err) {
+@@ -269,10 +296,10 @@ void ext4_evict_inode(struct inode *inod
+        * enough credits left in the handle to remove the inode from
+        * the orphan list and set the dtime field.
+        */
+-      if (!ext4_handle_has_enough_credits(handle, 3)) {
+-              err = ext4_journal_extend(handle, 3);
++      if (!ext4_handle_has_enough_credits(handle, extra_credits)) {
++              err = ext4_journal_extend(handle, extra_credits);
+               if (err > 0)
+-                      err = ext4_journal_restart(handle, 3);
++                      err = ext4_journal_restart(handle, extra_credits);
+               if (err != 0) {
+                       ext4_warning(inode->i_sb,
+                                    "couldn't extend journal (err %d)", err);
 @@ -306,8 +333,12 @@ void ext4_evict_inode(struct inode *inod
                ext4_clear_inode(inode);
        else
@@ -243,7 +257,7 @@ Index: linux-stage/fs/ext4/xattr.c
 +              return NULL;
 +      }
 +
-+      if (ea_inode->i_xattr_inode_parent != parent->i_ino ||
++      if (EXT4_XATTR_INODE_GET_PARENT(ea_inode) != parent->i_ino ||
 +          ea_inode->i_generation != parent->i_generation) {
 +              ext4_error(parent->i_sb, "Backpointer from EA inode %lu "
 +                         "to parent invalid.", ea_ino);
@@ -458,7 +472,7 @@ Index: linux-stage/fs/ext4/xattr.c
 +               * A back-pointer from EA inode to parent inode will be useful
 +               * for e2fsck.
 +               */
-+              ea_inode->i_xattr_inode_parent = inode->i_ino;
++              EXT4_XATTR_INODE_SET_PARENT(ea_inode, inode->i_ino);
 +              unlock_new_inode(ea_inode);
 +      }
 +
@@ -990,11 +1004,22 @@ Index: linux-stage/fs/ext4/xattr.h
        __le32  e_value_size;   /* size of attribute value */
        __le32  e_hash;         /* hash value of name and value */
        char    e_name[0];      /* attribute name */
-@@ -67,6 +67,15 @@ struct ext4_xattr_entry {
+@@ -67,6 +67,26 @@ struct ext4_xattr_entry {
                EXT4_I(inode)->i_extra_isize))
  #define IFIRST(hdr) ((struct ext4_xattr_entry *)((hdr)+1))
  
-+#define i_xattr_inode_parent i_mtime.tv_sec
++/*
++ * Link EA inode back to parent one using i_mtime field.
++ * Extra integer type conversion added to ignore higher
++ * bits in i_mtime.tv_sec which might be set by ext4_get()
++ */
++#define EXT4_XATTR_INODE_SET_PARENT(inode, inum)      \
++do {                                                  \
++      (inode)->i_mtime.tv_sec = inum;                 \
++} while(0)
++
++#define EXT4_XATTR_INODE_GET_PARENT(inode)            \
++((__u32)(inode)->i_mtime.tv_sec)
 +
 +/*
 + * The minimum size of EA value when you start storing it in an external inode