Whamcloud - gitweb
LU-4017 ldiskfs: export __ext4_ioctl_setproject for lustre
[fs/lustre-release.git] / ldiskfs / kernel_patches / patches / rhel7 / ext4-export-__ext4_ioctl_setproject-for-lustre.patch
1 diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
2 index 8fa347b..92b4101 100644
3 --- a/fs/ext4/ext4.h
4 +++ b/fs/ext4/ext4.h
5 @@ -2178,6 +2178,7 @@ extern int ext4_ind_remove_space(handle_t *handle, struct inode *inode,
6  /* ioctl.c */
7  extern long ext4_ioctl(struct file *, unsigned int, unsigned long);
8  extern long ext4_compat_ioctl(struct file *, unsigned int, unsigned long);
9 +extern int __ext4_ioctl_setproject(struct inode *inode, __u32 projid);
10  
11  /* migrate.c */
12  extern int ext4_ext_migrate(struct inode *);
13 diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c
14 index 890f21e..a4443e9 100644
15 --- a/fs/ext4/ioctl.c
16 +++ b/fs/ext4/ioctl.c
17 @@ -294,9 +294,8 @@ flags_out:
18  }
19  
20  #ifdef CONFIG_QUOTA
21 -static int ext4_ioctl_setproject(struct file *filp, __u32 projid)
22 +int __ext4_ioctl_setproject(struct inode *inode, __u32 projid)
23  {
24 -       struct inode *inode = file_inode(filp);
25         struct super_block *sb = inode->i_sb;
26         struct ext4_inode_info *ei = EXT4_I(inode);
27         int err, rc;
28 @@ -324,10 +323,6 @@ static int ext4_ioctl_setproject(struct file *filp, __u32 projid)
29         if (projid_eq(kprojid, EXT4_I(inode)->i_projid))
30                 return 0;
31  
32 -       err = mnt_want_write_file(filp);
33 -       if (err)
34 -               return err;
35 -
36         err = -EPERM;
37         mutex_lock(&inode->i_mutex);
38         /* Is it quota file? Do not allow user to mess with it */
39 @@ -378,6 +373,23 @@ out_stop:
40         ext4_journal_stop(handle);
41  out_unlock:
42         mutex_unlock(&inode->i_mutex);
43 +       return err;
44 +
45 +
46 +}
47 +EXPORT_SYMBOL(__ext4_ioctl_setproject);
48 +
49 +static int ext4_ioctl_setproject(struct file *filp, __u32 projid)
50 +{
51 +       int err;
52 +       struct inode *inode = file_inode(filp);
53 +
54 +       err = mnt_want_write_file(filp);
55 +       if (err)
56 +               return err;
57 +
58 +       err = __ext4_ioctl_setproject(inode, projid);
59 +
60         mnt_drop_write_file(filp);
61         return err;
62  }