From af3d457b77e0ffb649871532b04e4721a701f974 Mon Sep 17 00:00:00 2001 From: Wang Shilong Date: Thu, 20 Apr 2017 22:31:22 -0400 Subject: [PATCH] LU-9339 ldiskfs: fix regression of macro check include/linux/quota.h undefine @PRJQUOTA and make it enum, ldiskfs macro check here will be negative, fix it to use @HAVE_PROJECT_QUOTA, also wrap ext4-export-*.patch to ext4-projid-feature-support.patch. Change-Id: I415e366423408413dfb5b99dee98f7a30513f83f Signed-off-by: Wang Shilong Reviewed-on: https://review.whamcloud.com/26769 Reviewed-by: Andreas Dilger Reviewed-by: Yang Sheng Reviewed-by: Li Xi Tested-by: Jenkins Reviewed-by: James Simmons Tested-by: Maloo Reviewed-by: Oleg Drokin --- ...export-__ext4_ioctl_setproject-for-lustre.patch | 62 ---------------------- .../rhel7/ext4-projid-feature-support.patch | 2 +- .../patches/rhel7/ext4-projid-xfs-ioctls.patch | 56 ++++++++++++------- .../series/ldiskfs-3.10-rhel7.2.series | 1 - .../series/ldiskfs-3.10-rhel7.3.series | 1 - 5 files changed, 39 insertions(+), 83 deletions(-) delete mode 100644 ldiskfs/kernel_patches/patches/rhel7/ext4-export-__ext4_ioctl_setproject-for-lustre.patch diff --git a/ldiskfs/kernel_patches/patches/rhel7/ext4-export-__ext4_ioctl_setproject-for-lustre.patch b/ldiskfs/kernel_patches/patches/rhel7/ext4-export-__ext4_ioctl_setproject-for-lustre.patch deleted file mode 100644 index 35a5379..0000000 --- a/ldiskfs/kernel_patches/patches/rhel7/ext4-export-__ext4_ioctl_setproject-for-lustre.patch +++ /dev/null @@ -1,62 +0,0 @@ -diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h -index 8fa347b..92b4101 100644 ---- a/fs/ext4/ext4.h -+++ b/fs/ext4/ext4.h -@@ -2178,6 +2178,7 @@ extern int ext4_ind_remove_space(handle_t *handle, struct inode *inode, - /* ioctl.c */ - extern long ext4_ioctl(struct file *, unsigned int, unsigned long); - extern long ext4_compat_ioctl(struct file *, unsigned int, unsigned long); -+extern int __ext4_ioctl_setproject(struct inode *inode, __u32 projid); - - /* migrate.c */ - extern int ext4_ext_migrate(struct inode *); -diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c -index 890f21e..a4443e9 100644 ---- a/fs/ext4/ioctl.c -+++ b/fs/ext4/ioctl.c -@@ -294,9 +294,8 @@ flags_out: - } - - #ifdef CONFIG_QUOTA --static int ext4_ioctl_setproject(struct file *filp, __u32 projid) -+int __ext4_ioctl_setproject(struct inode *inode, __u32 projid) - { -- struct inode *inode = file_inode(filp); - struct super_block *sb = inode->i_sb; - struct ext4_inode_info *ei = EXT4_I(inode); - int err, rc; -@@ -324,10 +323,6 @@ static int ext4_ioctl_setproject(struct file *filp, __u32 projid) - if (projid_eq(kprojid, EXT4_I(inode)->i_projid)) - return 0; - -- err = mnt_want_write_file(filp); -- if (err) -- return err; -- - err = -EPERM; - mutex_lock(&inode->i_mutex); - /* Is it quota file? Do not allow user to mess with it */ -@@ -378,6 +373,23 @@ out_stop: - ext4_journal_stop(handle); - out_unlock: - mutex_unlock(&inode->i_mutex); -+ return err; -+ -+ -+} -+EXPORT_SYMBOL(__ext4_ioctl_setproject); -+ -+static int ext4_ioctl_setproject(struct file *filp, __u32 projid) -+{ -+ int err; -+ struct inode *inode = file_inode(filp); -+ -+ err = mnt_want_write_file(filp); -+ if (err) -+ return err; -+ -+ err = __ext4_ioctl_setproject(inode, projid); -+ - mnt_drop_write_file(filp); - return err; - } diff --git a/ldiskfs/kernel_patches/patches/rhel7/ext4-projid-feature-support.patch b/ldiskfs/kernel_patches/patches/rhel7/ext4-projid-feature-support.patch index 50cab9d..593b602 100644 --- a/ldiskfs/kernel_patches/patches/rhel7/ext4-projid-feature-support.patch +++ b/ldiskfs/kernel_patches/patches/rhel7/ext4-projid-feature-support.patch @@ -232,7 +232,7 @@ Index: linux-stage/fs/ext4/super.c .write_info = ext4_write_info, .alloc_dquot = dquot_alloc, .destroy_dquot = dquot_destroy, -+#ifdef PRJQUOTA ++#ifdef HAVE_PROJECT_QUOTA + .get_projid = ext4_get_projid, +#endif }; diff --git a/ldiskfs/kernel_patches/patches/rhel7/ext4-projid-xfs-ioctls.patch b/ldiskfs/kernel_patches/patches/rhel7/ext4-projid-xfs-ioctls.patch index 4cc7c11..a3ef640 100644 --- a/ldiskfs/kernel_patches/patches/rhel7/ext4-projid-xfs-ioctls.patch +++ b/ldiskfs/kernel_patches/patches/rhel7/ext4-projid-xfs-ioctls.patch @@ -1,7 +1,7 @@ -Index: linux-stage/fs/ext4/ext4.h -=================================================================== ---- linux-stage.orig/fs/ext4/ext4.h -+++ linux-stage/fs/ext4/ext4.h +diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h +index 31317c9..39b31aa 100644 +--- a/fs/ext4/ext4.h ++++ b/fs/ext4/ext4.h @@ -398,6 +398,13 @@ struct flex_groups { #define EXT4_FL_USER_VISIBLE 0x304BDFFF /* User visible flags */ #define EXT4_FL_USER_MODIFIABLE 0x204380FF /* User modifiable flags */ @@ -61,10 +61,18 @@ Index: linux-stage/fs/ext4/ext4.h #if defined(__KERNEL__) && defined(CONFIG_COMPAT) /* * ioctl commands in 32 bit emulation -Index: linux-stage/fs/ext4/ioctl.c -=================================================================== ---- linux-stage.orig/fs/ext4/ioctl.c -+++ linux-stage/fs/ext4/ioctl.c +@@ -2336,6 +2381,7 @@ extern int ext4_ind_remove_space(handle_t *handle, struct inode *inode, + /* ioctl.c */ + extern long ext4_ioctl(struct file *, unsigned int, unsigned long); + extern long ext4_compat_ioctl(struct file *, unsigned int, unsigned long); ++extern int __ext4_ioctl_setproject(struct inode *inode, __u32 projid); + + /* migrate.c */ + extern int ext4_ext_migrate(struct inode *); +diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c +index bfda18a..a4443e9 100644 +--- a/fs/ext4/ioctl.c ++++ b/fs/ext4/ioctl.c @@ -15,6 +15,7 @@ #include #include @@ -73,7 +81,7 @@ Index: linux-stage/fs/ext4/ioctl.c #include "ext4_jbd2.h" #include "ext4.h" -@@ -198,6 +199,239 @@ journal_err_out: +@@ -198,6 +199,251 @@ journal_err_out: return err; } @@ -172,9 +180,8 @@ Index: linux-stage/fs/ext4/ioctl.c +} + +#ifdef CONFIG_QUOTA -+static int ext4_ioctl_setproject(struct file *filp, __u32 projid) ++int __ext4_ioctl_setproject(struct inode *inode, __u32 projid) +{ -+ struct inode *inode = file_inode(filp); + struct super_block *sb = inode->i_sb; + struct ext4_inode_info *ei = EXT4_I(inode); + int err, rc; @@ -202,10 +209,6 @@ Index: linux-stage/fs/ext4/ioctl.c + if (projid_eq(kprojid, EXT4_I(inode)->i_projid)) + return 0; + -+ err = mnt_want_write_file(filp); -+ if (err) -+ return err; -+ + err = -EPERM; + mutex_lock(&inode->i_mutex); + /* Is it quota file? Do not allow user to mess with it */ @@ -256,6 +259,23 @@ Index: linux-stage/fs/ext4/ioctl.c + ext4_journal_stop(handle); +out_unlock: + mutex_unlock(&inode->i_mutex); ++ return err; ++ ++ ++} ++EXPORT_SYMBOL(__ext4_ioctl_setproject); ++ ++static int ext4_ioctl_setproject(struct file *filp, __u32 projid) ++{ ++ int err; ++ struct inode *inode = file_inode(filp); ++ ++ err = mnt_want_write_file(filp); ++ if (err) ++ return err; ++ ++ err = __ext4_ioctl_setproject(inode, projid); ++ + mnt_drop_write_file(filp); + return err; +} @@ -313,7 +333,7 @@ Index: linux-stage/fs/ext4/ioctl.c long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) { struct inode *inode = file_inode(filp); -@@ -213,11 +447,7 @@ long ext4_ioctl(struct file *filp, unsig +@@ -213,11 +459,7 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) flags = ei->i_flags & EXT4_FL_USER_VISIBLE; return put_user(flags, (int __user *) arg); case EXT4_IOC_SETFLAGS: { @@ -326,7 +346,7 @@ Index: linux-stage/fs/ext4/ioctl.c if (!inode_owner_or_capable(inode)) return -EACCES; -@@ -231,89 +461,8 @@ long ext4_ioctl(struct file *filp, unsig +@@ -231,89 +473,8 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) flags = ext4_mask_flags(inode->i_mode, flags); @@ -417,7 +437,7 @@ Index: linux-stage/fs/ext4/ioctl.c mutex_unlock(&inode->i_mutex); mnt_drop_write_file(filp); return err; -@@ -617,6 +766,62 @@ resizefs_out: +@@ -617,6 +778,62 @@ resizefs_out: } case EXT4_IOC_PRECACHE_EXTENTS: return ext4_ext_precache(inode); diff --git a/ldiskfs/kernel_patches/series/ldiskfs-3.10-rhel7.2.series b/ldiskfs/kernel_patches/series/ldiskfs-3.10-rhel7.2.series index 7adfeea..c83b3a0 100644 --- a/ldiskfs/kernel_patches/series/ldiskfs-3.10-rhel7.2.series +++ b/ldiskfs/kernel_patches/series/ldiskfs-3.10-rhel7.2.series @@ -29,4 +29,3 @@ rhel7/ext4-projid-ignore-maxquotas.patch rhel7/ext4-projid-feature-support.patch rhel7/ext4-projid-quotas.patch rhel7/ext4-projid-xfs-ioctls.patch -rhel7/ext4-export-__ext4_ioctl_setproject-for-lustre.patch diff --git a/ldiskfs/kernel_patches/series/ldiskfs-3.10-rhel7.3.series b/ldiskfs/kernel_patches/series/ldiskfs-3.10-rhel7.3.series index 9c6dd5e..3103ded 100644 --- a/ldiskfs/kernel_patches/series/ldiskfs-3.10-rhel7.3.series +++ b/ldiskfs/kernel_patches/series/ldiskfs-3.10-rhel7.3.series @@ -27,4 +27,3 @@ rhel7/ext4-projid-ignore-maxquotas.patch rhel7/ext4-projid-feature-support.patch rhel7/ext4-projid-quotas.patch rhel7/ext4-projid-xfs-ioctls.patch -rhel7/ext4-export-__ext4_ioctl_setproject-for-lustre.patch -- 1.8.3.1