Whamcloud - gitweb
LU-12457 kernel: RHEL 7.7 server support
[fs/lustre-release.git] / ldiskfs / kernel_patches / patches / rhel7.7 / ext4-projid-ignore-maxquotas.patch
diff --git a/ldiskfs/kernel_patches/patches/rhel7.7/ext4-projid-ignore-maxquotas.patch b/ldiskfs/kernel_patches/patches/rhel7.7/ext4-projid-ignore-maxquotas.patch
new file mode 100644 (file)
index 0000000..302f137
--- /dev/null
@@ -0,0 +1,151 @@
+diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
+index d00d779..9308f35 100644
+--- a/fs/ext4/ext4.h
++++ b/fs/ext4/ext4.h
+@@ -1179,6 +1179,9 @@ struct ext4_super_block {
+ #define EXT4_MF_MNTDIR_SAMPLED        0x0001
+ #define EXT4_MF_FS_ABORTED    0x0002  /* Fatal error detected */
++/* Number of quota types we support */
++#define EXT4_MAXQUOTAS 2
++
+ /*
+  * fourth extended-fs super-block data in memory
+  */
+@@ -1242,7 +1245,7 @@ struct ext4_sb_info {
+       u32 s_min_batch_time;
+       struct block_device *journal_bdev;
+ #ifdef CONFIG_QUOTA
+-      char *s_qf_names[MAXQUOTAS];            /* Names of quota files with journalled quota */
++      char *s_qf_names[EXT4_MAXQUOTAS];       /* Names of quota files with journalled quota */
+       int s_jquota_fmt;                       /* Format of quota to use */
+ #endif
+       unsigned int s_want_extra_isize; /* New inodes should reserve # bytes */
+diff --git a/fs/ext4/ext4_jbd2.h b/fs/ext4/ext4_jbd2.h
+index 17c00ff..9c5b49f 100644
+--- a/fs/ext4/ext4_jbd2.h
++++ b/fs/ext4/ext4_jbd2.h
+@@ -102,9 +102,9 @@
+ #define EXT4_QUOTA_INIT_BLOCKS(sb) 0
+ #define EXT4_QUOTA_DEL_BLOCKS(sb) 0
+ #endif
+-#define EXT4_MAXQUOTAS_TRANS_BLOCKS(sb) (MAXQUOTAS*EXT4_QUOTA_TRANS_BLOCKS(sb))
+-#define EXT4_MAXQUOTAS_INIT_BLOCKS(sb) (MAXQUOTAS*EXT4_QUOTA_INIT_BLOCKS(sb))
+-#define EXT4_MAXQUOTAS_DEL_BLOCKS(sb) (MAXQUOTAS*EXT4_QUOTA_DEL_BLOCKS(sb))
++#define EXT4_MAXQUOTAS_TRANS_BLOCKS(sb) (EXT4_MAXQUOTAS*EXT4_QUOTA_TRANS_BLOCKS(sb))
++#define EXT4_MAXQUOTAS_INIT_BLOCKS(sb) (EXT4_MAXQUOTAS*EXT4_QUOTA_INIT_BLOCKS(sb))
++#define EXT4_MAXQUOTAS_DEL_BLOCKS(sb) (EXT4_MAXQUOTAS*EXT4_QUOTA_DEL_BLOCKS(sb))
+ static inline int ext4_jbd2_credits_xattr(struct inode *inode)
+ {
+
+Index: linux-3.10.0-1062.el7.x86_64/fs/ext4/super.c
+===================================================================
+--- linux-3.10.0-1062.el7.x86_64.orig/fs/ext4/super.c
++++ linux-3.10.0-1062.el7.x86_64/fs/ext4/super.c
+@@ -819,7 +819,7 @@ static inline void ext4_quota_off_umount
+       int type;
+       /* Use our quota_off function to clear inode flags etc. */
+-      for (type = 0; type < MAXQUOTAS; type++)
++      for (type = 0; type < EXT4_MAXQUOTAS; type++)
+               ext4_quota_off(sb, type);
+ }
+ #else
+@@ -879,7 +879,7 @@ static void ext4_put_super(struct super_
+       percpu_counter_destroy(&sbi->s_dirtyclusters_counter);
+       percpu_counter_destroy(&sbi->s_extent_cache_cnt);
+ #ifdef CONFIG_QUOTA
+-      for (i = 0; i < MAXQUOTAS; i++)
++      for (i = 0; i < EXT4_MAXQUOTAS; i++)
+               kfree(sbi->s_qf_names[i]);
+ #endif
+@@ -2356,7 +2356,7 @@ static void ext4_orphan_cleanup(struct s
+       }
+       /* Turn on journaled quotas used for old sytle */
+-      for (i = 0; i < MAXQUOTAS; i++) {
++      for (i = 0; i < EXT4_MAXQUOTAS; i++) {
+               if (EXT4_SB(sb)->s_qf_names[i]) {
+                       int ret = ext4_quota_on_mount(sb, i);
+@@ -2426,7 +2426,7 @@ static void ext4_orphan_cleanup(struct s
+ #ifdef CONFIG_QUOTA
+       /* Turn off quotas if they were enabled for orphan cleanup */
+       if (quota_update) {
+-              for (i = 0; i < MAXQUOTAS; i++) {
++              for (i = 0; i < EXT4_MAXQUOTAS; i++) {
+                       if (sb_dqopt(sb)->files[i])
+                               dquot_quota_off(sb, i);
+               }
+@@ -4561,7 +4561,7 @@ failed_mount:
+               remove_proc_entry(sb->s_id, ext4_proc_root);
+       }
+ #ifdef CONFIG_QUOTA
+-      for (i = 0; i < MAXQUOTAS; i++)
++      for (i = 0; i < EXT4_MAXQUOTAS; i++)
+               kfree(sbi->s_qf_names[i]);
+ #endif
+       ext4_blkdev_remove(sbi);
+@@ -5109,7 +5109,7 @@ struct ext4_mount_options {
+       u32 s_min_batch_time, s_max_batch_time;
+ #ifdef CONFIG_QUOTA
+       int s_jquota_fmt;
+-      char *s_qf_names[MAXQUOTAS];
++      char *s_qf_names[EXT4_MAXQUOTAS];
+ #endif
+ };
+@@ -5139,7 +5139,7 @@ static int ext4_remount(struct super_blo
+       old_opts.s_max_batch_time = sbi->s_max_batch_time;
+ #ifdef CONFIG_QUOTA
+       old_opts.s_jquota_fmt = sbi->s_jquota_fmt;
+-      for (i = 0; i < MAXQUOTAS; i++)
++      for (i = 0; i < EXT4_MAXQUOTAS; i++)
+               if (sbi->s_qf_names[i]) {
+                       old_opts.s_qf_names[i] = kstrdup(sbi->s_qf_names[i],
+                                                        GFP_KERNEL);
+@@ -5313,7 +5313,7 @@ static int ext4_remount(struct super_blo
+ #ifdef CONFIG_QUOTA
+       /* Release old quota file names */
+-      for (i = 0; i < MAXQUOTAS; i++)
++      for (i = 0; i < EXT4_MAXQUOTAS; i++)
+               kfree(old_opts.s_qf_names[i]);
+       if (enable_quota) {
+               if (sb_any_quota_suspended(sb))
+@@ -5342,7 +5342,7 @@ restore_opts:
+       sbi->s_max_batch_time = old_opts.s_max_batch_time;
+ #ifdef CONFIG_QUOTA
+       sbi->s_jquota_fmt = old_opts.s_jquota_fmt;
+-      for (i = 0; i < MAXQUOTAS; i++) {
++      for (i = 0; i < EXT4_MAXQUOTAS; i++) {
+               kfree(sbi->s_qf_names[i]);
+               sbi->s_qf_names[i] = old_opts.s_qf_names[i];
+       }
+@@ -5580,7 +5580,7 @@ static int ext4_quota_enable(struct supe
+ {
+       int err;
+       struct inode *qf_inode;
+-      unsigned long qf_inums[MAXQUOTAS] = {
++      unsigned long qf_inums[EXT4_MAXQUOTAS] = {
+               le32_to_cpu(EXT4_SB(sb)->s_es->s_usr_quota_inum),
+               le32_to_cpu(EXT4_SB(sb)->s_es->s_grp_quota_inum)
+       };
+@@ -5611,13 +5611,13 @@ static int ext4_quota_enable(struct supe
+ static int ext4_enable_quotas(struct super_block *sb)
+ {
+       int type, err = 0;
+-      unsigned long qf_inums[MAXQUOTAS] = {
++      unsigned long qf_inums[EXT4_MAXQUOTAS] = {
+               le32_to_cpu(EXT4_SB(sb)->s_es->s_usr_quota_inum),
+               le32_to_cpu(EXT4_SB(sb)->s_es->s_grp_quota_inum)
+       };
+       sb_dqopt(sb)->flags |= DQUOT_QUOTA_SYS_FILE;
+-      for (type = 0; type < MAXQUOTAS; type++) {
++      for (type = 0; type < EXT4_MAXQUOTAS; type++) {
+               if (qf_inums[type]) {
+                       err = ext4_quota_enable(sb, type, QFMT_VFS_V1,
+                                               DQUOT_USAGE_ENABLED);