diff options
-rw-r--r-- | fs/file_table.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/file_table.c b/fs/file_table.c index b44e4c559786..322cd37626cb 100644 --- a/fs/file_table.c +++ b/fs/file_table.c | |||
@@ -385,6 +385,10 @@ static inline void __file_sb_list_add(struct file *file, struct super_block *sb) | |||
385 | */ | 385 | */ |
386 | void file_sb_list_add(struct file *file, struct super_block *sb) | 386 | void file_sb_list_add(struct file *file, struct super_block *sb) |
387 | { | 387 | { |
388 | if (likely(!(file->f_mode & FMODE_WRITE))) | ||
389 | return; | ||
390 | if (!S_ISREG(file_inode(file)->i_mode)) | ||
391 | return; | ||
388 | lg_local_lock(&files_lglock); | 392 | lg_local_lock(&files_lglock); |
389 | __file_sb_list_add(file, sb); | 393 | __file_sb_list_add(file, sb); |
390 | lg_local_unlock(&files_lglock); | 394 | lg_local_unlock(&files_lglock); |
@@ -450,8 +454,6 @@ void mark_files_ro(struct super_block *sb) | |||
450 | 454 | ||
451 | lg_global_lock(&files_lglock); | 455 | lg_global_lock(&files_lglock); |
452 | do_file_list_for_each_entry(sb, f) { | 456 | do_file_list_for_each_entry(sb, f) { |
453 | if (!S_ISREG(file_inode(f)->i_mode)) | ||
454 | continue; | ||
455 | if (!file_count(f)) | 457 | if (!file_count(f)) |
456 | continue; | 458 | continue; |
457 | if (!(f->f_mode & FMODE_WRITE)) | 459 | if (!(f->f_mode & FMODE_WRITE)) |