Whamcloud - gitweb
LU-17943 osd-ldiskfs: initialize dquot before expanding inode size 73/55673/4
authorLi Dongyang <dongyangli@ddn.com>
Tue, 9 Jul 2024 12:49:20 +0000 (22:49 +1000)
committerOleg Drokin <green@whamcloud.com>
Thu, 12 Sep 2024 05:52:21 +0000 (05:52 +0000)
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 <dongyangli@ddn.com>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/55673
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: Hongchao Zhang <hongchao@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lustre/osd-ldiskfs/osd_handler.c

index b19439d..5ec20fc 100644 (file)
@@ -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);