diff options
Diffstat (limited to 'fs/open.c')
| -rw-r--r-- | fs/open.c | 20 |
1 files changed, 18 insertions, 2 deletions
| @@ -828,9 +828,25 @@ struct file *nameidata_to_filp(struct nameidata *nd) | |||
| 828 | 828 | ||
| 829 | /* Has the filesystem initialised the file for us? */ | 829 | /* Has the filesystem initialised the file for us? */ |
| 830 | if (filp->f_path.dentry == NULL) { | 830 | if (filp->f_path.dentry == NULL) { |
| 831 | struct file *res; | ||
| 832 | |||
| 831 | path_get(&nd->path); | 833 | path_get(&nd->path); |
| 832 | filp = __dentry_open(nd->path.dentry, nd->path.mnt, filp, | 834 | res = do_dentry_open(nd->path.dentry, nd->path.mnt, |
| 833 | NULL, cred); | 835 | filp, NULL, cred); |
| 836 | if (!IS_ERR(res)) { | ||
| 837 | int error; | ||
| 838 | |||
| 839 | BUG_ON(res != filp); | ||
| 840 | |||
| 841 | error = open_check_o_direct(filp); | ||
| 842 | if (error) { | ||
| 843 | fput(filp); | ||
| 844 | filp = ERR_PTR(error); | ||
| 845 | } | ||
| 846 | } else { | ||
| 847 | put_filp(filp); | ||
| 848 | filp = res; | ||
| 849 | } | ||
| 834 | } | 850 | } |
| 835 | return filp; | 851 | return filp; |
| 836 | } | 852 | } |
