])
], [test x$UBUNTU_KERNEL = xyes], [
BASEVER=$(echo $LINUXRELEASE | cut -d'-' -f1)
+ AS_VERSION_COMPARE([$BASEVER],[6.8.0],[
AS_VERSION_COMPARE([$BASEVER],[5.19.0],[
AS_VERSION_COMPARE([$BASEVER],[5.15.0],[
AS_VERSION_COMPARE([$BASEVER],[5.11.0],[
AS_VERSION_COMPARE([$BASEVER],[5.8.0],[
AS_VERSION_COMPARE([$BASEVER],[5.4.0],[
AS_VERSION_COMPARE([$BASEVER],[5.0.0],[
- AS_VERSION_COMPARE([$BASEVER],[4.15.0],[
- AS_VERSION_COMPARE([$BASEVER],[4.4.0], [],
- [
- KPLEV=$(echo $LINUXRELEASE | cut -d'-' -f2)
- AS_IF(
- [test -z "$KPLEV"], [
- AC_MSG_WARN([Failed to determine Kernel patch level. Assume latest.])
- LDISKFS_SERIES="4.4.0-73-ubuntu14+16.series"
- ],
- [test $KPLEV -ge 73], [LDISKFS_SERIES="4.4.0-73-ubuntu14+16.series"],
- [test $KPLEV -ge 62], [LDISKFS_SERIES="4.4.0-62-ubuntu14+16.series"],
- [test $KPLEV -ge 49], [LDISKFS_SERIES="4.4.0-49-ubuntu14+16.series"],
- [LDISKFS_SERIES="4.4.0-45-ubuntu14+16.series"]
- )
- ],
- [LDISKFS_SERIES="4.4.0-73-ubuntu14+16.series"])],
+ AS_VERSION_COMPARE([$BASEVER],[4.15.0], [],
[
KPLEV=$(echo $LINUXRELEASE | cut -d'-' -f2)
AS_IF(
],
[LDISKFS_SERIES="5.15.0-83-ubuntu20.series"])],
[LDISKFS_SERIES="5.19.0-35-ubuntu.series"],
- [LDISKFS_SERIES="5.19.0-35-ubuntu.series"])
+ [LDISKFS_SERIES="5.19.0-35-ubuntu.series"])],
+ [LDISKFS_SERIES="6.7-ml.series"],
+ [LDISKFS_SERIES="6.7-ml.series"])
], [test x$OPENEULER_KERNEL = xyes], [
case $OPENEULER_VERSION_NO in
2203.0) LDISKFS_SERIES="5.10.0-oe2203.series" ;;
AS_VERSION_COMPARE([$LINUXRELEASE],[6.6.0], [
LDISKFS_SERIES="6.1.38-ml.series"], [
LDISKFS_SERIES="6.6-ml.series"], [
- LDISKFS_SERIES="6.6-ml.series"]
+ AS_VERSION_COMPARE([$LINUXRELEASE],[6.7.0], [
+ LDISKFS_SERIES="6.6-ml.series"], [
+ LDISKFS_SERIES="6.7-ml.series"], [
+ LDISKFS_SERIES="6.7-ml.series"]
+ )] # 6.7
)] # 6.6
)] # 6.1
)] # 5.10
uapi_linux_headers := $(wildcard @LINUX@/include/uapi/linux/ext4*.h)
linux_new_headers := htree_lock.h
trace_headers := $(wildcard @LINUX@/include/trace/events/ext4*.h)
+backfs_unit_tests := $(wildcard @EXT4_SRC_DIR@/*-test.c)
-backfs_sources := $(filter-out %.mod.c %/inode-test.c @EXT4_CRYPTO@,$(wildcard @EXT4_SRC_DIR@/*.c))
+backfs_sources := $(filter-out %.mod.c $(backfs_unit_tests) @EXT4_CRYPTO@,$(wildcard @EXT4_SRC_DIR@/*.c))
new_sources := mmp.c htree_lock.c critical_encode.h encdata.h
new_headers :=
fs/ext4/ext4.h | 107 ++++++++++++++-
fs/ext4/fast_commit.c | 2 +-
fs/ext4/inline.c | 8 +-
- fs/ext4/namei.c | 295 ++++++++++++++++++++++++++++++++++++------
+ fs/ext4/namei.c | 297 ++++++++++++++++++++++++++++++++++++------
fs/ext4/super.c | 4 +-
- 6 files changed, 369 insertions(+), 56 deletions(-)
+ 6 files changed, 370 insertions(+), 57 deletions(-)
diff --git a/fs/ext4/dir.c b/fs/ext4/dir.c
index 3985f8c3..b8e4df14 100644
ext4_set_de_type(inode->i_sb, &fake, S_IFDIR);
de = &fake;
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
-index 8fafbe65..38858511 100644
+index 8fafbe65..deb7fc46 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -290,7 +290,8 @@ static unsigned dx_get_count(struct dx_entry *entries);
if (offset)
*offset = count_offset;
-@@ -558,11 +560,12 @@ ext4_next_entry(struct ext4_dir_entry_2 *p, unsigned long blocksize)
+@@ -556,13 +558,14 @@ ext4_next_entry(struct ext4_dir_entry_2 *p, unsigned long blocksize)
+ * Future: use high four bits of block for coalesce-on-delete flags
+ * Mask them off for now.
*/
- struct dx_root_info *dx_get_dx_info(struct ext4_dir_entry_2 *de)
+-struct dx_root_info *dx_get_dx_info(struct ext4_dir_entry_2 *de)
++static struct dx_root_info *dx_get_dx_info(struct ext4_dir_entry_2 *de)
{
+ BUG_ON(de->name_len != 1);
/* get dotdot first */
--- /dev/null
+commit 2963f3d09eb3a0817f87386c0bd7be7ce086809d
+Author: Wang Shilong <wshilong@whamcloud.com>
+AuthorDate: Tue Sep 8 21:54:29 2015 +0800
+LU-7114 ldiskfs: corrupted bitmaps handling patches
+
+This patch backported following patches from upstream:
+
+163a203ddb36c36d4a1c942aececda0cc8d06aa7
+ext4: mark block group as corrupt on block bitmap error
+
+87a39389be3e3b007d341be510a7e4a0542bdf05
+ext4: mark block group as corrupt on inode bitmap error
+
+bdfb6ff4a255dcebeb09a901250e13a97eff75af
+ext4: mark group corrupt on group descriptor checksum
+
+Also use ext4_warning() instead of ext4_error() so that
+filesystem don't become RO in default, and together
+with these patches,FS wil still be usable even such
+bad things happen.
+
+Signed-off-by: Wang Shilong <wshilong@ddn.com>
+Change-Id: Ib4075aba7df6f7f59e89a90475405080acd43dd0
+Reviewed-on: http://review.whamcloud.com/16312
+Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
+Reviewed-by: Yang Sheng <yang.sheng@intel.com>
+
+NOTE: Ported to linux 6.7 keeps the ext4_warning() updates.
+---
+ fs/ext4/balloc.c | 18 +++++++--------
+ fs/ext4/ialloc.c | 6 ++---
+ fs/ext4/mballoc.c | 59 ++++++++++++++++++-----------------------------
+ 3 files changed, 34 insertions(+), 49 deletions(-)
+
+diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c
+index 591fb3f7..6f19cefd 100644
+--- a/fs/ext4/balloc.c
++++ b/fs/ext4/balloc.c
+@@ -420,7 +420,7 @@ static int ext4_validate_block_bitmap(struct super_block *sb,
+ if (unlikely(!ext4_block_bitmap_csum_verify(sb, desc, bh) ||
+ ext4_simulate_fail(sb, EXT4_SIM_BBITMAP_CRC))) {
+ ext4_unlock_group(sb, block_group);
+- ext4_error(sb, "bg %u: bad block bitmap checksum", block_group);
++ ext4_warning(sb, "bg %u: bad block bitmap checksum", block_group);
+ ext4_mark_group_bitmap_corrupted(sb, block_group,
+ EXT4_GROUP_INFO_BBITMAP_CORRUPT);
+ return -EFSBADCRC;
+@@ -428,8 +428,8 @@ static int ext4_validate_block_bitmap(struct super_block *sb,
+ blk = ext4_valid_block_bitmap(sb, desc, block_group, bh);
+ if (unlikely(blk != 0)) {
+ ext4_unlock_group(sb, block_group);
+- ext4_error(sb, "bg %u: block %llu: invalid block bitmap",
+- block_group, blk);
++ ext4_warning(sb, "bg %u: block %llu: invalid block bitmap",
++ block_group, blk);
+ ext4_mark_group_bitmap_corrupted(sb, block_group,
+ EXT4_GROUP_INFO_BBITMAP_CORRUPT);
+ return -EFSCORRUPTED;
+@@ -519,18 +519,16 @@ ext4_read_block_bitmap_nowait(struct super_block *sb, ext4_group_t block_group,
+ goto out;
+ }
+ err = ext4_init_block_bitmap(sb, bh, block_group, desc);
+- if (err) {
+- ext4_unlock_group(sb, block_group);
+- unlock_buffer(bh);
+- ext4_error(sb, "Failed to init block bitmap for group "
+- "%u: %d", block_group, err);
+- goto out;
+- }
+ set_bitmap_uptodate(bh);
+ set_buffer_uptodate(bh);
+ set_buffer_verified(bh);
+ ext4_unlock_group(sb, block_group);
+ unlock_buffer(bh);
++ if (err) {
++ ext4_warning(sb, "Failed to init block bitmap for group "
++ "%u: %d", block_group, err);
++ goto out;
++ }
+ return bh;
+ }
+ ext4_unlock_group(sb, block_group);
+diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
+index 31480792..c725ade0 100644
+--- a/fs/ext4/ialloc.c
++++ b/fs/ext4/ialloc.c
+@@ -102,8 +102,8 @@ static int ext4_validate_inode_bitmap(struct super_block *sb,
+ EXT4_INODES_PER_GROUP(sb) / 8) ||
+ ext4_simulate_fail(sb, EXT4_SIM_IBITMAP_CRC)) {
+ ext4_unlock_group(sb, block_group);
+- ext4_error(sb, "Corrupt inode bitmap - block_group = %u, "
+- "inode_bitmap = %llu", block_group, blk);
++ ext4_warning(sb, "Corrupt inode bitmap - block_group = %u, "
++ "inode_bitmap = %llu", block_group, blk);
+ ext4_mark_group_bitmap_corrupted(sb, block_group,
+ EXT4_GROUP_INFO_IBITMAP_CORRUPT);
+ return -EFSBADCRC;
+@@ -353,7 +353,7 @@ out:
+ if (!fatal)
+ fatal = err;
+ } else {
+- ext4_error(sb, "bit already cleared for inode %lu", ino);
++ ext4_warning(sb, "bit already cleared for inode %lu", ino);
+ ext4_mark_group_bitmap_corrupted(sb, block_group,
+ EXT4_GROUP_INFO_IBITMAP_CORRUPT);
+ }
+diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
+index 21bd12b1..f23658f2 100644
+--- a/fs/ext4/mballoc.c
++++ b/fs/ext4/mballoc.c
+@@ -1211,10 +1211,14 @@ int ext4_mb_generate_buddy(struct super_block *sb,
+ grp->bb_fragments = fragments;
+
+ if (free != grp->bb_free) {
+- ext4_grp_locked_error(sb, group, 0, 0,
+- "block bitmap and bg descriptor "
+- "inconsistent: %u vs %u free clusters",
+- free, grp->bb_free);
++ struct ext4_group_desc *gdp;
++ gdp = ext4_get_group_desc(sb, group, NULL);
++ ext4_warning(sb, "group %lu: block bitmap and bg descriptor "
++ "inconsistent: %u vs %u free clusters "
++ "%u in gd, %lu pa's",
++ (long unsigned int)group, free, grp->bb_free,
++ ext4_free_group_clusters(sb, gdp),
++ grp->bb_prealloc_nr);
+ /*
+ * If we intend to continue, we consider group descriptor
+ * corrupt and update bb_free using bitmap value
+@@ -1565,7 +1569,7 @@ ext4_mb_load_buddy_gfp(struct super_block *sb, ext4_group_t group,
+ int block;
+ int pnum;
+ int poff;
+- struct page *page;
++ struct page *page = NULL;
+ int ret;
+ struct ext4_group_info *grp;
+ struct ext4_sb_info *sbi = EXT4_SB(sb);
+@@ -1593,7 +1597,7 @@ ext4_mb_load_buddy_gfp(struct super_block *sb, ext4_group_t group,
+ */
+ ret = ext4_mb_init_group(sb, group, gfp);
+ if (ret)
+- return ret;
++ goto err;
+ }
+
+ /*
+@@ -1704,6 +1708,7 @@ err:
+
+ e4b->bd_buddy = NULL;
+ e4b->bd_bitmap = NULL;
++ ext4_warning(sb, "Error loading buddy information for %u", group);
+ return ret;
+ }
+
+@@ -5097,9 +5102,11 @@ int ext4_mb_check_ondisk_bitmap(struct super_block *sb, void *bitmap,
+ }
+
+ if (free != free_in_gdp) {
+- ext4_error(sb, "on-disk bitmap for group %d"
++ ext4_warning(sb, "on-disk bitmap for group %d"
+ "corrupted: %u blocks free in bitmap, %u - in gd\n",
+ group, free, free_in_gdp);
++ ext4_mark_group_bitmap_corrupted(sb, group,
++ EXT4_GROUP_INFO_BBITMAP_CORRUPT);
+ return -EIO;
+ }
+ return 0;
+@@ -5510,16 +5517,8 @@ ext4_mb_release_inode_pa(struct ext4_buddy *e4b, struct buffer_head *bitmap_bh,
+ /* "free < pa->pa_free" means we maybe double alloc the same blocks,
+ * otherwise maybe leave some free blocks unavailable, no need to BUG.*/
+ if ((free > pa->pa_free && !pa->pa_error) || (free < pa->pa_free)) {
+- ext4_error(sb, "pa free mismatch: [pa %p] "
+- "[phy %lu] [logic %lu] [len %u] [free %u] "
+- "[error %u] [inode %d] [freed %u]", pa,
+- (unsigned long)pa->pa_pstart,
+- (unsigned long)pa->pa_lstart,
+- pa->pa_len, (unsigned)pa->pa_free,
+- (unsigned)pa->pa_error, pa->pa_inode->i_ino,
+- free);
+ ext4_grp_locked_error(sb, group, 0, 0, "free %u, pa_free %u",
+- free, pa->pa_free);
++ free, pa->pa_free);
+ /*
+ * pa is already deleted so we use the value obtained
+ * from the bitmap and continue.
+@@ -5586,16 +5585,11 @@ ext4_mb_discard_group_preallocations(struct super_block *sb,
+ bitmap_bh = ext4_read_block_bitmap(sb, group);
+ if (IS_ERR(bitmap_bh)) {
+ err = PTR_ERR(bitmap_bh);
+- ext4_error_err(sb, -err,
+- "Error %d reading block bitmap for %u",
+- err, group);
+ goto out_dbg;
+ }
+
+ err = ext4_mb_load_buddy(sb, group, &e4b);
+ if (err) {
+- ext4_warning(sb, "Error %d loading buddy information for %u",
+- err, group);
+ put_bh(bitmap_bh);
+ goto out_dbg;
+ }
+@@ -5760,17 +5754,12 @@ repeat:
+
+ err = ext4_mb_load_buddy_gfp(sb, group, &e4b,
+ GFP_NOFS|__GFP_NOFAIL);
+- if (err) {
+- ext4_error_err(sb, -err, "Error %d loading buddy information for %u",
+- err, group);
++ if (err)
+ return;
+- }
+
+ bitmap_bh = ext4_read_block_bitmap(sb, group);
+ if (IS_ERR(bitmap_bh)) {
+ err = PTR_ERR(bitmap_bh);
+- ext4_error_err(sb, -err, "Error %d reading block bitmap for %u",
+- err, group);
+ ext4_mb_unload_buddy(&e4b);
+ continue;
+ }
+@@ -6075,11 +6064,8 @@ ext4_mb_discard_lg_preallocations(struct super_block *sb,
+ group = ext4_get_group_number(sb, pa->pa_pstart);
+ err = ext4_mb_load_buddy_gfp(sb, group, &e4b,
+ GFP_NOFS|__GFP_NOFAIL);
+- if (err) {
+- ext4_error_err(sb, -err, "Error %d loading buddy information for %u",
+- err, group);
++ if (err)
+ continue;
+- }
+ ext4_lock_group(sb, group);
+ list_del(&pa->pa_group_list);
+ ext4_get_group_info(sb, group)->bb_prealloc_nr--;
+@@ -6443,7 +6429,7 @@ errout:
+ * been updated or not when fail case. So can
+ * not revert pa_free back, just mark pa_error*/
+ pa->pa_error++;
+- ext4_error(sb,
++ ext4_warning(sb,
+ "Updating bitmap error: [err %d] "
+ "[pa %p] [phy %lu] [logic %lu] "
+ "[len %u] [free %u] [error %u] "
+@@ -6454,6 +6440,7 @@ errout:
+ (unsigned)pa->pa_free,
+ (unsigned)pa->pa_error,
+ pa->pa_inode ? pa->pa_inode->i_ino : 0);
++ ext4_mark_group_bitmap_corrupted(sb, 0, 0);
+ }
+ }
+ ext4_mb_release_context(ac);
+@@ -6649,7 +6636,7 @@ do_more:
+ err = ext4_mb_load_buddy_gfp(sb, block_group, &e4b,
+ GFP_NOFS|__GFP_NOFAIL);
+ if (err)
+- goto error_out;
++ goto error_quiet;
+
+ if (!(flags & EXT4_FREE_BLOCKS_VALIDATED) &&
+ !ext4_inode_block_valid(inode, block, count)) {
+@@ -6739,6 +6726,7 @@ error_clean:
+ ext4_mb_unload_buddy(&e4b);
+ error_out:
+ ext4_std_error(sb, err);
++error_quiet:
+ }
+
+ /**
+@@ -6884,7 +6872,7 @@ int ext4_group_add_blocks(handle_t *handle, struct super_block *sb,
+
+ err = ext4_mb_load_buddy(sb, block_group, &e4b);
+ if (err)
+- goto error_out;
++ goto error_quiet;
+
+ if (!ext4_sb_block_valid(sb, NULL, block, count)) {
+ ext4_error(sb, "Adding blocks in system zones - "
+@@ -6913,6 +6901,7 @@ error_clean:
+ ext4_mb_unload_buddy(&e4b);
+ error_out:
+ ext4_std_error(sb, err);
++error_quiet:
+ return err;
+ }
+
+@@ -7048,8 +7037,6 @@ ext4_trim_all_free(struct super_block *sb, ext4_group_t group,
+
+ ret = ext4_mb_load_buddy(sb, group, &e4b);
+ if (ret) {
+- ext4_warning(sb, "Error %d loading buddy information for %u",
+- ret, group);
+ return ret;
+ }
+
+--
+2.34.1
+
--- /dev/null
+commit 5bb641fa61175fd0fe63e830219d88304b5162c3
+Author: Shaun Tancheff <shaun.tancheff@hpe.com>
+AuthorDate: Thu Dec 10 10:31:51 2020 -0600
+LU-13239 ldiskfs: pass inode timestamps at initial creation
+
+A previous patch https://github.com/Cray/lustre/commit/6d4fb6694
+"LUS-4880 osd-ldiskfs: pass uid/gid/xtime directly to ldiskfs"
+was intended to be ported to upstream lustre but was lost.
+
+The patch https://review.whamcloud.com/34685/
+"LU-12151 osd-ldiskfs: pass owner down rather than transfer it"
+passed the inode UID and GID down to ldiskfs at inode allocation
+time to avoid the overhead of transferring quota from the inode
+(initially created as root) over to the actual user of the file.
+
+The two patches differed slightly in that the LUS-4880 included
+passing the a/m/ctimes from osd-ldiskfs to ldiskfs at inode
+creation time avoids overhead of setting the timestamps afterward.
+
+Benchmarks using MDTEST:
+ mdtest -f 32 -l 32 -n 16384 -i 5 -p 120 -t -u -v -d mdtest
+
+ master patched
+ Operation Mean Std Dev Mean Std Dev
+ --------- ---- ------- ---- -------
+ Directory creation: 17008.593 72.700 17099.863 155.461
+ Directory stat : 170513.269 1456.002 170105.207 2349.934
+ Directory removal : 80796.147 2633.832 84480.222 892.536
+ File creation : 39227.419 7014.539 40429.900 6643.868
+ File stat : 101761.395 2979.802 103818.800 1146.689
+ File read : 86583.370 871.982 85725.254 965.862
+ File removal : 74923.504 761.048 75075.180 723.966
+ Tree creation : 588.570 244.534 608.332 123.939
+ Tree removal : 39.874 1.873 44.357 2.350
+
+This patch also reorganizes the ldiskfs patch series in
+order to accommodate struct iattr being added to
+ldiskfs_create_inode.
+All supported server platforms RHEL 7.5+, SUSE 12+ and
+ubuntu 18+ are affected.
+
+HPE-bug-id: LUS-7378, LUS-4880, LUS-8042, LUS-9157, LUS-8772, LUS-8769
+Signed-off-by: Shaun Tancheff <shaun.tancheff@hpe.com>
+Change-Id: I87e9c792b5240820bfd3a7268e477970ebac8465
+Reviewed-on: https://review.whamcloud.com/37556
+Reviewed-by: Petros Koutoupis <petros.koutoupis@hpe.com>
+Reviewed-by: Jian Yu <yujian@whamcloud.com>
+Reviewed-by: Wang Shilong <wshilong@whamcloud.com>
+---
+ fs/ext4/ext4.h | 8 ++++----
+ fs/ext4/ialloc.c | 11 ++++++++++-
+ fs/ext4/namei.c | 13 +++++++++++--
+ 3 files changed, 25 insertions(+), 7 deletions(-)
+
+diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
+index ad4e70a5..abb98f4c 100644
+--- a/fs/ext4/ext4.h
++++ b/fs/ext4/ext4.h
+@@ -3029,15 +3029,15 @@ extern struct inode *__ext4_new_inode(struct mnt_idmap *, handle_t *,
+ const struct qstr *qstr, __u32 goal,
+ uid_t *owner, __u32 i_flags,
+ int handle_type, unsigned int line_no,
+- int nblocks);
++ int nblocks, struct iattr *iattr);
+
+ #define ext4_new_inode(handle, dir, mode, qstr, goal, owner, i_flags) \
+ __ext4_new_inode(&nop_mnt_idmap, (handle), (dir), (mode), (qstr), \
+- (goal), (owner), i_flags, 0, 0, 0)
++ (goal), (owner), i_flags, 0, 0, 0, NULL)
+ #define ext4_new_inode_start_handle(idmap, dir, mode, qstr, goal, owner, \
+ type, nblocks) \
+ __ext4_new_inode((idmap), NULL, (dir), (mode), (qstr), (goal), (owner), \
+- 0, (type), __LINE__, (nblocks))
++ 0, (type), __LINE__, (nblocks), NULL)
+
+
+ extern void ext4_free_inode(handle_t *, struct inode *);
+@@ -3231,7 +3231,7 @@ extern int ext4_htree_fill_tree(struct file *dir_file, __u32 start_hash,
+ __u32 start_minor_hash, __u32 *next_hash);
+ extern struct inode *ext4_create_inode(handle_t *handle,
+ struct inode *dir, int mode,
+- uid_t *owner);
++ struct iattr *iattr);
+ extern int ext4_delete_entry(handle_t *handle, struct inode * dir,
+ struct ext4_dir_entry_2 *de_del,
+ struct buffer_head *bh);
+diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
+index c725ade0..fc1f09fe 100644
+--- a/fs/ext4/ialloc.c
++++ b/fs/ext4/ialloc.c
+@@ -926,7 +926,7 @@ struct inode *__ext4_new_inode(struct mnt_idmap *idmap,
+ umode_t mode, const struct qstr *qstr,
+ __u32 goal, uid_t *owner, __u32 i_flags,
+ int handle_type, unsigned int line_no,
+- int nblocks)
++ int nblocks, struct iattr *iattr)
+ {
+ struct super_block *sb;
+ struct buffer_head *inode_bitmap_bh = NULL;
+@@ -1309,6 +1309,15 @@ got:
+ if (err)
+ goto fail_drop;
+
++ if (iattr) {
++ if (iattr->ia_valid & ATTR_CTIME)
++ inode_set_ctime_to_ts(inode, iattr->ia_ctime);
++ if (iattr->ia_valid & ATTR_MTIME)
++ inode_set_mtime_to_ts(inode, iattr->ia_mtime);
++ if (iattr->ia_valid & ATTR_ATIME)
++ inode_set_atime_to_ts(inode, iattr->ia_atime);
++ }
++
+ /*
+ * Since the encryption xattr will always be unique, create it first so
+ * that it's less likely to end up in an external xattr block and
+diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
+index 6d2c0b6d..273d7e9f 100644
+--- a/fs/ext4/namei.c
++++ b/fs/ext4/namei.c
+@@ -3435,11 +3435,20 @@ static int ext4_add_nondir(handle_t *handle,
+ /* 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,
+- uid_t *owner)
++ struct iattr *iattr)
+ {
+ struct inode *inode;
++ uid_t owner[2] = {0, 0};
+
+- inode = ext4_new_inode(handle, dir, mode, NULL, 0, owner, 0);
++ if (iattr) {
++ if (iattr->ia_valid & ATTR_UID)
++ owner[0] = from_kuid(&init_user_ns, iattr->ia_uid);
++ if (iattr->ia_valid & ATTR_GID)
++ owner[1] = from_kgid(&init_user_ns, iattr->ia_gid);
++ }
++
++ inode = __ext4_new_inode(&nop_mnt_idmap, handle, dir, mode, NULL, 0, owner, 0,
++ 0, 0, 0, iattr);
+ if (!IS_ERR(inode)) {
+ if (S_ISCHR(mode) || S_ISBLK(mode) || S_ISFIFO(mode)) {
+ #ifdef CONFIG_LDISKFS_FS_XATTR
+--
+2.34.1
+
--- /dev/null
+linux-5.16/ext4-inode-version.patch
+linux-5.18/ext4-lookup-dotdot.patch
+linux-5.14/ext4-print-inum-in-htree-warning.patch
+linux-6.5/ext4-prealloc.patch
+linux-5.16/ext4-osd-iop-common.patch
+linux-5.16/ext4-misc.patch
+linux-6.6/ext4-mballoc-extra-checks.patch
+sles15sp4/ext4-hash-indexed-dir-dotdot-update.patch
+linux-5.14/ext4-kill-dx-root.patch
+linux-6.5/ext4-mballoc-pa-free-mismatch.patch
+linux-6.5/ext4-data-in-dirent.patch
+linux-6.6/ext4-nocmtime.patch
+base/ext4-htree-lock.patch
+linux-6.5/ext4-pdirop.patch
+rhel9/ext4-max-dir-size.patch
+linux-6.7/ext4-corrupted-inode-block-bitmaps-handling-patches.patch
+rhel9/ext4-give-warning-with-dir-htree-growing.patch
+ubuntu18/ext4-jcb-optimization.patch
+linux-6.2/ext4-attach-jinode-in-writepages.patch
+linux-6.5/ext4-dont-check-before-replay.patch
+rhel7.6/ext4-use-GFP_NOFS-in-ext4_inode_attach_jinode.patch
+rhel7.6/ext4-export-orphan-add.patch
+linux-5.18/ext4-export-mb-stream-allocator-variables.patch
+ubuntu19/ext4-iget-with-flags.patch
+linux-5.14/export-ext4fs-dirhash-helper.patch
+linux-5.8/ext4-no-max-dir-size-limit-for-iam-objects.patch
+rhel9/ext4-dquot-commit-speedup.patch
+linux-6.7/ext4-ialloc-uid-gid-and-pass-owner-down.patch
+linux-5.14/ext4-projid-xattrs.patch
+linux-6.6/ext4-delayed-iput.patch
+rhel8/ext4-ext-merge.patch
+linux-5.14/ext4-xattr-disable-credits-check.patch
+rhel9.2/ext4-fiemap-kernel-data.patch
+rhel8/ext4-old_ea_inodes_handling_fix.patch
+ubuntu20.04.5/ext4-filename-encode.patch
+rhel9.1/ext4-enc-flag.patch
+linux-6.6/ext4-encdata.patch
__u64 oied_off;
unsigned short oied_namelen;
unsigned int oied_type;
- char oied_name[0];
+ char oied_name[];
} __attribute__((packed));
/**