Whamcloud - gitweb
LU-18101 sec: fix ACL handling on recent kernels again
[fs/lustre-release.git] / ldiskfs / kernel_patches / patches / linux-5.16 / ext4-misc.patch
1 From e396a9a0d0c4ec3b84eeba4933c7624b14dee898 Mon Sep 17 00:00:00 2001
2 From: Shaun Tancheff <shaun.tancheff@hpe.com>
3 Date: Thu, 25 Apr 2024 22:34:59 +0700
4 Subject: [PATCH] linux-5.16/ext4-misc.patch
5
6 ---
7  fs/ext4/ext4.h   | 23 ++++++++++++++++++++++-
8  fs/ext4/ialloc.c |  3 ++-
9  fs/ext4/inode.c  | 17 +++++++++++++++++
10  fs/ext4/namei.c  |  9 ++++++---
11  fs/ext4/super.c  | 10 ++--------
12  fs/ext4/xattr.c  |  2 ++
13  6 files changed, 51 insertions(+), 13 deletions(-)
14
15 diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
16 index d200eb93..0b3522cf 100644
17 --- a/fs/ext4/ext4.h
18 +++ b/fs/ext4/ext4.h
19 @@ -2212,7 +2212,21 @@ static inline bool ext4_has_unknown_ext##ver##_incompat_features(struct super_bl
20  
21  EXTN_FEATURE_FUNCS(2)
22  EXTN_FEATURE_FUNCS(3)
23 -EXTN_FEATURE_FUNCS(4)
24 +static inline bool ext4_has_unknown_ext4_compat_features(struct super_block *sb)
25 +{
26 +       return ((EXT4_SB(sb)->s_es->s_feature_compat &
27 +               cpu_to_le32(~EXT4_FEATURE_COMPAT_SUPP)) != 0);
28 +}
29 +static inline bool ext4_has_unknown_ext4_ro_compat_features(struct super_block *sb)
30 +{
31 +       return ((EXT4_SB(sb)->s_es->s_feature_ro_compat &
32 +               cpu_to_le32(~EXT4_FEATURE_RO_COMPAT_SUPP)) != 0);
33 +}
34 +static inline bool ext4_has_unknown_ext4_incompat_features(struct super_block *sb)
35 +{
36 +       return ((EXT4_SB(sb)->s_es->s_feature_incompat &
37 +               cpu_to_le32(~EXT4_FEATURE_INCOMPAT_SUPP)) != 0);
38 +}
39  
40  static inline bool ext4_has_compat_features(struct super_block *sb)
41  {
42 @@ -3692,6 +3706,13 @@ struct ext4_extent;
43  #define EXT_MAX_BLOCKS 0xffffffff
44  
45  extern void ext4_ext_tree_init(handle_t *handle, struct inode *inode);
46 +extern struct buffer_head *ext4_read_inode_bitmap(struct super_block *sb,
47 +                                                 ext4_group_t block_group);
48 +extern void ext4_inc_count(struct inode *inode);
49 +extern void ext4_dec_count(struct inode *inode);
50 +extern struct buffer_head *ext4_append(handle_t *handle,
51 +                                      struct inode *inode,
52 +                                      ext4_lblk_t *block);
53  extern int ext4_ext_index_trans_blocks(struct inode *inode, int extents);
54  extern int ext4_ext_map_blocks(handle_t *handle, struct inode *inode,
55                                struct ext4_map_blocks *map, int flags);
56 diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
57 index f75aa85b..a1ba2767 100644
58 --- a/fs/ext4/ialloc.c
59 +++ b/fs/ext4/ialloc.c
60 @@ -120,7 +120,7 @@ verified:
61   *
62   * Return buffer_head of bitmap on success, or an ERR_PTR on error.
63   */
64 -static struct buffer_head *
65 +struct buffer_head *
66  ext4_read_inode_bitmap(struct super_block *sb, ext4_group_t block_group)
67  {
68         struct ext4_group_desc *desc;
69 @@ -215,6 +215,7 @@ out:
70         put_bh(bh);
71         return ERR_PTR(err);
72  }
73 +EXPORT_SYMBOL(ext4_read_inode_bitmap);
74  
75  /*
76   * NOTE! When we get the inode, we're the only people
77 diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
78 index 98f0dc0e..a59c0c8a 100644
79 --- a/fs/ext4/inode.c
80 +++ b/fs/ext4/inode.c
81 @@ -6313,3 +6313,20 @@ out_error:
82         ext4_journal_stop(handle);
83         goto out;
84  }
85 +EXPORT_SYMBOL(ext4_map_blocks);
86 +EXPORT_SYMBOL(ext4_truncate);
87 +EXPORT_SYMBOL(ext4_iget);
88 +EXPORT_SYMBOL(ext4_bread);
89 +EXPORT_SYMBOL(ext4_itable_unused_count);
90 +EXPORT_SYMBOL(ext4_force_commit);
91 +EXPORT_SYMBOL(__ext4_mark_inode_dirty);
92 +EXPORT_SYMBOL(ext4_get_group_desc);
93 +EXPORT_SYMBOL(__ext4_journal_get_write_access);
94 +EXPORT_SYMBOL(__ext4_journal_start_sb);
95 +EXPORT_SYMBOL(__ext4_journal_stop);
96 +EXPORT_SYMBOL(__ext4_handle_dirty_metadata);
97 +EXPORT_SYMBOL(__ext4_std_error);
98 +EXPORT_SYMBOL(ext4fs_dirhash);
99 +EXPORT_SYMBOL(ext4_get_inode_loc);
100 +EXPORT_SYMBOL(__ext4_journal_ensure_credits);
101 +EXPORT_SYMBOL(ext4_chunk_trans_blocks);
102 diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
103 index 994851ed..3c6931e3 100644
104 --- a/fs/ext4/namei.c
105 +++ b/fs/ext4/namei.c
106 @@ -50,7 +50,7 @@
107  #define NAMEI_RA_BLOCKS  4
108  #define NAMEI_RA_SIZE       (NAMEI_RA_CHUNKS * NAMEI_RA_BLOCKS)
109  
110 -static struct buffer_head *ext4_append(handle_t *handle,
111 +struct buffer_head *ext4_append(handle_t *handle,
112                                         struct inode *inode,
113                                         ext4_lblk_t *block)
114  {
115 @@ -210,6 +210,7 @@ static struct buffer_head *__ext4_read_dirblock(struct inode *inode,
116         }
117         return bh;
118  }
119 +EXPORT_SYMBOL(ext4_append);
120  
121  #ifdef DX_DEBUG
122  #define dxtrace(command) command
123 @@ -2786,23 +2787,25 @@ EXPORT_SYMBOL(ext4_delete_entry);
124   * for checking S_ISDIR(inode) (since the INODE_INDEX feature will not be set
125   * on regular files) and to avoid creating huge/slow non-HTREE directories.
126   */
127 -static void ext4_inc_count(struct inode *inode)
128 +void ext4_inc_count(struct inode *inode)
129  {
130         inc_nlink(inode);
131         if (is_dx(inode) &&
132             (inode->i_nlink > EXT4_LINK_MAX || inode->i_nlink == 2))
133                 set_nlink(inode, 1);
134  }
135 +EXPORT_SYMBOL(ext4_inc_count);
136  
137  /*
138   * If a directory had nlink == 1, then we should let it be 1. This indicates
139   * directory has >EXT4_LINK_MAX subdirs.
140   */
141 -static void ext4_dec_count(struct inode *inode)
142 +void ext4_dec_count(struct inode *inode)
143  {
144         if (!S_ISDIR(inode->i_mode) || inode->i_nlink > 2)
145                 drop_nlink(inode);
146  }
147 +EXPORT_SYMBOL(ext4_dec_count);
148  
149  
150  /*
151 diff --git a/fs/ext4/super.c b/fs/ext4/super.c
152 index 760249d9..55d614b8 100644
153 --- a/fs/ext4/super.c
154 +++ b/fs/ext4/super.c
155 @@ -6024,7 +6024,7 @@ static void ext4_update_super(struct super_block *sb)
156                         __ext4_update_tstamp(&es->s_first_error_time,
157                                              &es->s_first_error_time_hi,
158                                              sbi->s_first_error_time);
159 -                       strncpy(es->s_first_error_func, sbi->s_first_error_func,
160 +                       strscpy(es->s_first_error_func, sbi->s_first_error_func,
161                                 sizeof(es->s_first_error_func));
162                         es->s_first_error_line =
163                                 cpu_to_le32(sbi->s_first_error_line);
164 @@ -6038,7 +6038,7 @@ static void ext4_update_super(struct super_block *sb)
165                 __ext4_update_tstamp(&es->s_last_error_time,
166                                      &es->s_last_error_time_hi,
167                                      sbi->s_last_error_time);
168 -               strncpy(es->s_last_error_func, sbi->s_last_error_func,
169 +               strscpy(es->s_last_error_func, sbi->s_last_error_func,
170                         sizeof(es->s_last_error_func));
171                 es->s_last_error_line = cpu_to_le32(sbi->s_last_error_line);
172                 es->s_last_error_ino = cpu_to_le32(sbi->s_last_error_ino);
173 @@ -7279,16 +7279,12 @@ static int __init ext4_init_fs(void)
174         if (err)
175                 goto out05;
176  
177 -       register_as_ext3();
178 -       register_as_ext2();
179         err = register_filesystem(&ext4_fs_type);
180         if (err)
181                 goto out;
182  
183         return 0;
184  out:
185 -       unregister_as_ext2();
186 -       unregister_as_ext3();
187         ext4_fc_destroy_dentry_cache();
188  out05:
189         destroy_inodecache();
190 @@ -7313,8 +7309,6 @@ out7:
191  static void __exit ext4_exit_fs(void)
192  {
193         ext4_destroy_lazyinit_thread();
194 -       unregister_as_ext2();
195 -       unregister_as_ext3();
196         unregister_filesystem(&ext4_fs_type);
197         ext4_fc_destroy_dentry_cache();
198         destroy_inodecache();
199 diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
200 index 51d642a9..33657020 100644
201 --- a/fs/ext4/xattr.c
202 +++ b/fs/ext4/xattr.c
203 @@ -666,6 +666,7 @@ ext4_xattr_get(struct inode *inode, int name_index, const char *name,
204         up_read(&EXT4_I(inode)->xattr_sem);
205         return error;
206  }
207 +EXPORT_SYMBOL(ext4_xattr_get);
208  
209  static int
210  ext4_xattr_list_entries(struct dentry *dentry, struct ext4_xattr_entry *entry,
211 @@ -2430,6 +2431,7 @@ cleanup:
212         ext4_write_unlock_xattr(inode, &no_expand);
213         return error;
214  }
215 +EXPORT_SYMBOL(ext4_xattr_set_handle);
216  
217  int ext4_xattr_set_credits(struct inode *inode, size_t value_len,
218                            bool is_create, int *credits)
219 -- 
220 2.34.1
221