@@ -68,13 +68,14 @@ static int inherit_flags(const struct inode *dir, umode_t mode)
68
68
* @c: UBIFS file-system description object
69
69
* @dir: parent directory inode
70
70
* @mode: inode mode flags
71
+ * @is_xattr: whether the inode is xattr inode
71
72
*
72
73
* This function finds an unused inode number, allocates new inode and
73
74
* initializes it. Returns new inode in case of success and an error code in
74
75
* case of failure.
75
76
*/
76
77
struct inode * ubifs_new_inode (struct ubifs_info * c , struct inode * dir ,
77
- umode_t mode )
78
+ umode_t mode , bool is_xattr )
78
79
{
79
80
int err ;
80
81
struct inode * inode ;
@@ -99,10 +100,12 @@ struct inode *ubifs_new_inode(struct ubifs_info *c, struct inode *dir,
99
100
current_time (inode );
100
101
inode -> i_mapping -> nrpages = 0 ;
101
102
102
- err = fscrypt_prepare_new_inode (dir , inode , & encrypted );
103
- if (err ) {
104
- ubifs_err (c , "fscrypt_prepare_new_inode failed: %i" , err );
105
- goto out_iput ;
103
+ if (!is_xattr ) {
104
+ err = fscrypt_prepare_new_inode (dir , inode , & encrypted );
105
+ if (err ) {
106
+ ubifs_err (c , "fscrypt_prepare_new_inode failed: %i" , err );
107
+ goto out_iput ;
108
+ }
106
109
}
107
110
108
111
switch (mode & S_IFMT ) {
@@ -309,7 +312,7 @@ static int ubifs_create(struct user_namespace *mnt_userns, struct inode *dir,
309
312
310
313
sz_change = CALC_DENT_SIZE (fname_len (& nm ));
311
314
312
- inode = ubifs_new_inode (c , dir , mode );
315
+ inode = ubifs_new_inode (c , dir , mode , false );
313
316
if (IS_ERR (inode )) {
314
317
err = PTR_ERR (inode );
315
318
goto out_fname ;
@@ -370,7 +373,7 @@ static struct inode *create_whiteout(struct inode *dir, struct dentry *dentry)
370
373
if (err )
371
374
return ERR_PTR (err );
372
375
373
- inode = ubifs_new_inode (c , dir , mode );
376
+ inode = ubifs_new_inode (c , dir , mode , false );
374
377
if (IS_ERR (inode )) {
375
378
err = PTR_ERR (inode );
376
379
goto out_free ;
@@ -462,7 +465,7 @@ static int ubifs_tmpfile(struct user_namespace *mnt_userns, struct inode *dir,
462
465
return err ;
463
466
}
464
467
465
- inode = ubifs_new_inode (c , dir , mode );
468
+ inode = ubifs_new_inode (c , dir , mode , false );
466
469
if (IS_ERR (inode )) {
467
470
err = PTR_ERR (inode );
468
471
goto out_budg ;
@@ -1004,7 +1007,7 @@ static int ubifs_mkdir(struct user_namespace *mnt_userns, struct inode *dir,
1004
1007
1005
1008
sz_change = CALC_DENT_SIZE (fname_len (& nm ));
1006
1009
1007
- inode = ubifs_new_inode (c , dir , S_IFDIR | mode );
1010
+ inode = ubifs_new_inode (c , dir , S_IFDIR | mode , false );
1008
1011
if (IS_ERR (inode )) {
1009
1012
err = PTR_ERR (inode );
1010
1013
goto out_fname ;
@@ -1091,7 +1094,7 @@ static int ubifs_mknod(struct user_namespace *mnt_userns, struct inode *dir,
1091
1094
1092
1095
sz_change = CALC_DENT_SIZE (fname_len (& nm ));
1093
1096
1094
- inode = ubifs_new_inode (c , dir , mode );
1097
+ inode = ubifs_new_inode (c , dir , mode , false );
1095
1098
if (IS_ERR (inode )) {
1096
1099
kfree (dev );
1097
1100
err = PTR_ERR (inode );
@@ -1173,7 +1176,7 @@ static int ubifs_symlink(struct user_namespace *mnt_userns, struct inode *dir,
1173
1176
1174
1177
sz_change = CALC_DENT_SIZE (fname_len (& nm ));
1175
1178
1176
- inode = ubifs_new_inode (c , dir , S_IFLNK | S_IRWXUGO );
1179
+ inode = ubifs_new_inode (c , dir , S_IFLNK | S_IRWXUGO , false );
1177
1180
if (IS_ERR (inode )) {
1178
1181
err = PTR_ERR (inode );
1179
1182
goto out_fname ;
0 commit comments