File tree 2 files changed +16
-8
lines changed
2 files changed +16
-8
lines changed Original file line number Diff line number Diff line change @@ -840,16 +840,12 @@ EXPORT_SYMBOL(file_path);
840840int vfs_open (const struct path * path , struct file * file ,
841841 const struct cred * cred )
842842{
843- struct dentry * dentry = path -> dentry ;
844- struct inode * inode = dentry -> d_inode ;
843+ struct inode * inode = vfs_select_inode (path -> dentry , file -> f_flags );
845844
846- file -> f_path = * path ;
847- if (dentry -> d_flags & DCACHE_OP_SELECT_INODE ) {
848- inode = dentry -> d_op -> d_select_inode (dentry , file -> f_flags );
849- if (IS_ERR (inode ))
850- return PTR_ERR (inode );
851- }
845+ if (IS_ERR (inode ))
846+ return PTR_ERR (inode );
852847
848+ file -> f_path = * path ;
853849 return do_dentry_open (file , inode , NULL , cred );
854850}
855851
Original file line number Diff line number Diff line change @@ -565,4 +565,16 @@ static inline struct dentry *d_real(struct dentry *dentry)
565565 return dentry ;
566566}
567567
568+ static inline struct inode * vfs_select_inode (struct dentry * dentry ,
569+ unsigned open_flags )
570+ {
571+ struct inode * inode = d_inode (dentry );
572+
573+ if (inode && unlikely (dentry -> d_flags & DCACHE_OP_SELECT_INODE ))
574+ inode = dentry -> d_op -> d_select_inode (dentry , open_flags );
575+
576+ return inode ;
577+ }
578+
579+
568580#endif /* __LINUX_DCACHE_H */
You can’t perform that action at this time.
0 commit comments