Whamcloud - gitweb
LU-6096 ldiskfs: mark dir's inode dirty 81/15581/5
authorAlex Zhuravlev <alexey.zhuravlev@intel.com>
Mon, 13 Jul 2015 12:04:08 +0000 (15:04 +0300)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 5 Aug 2015 02:19:26 +0000 (02:19 +0000)
mark directory's inode dirty in ldiskfs_add_dot_dotdot()
as ldiskfs_init_new_dir() doesn't do this internally.
otherwise, the attributes set by ldiskfs_append() aren't
transferred to the buffer cache.

Change-Id: Ice93b75e291736f83c0d9b1047f7a627fef0141e
Signed-off-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Reviewed-on: http://review.whamcloud.com/15581
Tested-by: Jenkins
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Yang Sheng <yang.sheng@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
ldiskfs/kernel_patches/patches/rhel7/ext4-data-in-dirent.patch
ldiskfs/kernel_patches/patches/rhel7/ext4-osd-iop-common.patch
lustre/osd-ldiskfs/osd_handler.c

index 26b1e78..1910145 100644 (file)
@@ -183,11 +183,11 @@ Index: linux-3.10.0-123.13.2.el7.x86_64/fs/ext4/ext4.h
  }
  
  /* fsync.c */
  }
  
  /* fsync.c */
-@@ -2157,7 +2206,7 @@ extern struct buffer_head * ext4_find_en
                                          struct ext4_dir_entry_2 ** res_dir,
-                                           int *inlined);
- extern int ext4_add_dot_dotdot(handle_t *handle, struct inode *dir,
--                             struct inode *inode);
+@@ -2157,6 +2206,8 @@ extern struct buffer_head * ext4_find_en
extern int ext4_delete_entry(handle_t *handle, struct inode * dir,
+                            struct ext4_dir_entry_2 *de_del,
+                            struct buffer_head *bh);
++extern int ext4_add_dot_dotdot(handle_t *handle, struct inode *dir,
 +                             struct inode *inode, const void *, const void *);
  extern int search_dir(struct buffer_head *bh,
                      char *search_buf,
 +                             struct inode *inode, const void *, const void *);
  extern int search_dir(struct buffer_head *bh,
                      char *search_buf,
@@ -605,25 +605,36 @@ Index: linux-3.10.0-123.13.2.el7.x86_64/fs/ext4/namei.c
        set_nlink(inode, 2);
        if (csum_size) {
                t = EXT4_DIRENT_TAIL(dir_block->b_data, blocksize);
        set_nlink(inode, 2);
        if (csum_size) {
                t = EXT4_DIRENT_TAIL(dir_block->b_data, blocksize);
-@@ -2508,7 +2597,8 @@ out:
- /* Initialize @inode as a subdirectory of @dir, and add the
-  * "." and ".." entries into the first directory block. */
- int ext4_add_dot_dotdot(handle_t *handle, struct inode *dir,
--                      struct inode *inode)
+@@ -2402,6 +2426,29 @@ out:
+       return err;
+ }
++/* Initialize @inode as a subdirectory of @dir, and add the
++ * "." and ".." entries into the first directory block. */
++int ext4_add_dot_dotdot(handle_t *handle, struct inode *dir,
 +                      struct inode *inode,
 +                      const void *data1, const void *data2)
 +                      struct inode *inode,
 +                      const void *data1, const void *data2)
++{
++      int rc;
++
++      if (IS_ERR(handle))
++              return PTR_ERR(handle);
++
++      if (IS_DIRSYNC(dir))
++              ext4_handle_sync(handle);
++
++      inode->i_op = &ext4_dir_inode_operations.ops;
++      inode->i_fop = &ext4_dir_operations;
++      rc = ext4_init_new_dir(handle, dir, inode, data1, data2);
++      if (!rc)
++              rc = ext4_mark_inode_dirty(handle, inode);
++      return rc;
++}
++EXPORT_SYMBOL(ext4_add_dot_dotdot);
++
+ static int ext4_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
  {
  {
-       if (IS_ERR(handle))
-               return PTR_ERR(handle);
-@@ -2518,7 +2608,7 @@ int ext4_add_dot_dotdot(handle_t *handle
-       inode->i_op = &ext4_dir_inode_operations;
-       inode->i_fop = &ext4_dir_operations;
--      return ext4_init_new_dir(handle, dir, inode);
-+      return ext4_init_new_dir(handle, dir, inode, data1, data2);
- }
- EXPORT_SYMBOL(ext4_add_dot_dotdot);
+       handle_t *handle;
 @@ -2546,7 +2636,7 @@ retry:
  
        inode->i_op = &ext4_dir_inode_operations;
 @@ -2546,7 +2636,7 @@ retry:
  
        inode->i_op = &ext4_dir_inode_operations;
index ddbe93d..5f9f11c 100644 (file)
@@ -2,7 +2,7 @@ Index: linux-3.10.0-123.13.2.el7.x86_64/fs/ext4/ext4.h
 ===================================================================
 --- linux-3.10.0-123.13.2.el7.x86_64.orig/fs/ext4/ext4.h
 +++ linux-3.10.0-123.13.2.el7.x86_64/fs/ext4/ext4.h
 ===================================================================
 --- linux-3.10.0-123.13.2.el7.x86_64.orig/fs/ext4/ext4.h
 +++ linux-3.10.0-123.13.2.el7.x86_64/fs/ext4/ext4.h
-@@ -2145,6 +2145,13 @@ extern int ext4_orphan_add(handle_t *, s
+@@ -2145,6 +2145,11 @@ extern int ext4_orphan_add(handle_t *, s
  extern int ext4_orphan_del(handle_t *, struct inode *);
  extern int ext4_htree_fill_tree(struct file *dir_file, __u32 start_hash,
                                __u32 start_minor_hash, __u32 *next_hash);
  extern int ext4_orphan_del(handle_t *, struct inode *);
  extern int ext4_htree_fill_tree(struct file *dir_file, __u32 start_hash,
                                __u32 start_minor_hash, __u32 *next_hash);
@@ -11,8 +11,6 @@ Index: linux-3.10.0-123.13.2.el7.x86_64/fs/ext4/ext4.h
 +extern int ext4_delete_entry(handle_t *handle, struct inode * dir,
 +                           struct ext4_dir_entry_2 *de_del,
 +                           struct buffer_head *bh);
 +extern int ext4_delete_entry(handle_t *handle, struct inode * dir,
 +                           struct ext4_dir_entry_2 *de_del,
 +                           struct buffer_head *bh);
-+extern int ext4_add_dot_dotdot(handle_t *handle, struct inode *dir,
-+                             struct inode *inode);
  extern int search_dir(struct buffer_head *bh,
                      char *search_buf,
                      int buf_size,
  extern int search_dir(struct buffer_head *bh,
                      char *search_buf,
                      int buf_size,
@@ -67,27 +65,3 @@ Index: linux-3.10.0-123.13.2.el7.x86_64/fs/ext4/namei.c
  /*
   * By the time this is called, we already have created
   * the directory cache entry for the new file, but it
  /*
   * By the time this is called, we already have created
   * the directory cache entry for the new file, but it
-@@ -2402,6 +2426,23 @@ out:
-       return err;
- }
-+/* Initialize @inode as a subdirectory of @dir, and add the
-+ * "." and ".." entries into the first directory block. */
-+int ext4_add_dot_dotdot(handle_t *handle, struct inode *dir,
-+                      struct inode *inode)
-+{
-+      if (IS_ERR(handle))
-+              return PTR_ERR(handle);
-+
-+      if (IS_DIRSYNC(dir))
-+              ext4_handle_sync(handle);
-+
-+      inode->i_op = &ext4_dir_inode_operations.ops;
-+      inode->i_fop = &ext4_dir_operations;
-+      return ext4_init_new_dir(handle, dir, inode);
-+}
-+EXPORT_SYMBOL(ext4_add_dot_dotdot);
-+
- static int ext4_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
- {
-       handle_t *handle;
index aa8b281..41b79fd 100644 (file)
@@ -2497,8 +2497,9 @@ static int osd_add_dot_dotdot_internal(struct osd_thread_info *info,
 
        dot_ldp = (struct ldiskfs_dentry_param *)info->oti_ldp;
        dot_ldp->edp_magic = 0;
 
        dot_ldp = (struct ldiskfs_dentry_param *)info->oti_ldp;
        dot_ldp->edp_magic = 0;
+
        return ldiskfs_add_dot_dotdot(oth->ot_handle, parent_dir,
        return ldiskfs_add_dot_dotdot(oth->ot_handle, parent_dir,
-                                       dir, dot_ldp, dot_dot_ldp);
+                                     dir, dot_ldp, dot_dot_ldp);
 }
 
 /**
 }
 
 /**
@@ -3838,13 +3839,6 @@ static int osd_add_dot_dotdot(struct osd_thread_info *info,
                        dir->oo_compat_dotdot_created = 1;
        }
 
                        dir->oo_compat_dotdot_created = 1;
        }
 
-       /* ldiskfs_init_new_dir() doesn't call ldiskfs_mark_inode_dirty()
-        * this seem as an optimization as usually it's called
-        * later to refresh mtime of the parent. Lustre does not
-        * update mtime in few cases (e.g. PENDING, .lustre)
-        * we still need to transfer i_size/etc to the buffer cache */
-       ldiskfs_mark_inode_dirty(oth->ot_handle, dir->oo_inode);
-
        return result;
 }
 
        return result;
 }