diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2013-08-30 21:46:46 +0200 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2013-09-04 04:50:28 +0200 |
commit | 184cacabe274a0af65b3876e9cd95c9fdde069ea (patch) | |
tree | d575f2cabd8a1d422d09e26967a04790979f7fee /fs/file_table.c | |
parent | nfsd: racy access to ->d_name in nsfd4_encode_path() (diff) | |
download | linux-184cacabe274a0af65b3876e9cd95c9fdde069ea.tar.xz linux-184cacabe274a0af65b3876e9cd95c9fdde069ea.zip |
only regular files with FMODE_WRITE need to be on s_files
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/file_table.c')
-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) */ void file_sb_list_add(struct file *file, struct super_block *sb) { + if (likely(!(file->f_mode & FMODE_WRITE))) + return; + if (!S_ISREG(file_inode(file)->i_mode)) + return; lg_local_lock(&files_lglock); __file_sb_list_add(file, sb); lg_local_unlock(&files_lglock); @@ -450,8 +454,6 @@ void mark_files_ro(struct super_block *sb) lg_global_lock(&files_lglock); do_file_list_for_each_entry(sb, f) { - if (!S_ISREG(file_inode(f)->i_mode)) - continue; if (!file_count(f)) continue; if (!(f->f_mode & FMODE_WRITE)) |