diff options
Diffstat (limited to 'fs/file_table.c')
-rw-r--r-- | fs/file_table.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/fs/file_table.c b/fs/file_table.c index b44e4c559786..abdd15ad13c9 100644 --- a/fs/file_table.c +++ b/fs/file_table.c | |||
@@ -311,8 +311,7 @@ void fput(struct file *file) | |||
311 | return; | 311 | return; |
312 | /* | 312 | /* |
313 | * After this task has run exit_task_work(), | 313 | * After this task has run exit_task_work(), |
314 | * task_work_add() will fail. free_ipc_ns()-> | 314 | * task_work_add() will fail. Fall through to delayed |
315 | * shm_destroy() can do this. Fall through to delayed | ||
316 | * fput to avoid leaking *file. | 315 | * fput to avoid leaking *file. |
317 | */ | 316 | */ |
318 | } | 317 | } |
@@ -385,6 +384,10 @@ static inline void __file_sb_list_add(struct file *file, struct super_block *sb) | |||
385 | */ | 384 | */ |
386 | void file_sb_list_add(struct file *file, struct super_block *sb) | 385 | void file_sb_list_add(struct file *file, struct super_block *sb) |
387 | { | 386 | { |
387 | if (likely(!(file->f_mode & FMODE_WRITE))) | ||
388 | return; | ||
389 | if (!S_ISREG(file_inode(file)->i_mode)) | ||
390 | return; | ||
388 | lg_local_lock(&files_lglock); | 391 | lg_local_lock(&files_lglock); |
389 | __file_sb_list_add(file, sb); | 392 | __file_sb_list_add(file, sb); |
390 | lg_local_unlock(&files_lglock); | 393 | lg_local_unlock(&files_lglock); |
@@ -450,8 +453,6 @@ void mark_files_ro(struct super_block *sb) | |||
450 | 453 | ||
451 | lg_global_lock(&files_lglock); | 454 | lg_global_lock(&files_lglock); |
452 | do_file_list_for_each_entry(sb, f) { | 455 | do_file_list_for_each_entry(sb, f) { |
453 | if (!S_ISREG(file_inode(f)->i_mode)) | ||
454 | continue; | ||
455 | if (!file_count(f)) | 456 | if (!file_count(f)) |
456 | continue; | 457 | continue; |
457 | if (!(f->f_mode & FMODE_WRITE)) | 458 | if (!(f->f_mode & FMODE_WRITE)) |