-Index: linux-4.15.0/fs/ext4/ext4.h
-===================================================================
---- linux-4.15.0.orig/fs/ext4/ext4.h
-+++ linux-4.15.0/fs/ext4/ext4.h
-@@ -2504,6 +2504,11 @@ extern int ext4_dirent_csum_verify(struc
+diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
+index 91c73b231e58..e6c4550bbf0e 100644
+--- a/fs/ext4/ext4.h
++++ b/fs/ext4/ext4.h
+@@ -2504,6 +2504,12 @@ extern int ext4_dirent_csum_verify(struct inode *inode,
struct ext4_dir_entry *dirent);
extern int ext4_orphan_add(handle_t *, struct inode *);
extern int ext4_orphan_del(handle_t *, struct inode *);
+extern struct inode *ext4_create_inode(handle_t *handle,
-+ struct inode *dir, int mode);
++ struct inode *dir, int mode,
++ uid_t *owner);
+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_htree_fill_tree(struct file *dir_file, __u32 start_hash,
__u32 start_minor_hash, __u32 *next_hash);
extern int ext4_search_dir(struct buffer_head *bh,
-Index: linux-4.15.0/fs/ext4/namei.c
-===================================================================
---- linux-4.15.0.orig/fs/ext4/namei.c
-+++ linux-4.15.0/fs/ext4/namei.c
-@@ -2360,7 +2360,7 @@ int ext4_generic_delete_entry(handle_t *
+diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
+index 19e34b23ffe0..b9955ddb390a 100644
+--- a/fs/ext4/namei.c
++++ b/fs/ext4/namei.c
+@@ -2360,7 +2360,7 @@ int ext4_generic_delete_entry(handle_t *handle,
return -ENOENT;
}
struct inode *dir,
struct ext4_dir_entry_2 *de_del,
struct buffer_head *bh)
-@@ -2400,7 +2400,7 @@ out:
+@@ -2400,7 +2400,7 @@ static int ext4_delete_entry(handle_t *handle,
ext4_std_error(dir->i_sb, err);
return err;
}
/*
* Set directory link count to 1 if nlinks > EXT4_LINK_MAX, or if nlinks == 2
* since this indicates that nlinks count was previously 1 to avoid overflowing
-@@ -2447,6 +2447,28 @@ static int ext4_add_nondir(handle_t *han
+@@ -2447,6 +2447,29 @@ static int ext4_add_nondir(handle_t *handle,
return err;
}
+ /* Return locked inode, then the caller can modify the inode's states/flags
+ * before others finding it. The caller should unlock the inode by itself. */
-+struct inode *ext4_create_inode(handle_t *handle, struct inode *dir, int mode)
++struct inode *ext4_create_inode(handle_t *handle, struct inode *dir, int mode,
++ uid_t *owner)
+{
+ struct inode *inode;
+
-+ inode = ext4_new_inode(handle, dir, mode, NULL, 0, NULL, 0);
++ inode = ext4_new_inode(handle, dir, mode, NULL, 0, owner, 0);
+ if (!IS_ERR(inode)) {
+ if (S_ISCHR(mode) || S_ISBLK(mode) || S_ISFIFO(mode)) {
+#ifdef CONFIG_LDISKFS_FS_XATTR