add patch create-function-to-read-journal-inode
[ext4-patch-queue.git] / suppress-inode-growth-for-file-systems-without-project-quota
blob85e5ee66cc9f2362649d928bcd519090c08a4ab8
1 ext4: suppress inode growth for file systems w/o project quota
3 We have not added a new "extra" inode field in a very long time, and
4 the code to deal with moving the extended attributes down to make room
5 for the extra inode fields has bitrotted and can cause kernel BUGS.
7 Very few people will likely use project quotas (and those that do will
8 likely be creating a new file system from scratch) so as a temporary
9 pallative until we are sure the inode expansion code is all sane,
10 let's not try to expand the inode "extra" fields if the project
11 feature has not been enabled.
13 Cc: stable@vger.kernel.org # v4.4+
14 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
15 ---
16  fs/ext4/super.c | 11 +++++++++++
17  1 file changed, 11 insertions(+)
19 diff --git a/fs/ext4/super.c b/fs/ext4/super.c
20 index c13a4e4..e2622ba 100644
21 --- a/fs/ext4/super.c
22 +++ b/fs/ext4/super.c
23 @@ -3968,6 +3968,17 @@ no_journal:
24         if (sbi->s_inode_size > EXT4_GOOD_OLD_INODE_SIZE) {
25                 sbi->s_want_extra_isize = sizeof(struct ext4_inode) -
26                                                      EXT4_GOOD_OLD_INODE_SIZE;
27 +               /*
28 +                * This is a temporary hack; we have not added a new
29 +                * "extra" inode field in a long time, and the code to
30 +                * expand the inode structure has bitrotted and can
31 +                * cause kernel BUG's.  If the file system does not
32 +                * have the project feature, let's not try to expand
33 +                * the inode's extra size as a temporary pallitive
34 +                * until we can fix up the inode expansion code.
35 +                */
36 +               if (!ext4_has_feature_project(sb))
37 +                       sbi->s_want_extra_isize -= sizeof(__le32);
38                 if (ext4_has_feature_extra_isize(sb)) {
39                         if (sbi->s_want_extra_isize <
40                             le16_to_cpu(es->s_want_extra_isize))