@@ -232,6 +232,7 @@ static int ocfs2_mknod(struct user_namespace *mnt_userns,
232
232
handle_t * handle = NULL ;
233
233
struct ocfs2_super * osb ;
234
234
struct ocfs2_dinode * dirfe ;
235
+ struct ocfs2_dinode * fe = NULL ;
235
236
struct buffer_head * new_fe_bh = NULL ;
236
237
struct inode * inode = NULL ;
237
238
struct ocfs2_alloc_context * inode_ac = NULL ;
@@ -382,6 +383,7 @@ static int ocfs2_mknod(struct user_namespace *mnt_userns,
382
383
goto leave ;
383
384
}
384
385
386
+ fe = (struct ocfs2_dinode * ) new_fe_bh -> b_data ;
385
387
if (S_ISDIR (mode )) {
386
388
status = ocfs2_fill_new_dir (osb , handle , dir , inode ,
387
389
new_fe_bh , data_ac , meta_ac );
@@ -454,8 +456,11 @@ static int ocfs2_mknod(struct user_namespace *mnt_userns,
454
456
leave :
455
457
if (status < 0 && did_quota_inode )
456
458
dquot_free_inode (inode );
457
- if (handle )
459
+ if (handle ) {
460
+ if (status < 0 && fe )
461
+ ocfs2_set_links_count (fe , 0 );
458
462
ocfs2_commit_trans (osb , handle );
463
+ }
459
464
460
465
ocfs2_inode_unlock (dir , 1 );
461
466
if (did_block_signals )
@@ -2019,8 +2024,11 @@ static int ocfs2_symlink(struct user_namespace *mnt_userns,
2019
2024
ocfs2_clusters_to_bytes (osb -> sb , 1 ));
2020
2025
if (status < 0 && did_quota_inode )
2021
2026
dquot_free_inode (inode );
2022
- if (handle )
2027
+ if (handle ) {
2028
+ if (status < 0 && fe )
2029
+ ocfs2_set_links_count (fe , 0 );
2023
2030
ocfs2_commit_trans (osb , handle );
2031
+ }
2024
2032
2025
2033
ocfs2_inode_unlock (dir , 1 );
2026
2034
if (did_block_signals )
0 commit comments