@@ -4073,8 +4073,7 @@ static int do_mknodat(int dfd, struct filename *name, umode_t mode,
40734073 goto retry ;
40744074 }
40754075out1 :
4076- #ifdef CONFIG_DEEPIN_ERR_NOTIFY
4077- if (unlikely ((error == - EROFS ) && deepin_err_notify_enabled ())) {
4076+ if (deepin_should_notify_ro_fs_err (error )) {
40784077 struct path file_path ;
40794078 int get_path_err ;
40804079
@@ -4085,7 +4084,6 @@ static int do_mknodat(int dfd, struct filename *name, umode_t mode,
40854084 path_put (& file_path );
40864085 }
40874086 }
4088- #endif /* CONFIG_DEEPIN_ERR_NOTIFY */
40894087 putname (name );
40904088 return error ;
40914089}
@@ -4169,8 +4167,7 @@ int do_mkdirat(int dfd, struct filename *name, umode_t mode)
41694167 goto retry ;
41704168 }
41714169out_putname :
4172- #ifdef CONFIG_DEEPIN_ERR_NOTIFY
4173- if (unlikely ((error == - EROFS ) && deepin_err_notify_enabled ())) {
4170+ if (deepin_should_notify_ro_fs_err (error )) {
41744171 struct path file_path ;
41754172 int get_path_err ;
41764173
@@ -4181,7 +4178,6 @@ int do_mkdirat(int dfd, struct filename *name, umode_t mode)
41814178 path_put (& file_path );
41824179 }
41834180 }
4184- #endif /* CONFIG_DEEPIN_ERR_NOTIFY */
41854181 putname (name );
41864182 return error ;
41874183}
@@ -4299,8 +4295,7 @@ int do_rmdir(int dfd, struct filename *name)
42994295 inode_unlock (path .dentry -> d_inode );
43004296 mnt_drop_write (path .mnt );
43014297exit2 :
4302- #ifdef CONFIG_DEEPIN_ERR_NOTIFY
4303- if (unlikely ((error == - EROFS ) && deepin_err_notify_enabled ())) {
4298+ if (deepin_should_notify_ro_fs_err (error )) {
43044299 dentry = lookup_one_qstr_excl (& last , path .dentry , 0 );
43054300 if (!IS_ERR (dentry )) {
43064301 if (d_is_positive (dentry )) {
@@ -4313,7 +4308,6 @@ int do_rmdir(int dfd, struct filename *name)
43134308 dput (dentry );
43144309 }
43154310 }
4316- #endif /* CONFIG_DEEPIN_ERR_NOTIFY */
43174311 path_put (& path );
43184312 if (retry_estale (error , lookup_flags )) {
43194313 lookup_flags |= LOOKUP_REVAL ;
@@ -4459,8 +4453,7 @@ int do_unlinkat(int dfd, struct filename *name)
44594453 }
44604454 mnt_drop_write (path .mnt );
44614455exit2 :
4462- #ifdef CONFIG_DEEPIN_ERR_NOTIFY
4463- if (unlikely ((error == - EROFS ) && deepin_err_notify_enabled ())) {
4456+ if (deepin_should_notify_ro_fs_err (error )) {
44644457 dentry = lookup_one_qstr_excl (& last , path .dentry , 0 );
44654458 if (!IS_ERR (dentry )) {
44664459 if (d_is_positive (dentry )) {
@@ -4473,7 +4466,6 @@ int do_unlinkat(int dfd, struct filename *name)
44734466 dput (dentry );
44744467 }
44754468 }
4476- #endif /* CONFIG_DEEPIN_ERR_NOTIFY */
44774469 path_put (& path );
44784470 if (retry_estale (error , lookup_flags )) {
44794471 lookup_flags |= LOOKUP_REVAL ;
@@ -4574,8 +4566,7 @@ int do_symlinkat(struct filename *from, int newdfd, struct filename *to)
45744566 goto retry ;
45754567 }
45764568out_putnames :
4577- #ifdef CONFIG_DEEPIN_ERR_NOTIFY
4578- if (unlikely ((error == - EROFS ) && deepin_err_notify_enabled ())) {
4569+ if (deepin_should_notify_ro_fs_err (error )) {
45794570 struct path file_path ;
45804571 int get_path_err ;
45814572
@@ -4587,7 +4578,6 @@ int do_symlinkat(struct filename *from, int newdfd, struct filename *to)
45874578 path_put (& file_path );
45884579 }
45894580 }
4590- #endif /* CONFIG_DEEPIN_ERR_NOTIFY */
45914581 putname (to );
45924582 putname (from );
45934583 return error ;
@@ -4766,8 +4756,7 @@ int do_linkat(int olddfd, struct filename *old, int newdfd,
47664756 goto retry ;
47674757 }
47684758out_putpath :
4769- #ifdef CONFIG_DEEPIN_ERR_NOTIFY
4770- if (unlikely ((error == - EROFS ) && deepin_err_notify_enabled ())) {
4759+ if (deepin_should_notify_ro_fs_err (error )) {
47714760 struct path file_path ;
47724761 int get_path_err ;
47734762
@@ -4778,7 +4767,6 @@ int do_linkat(int olddfd, struct filename *old, int newdfd,
47784767 path_put (& file_path );
47794768 }
47804769 }
4781- #endif /* CONFIG_DEEPIN_ERR_NOTIFY */
47824770 path_put (& old_path );
47834771out_putnames :
47844772 putname (old );
@@ -5133,22 +5121,8 @@ int do_renameat2(int olddfd, struct filename *from, int newdfd,
51335121 }
51345122 mnt_drop_write (old_path .mnt );
51355123exit2 :
5136- #ifdef CONFIG_DEEPIN_ERR_NOTIFY
5137- if (unlikely ((error == - EROFS ) && deepin_err_notify_enabled ())) {
5138- old_dentry =
5139- lookup_one_qstr_excl (& old_last , old_path .dentry , 0 );
5140- if (!IS_ERR (old_dentry )) {
5141- if (d_is_positive (old_dentry )) {
5142- struct path file_path = { .mnt = old_path .mnt ,
5143- .dentry =
5144- old_dentry };
5145- deepin_check_and_notify_ro_fs_err (& file_path ,
5146- "rename" );
5147- }
5148- dput (old_dentry );
5149- }
5150- }
5151- #endif /* CONFIG_DEEPIN_ERR_NOTIFY */
5124+ if (deepin_should_notify_ro_fs_err (error ))
5125+ deepin_notify_rename_ro_fs_err (& old_last , & new_last , & old_path , & new_path );
51525126 if (retry_estale (error , lookup_flags ))
51535127 should_retry = true;
51545128 path_put (& new_path );
0 commit comments