From 3fd57f81fddc604aa94bc7797cc211c7e393b3d0 Mon Sep 17 00:00:00 2001 From: Li Dongyang Date: Tue, 9 Jul 2024 22:49:20 +1000 Subject: [PATCH] LU-17943 osd-ldiskfs: initialize dquot before expanding inode size Since upstream kernel v6.1-rc4 8994d11395f8 ext4: avoid unaccounted block allocation when expanding inode If the quota is not initialized when trying to expand the inode size, ext4/ldiskfs will just bail and return error. Unfortunately this change made to some distro kernels like el8.10. Change-Id: I874c86678c592a60c5954fcb2064150cf77e5634 Signed-off-by: Li Dongyang Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/55673 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Oleg Drokin Reviewed-by: Hongchao Zhang Reviewed-by: Andreas Dilger --- lustre/osd-ldiskfs/osd_handler.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lustre/osd-ldiskfs/osd_handler.c b/lustre/osd-ldiskfs/osd_handler.c index b19439d..5ec20fc6 100644 --- a/lustre/osd-ldiskfs/osd_handler.c +++ b/lustre/osd-ldiskfs/osd_handler.c @@ -3233,6 +3233,8 @@ static int osd_transfer_project(struct inode *inode, __u32 projid, if (projid_eq(kprojid, LDISKFS_I(inode)->i_projid)) return 0; + dquot_initialize(inode); + err = ldiskfs_get_inode_loc(inode, &iloc); if (err) return err; @@ -3254,7 +3256,6 @@ static int osd_transfer_project(struct inode *inode, __u32 projid, } brelse(iloc.bh); - dquot_initialize(inode); transfer_to[PRJQUOTA] = dqget(sb, make_kqid_projid(kprojid)); if (transfer_to[PRJQUOTA]) { lock_dquot_transfer(inode); -- 1.8.3.1