diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2014-03-14 09:43:29 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2014-04-01 23:19:13 -0400 |
commit | 3f4d5a00076b7e340625a2014cb83e10bf0d6dd1 (patch) | |
tree | 91e9d51a093c17a74b66bd0ad9034180e67a17a5 /fs/open.c | |
parent | 83f936c75e3689a63253d89c47a4d239c56d7410 (diff) |
tidy do_dentry_open() up a bit
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/open.c')
-rw-r--r-- | fs/open.c | 22 |
1 files changed, 10 insertions, 12 deletions
@@ -656,30 +656,28 @@ static int do_dentry_open(struct file *f, | |||
656 | f->f_mode = OPEN_FMODE(f->f_flags) | FMODE_LSEEK | | 656 | f->f_mode = OPEN_FMODE(f->f_flags) | FMODE_LSEEK | |
657 | FMODE_PREAD | FMODE_PWRITE; | 657 | FMODE_PREAD | FMODE_PWRITE; |
658 | 658 | ||
659 | if (unlikely(f->f_flags & O_PATH)) | ||
660 | f->f_mode = FMODE_PATH; | ||
661 | |||
662 | path_get(&f->f_path); | 659 | path_get(&f->f_path); |
663 | inode = f->f_inode = f->f_path.dentry->d_inode; | 660 | inode = f->f_inode = f->f_path.dentry->d_inode; |
661 | f->f_mapping = inode->i_mapping; | ||
662 | |||
663 | if (unlikely(f->f_flags & O_PATH)) { | ||
664 | f->f_mode = FMODE_PATH; | ||
665 | f->f_op = &empty_fops; | ||
666 | return 0; | ||
667 | } | ||
668 | |||
664 | if (f->f_mode & FMODE_WRITE && !special_file(inode->i_mode)) { | 669 | if (f->f_mode & FMODE_WRITE && !special_file(inode->i_mode)) { |
665 | error = get_write_access(inode); | 670 | error = get_write_access(inode); |
666 | if (error) | 671 | if (unlikely(error)) |
667 | goto cleanup_file; | 672 | goto cleanup_file; |
668 | error = __mnt_want_write(f->f_path.mnt); | 673 | error = __mnt_want_write(f->f_path.mnt); |
669 | if (error) { | 674 | if (unlikely(error)) { |
670 | put_write_access(inode); | 675 | put_write_access(inode); |
671 | goto cleanup_file; | 676 | goto cleanup_file; |
672 | } | 677 | } |
673 | f->f_mode |= FMODE_WRITER; | 678 | f->f_mode |= FMODE_WRITER; |
674 | } | 679 | } |
675 | 680 | ||
676 | f->f_mapping = inode->i_mapping; | ||
677 | |||
678 | if (unlikely(f->f_mode & FMODE_PATH)) { | ||
679 | f->f_op = &empty_fops; | ||
680 | return 0; | ||
681 | } | ||
682 | |||
683 | /* POSIX.1-2008/SUSv4 Section XSI 2.9.7 */ | 681 | /* POSIX.1-2008/SUSv4 Section XSI 2.9.7 */ |
684 | if (S_ISREG(inode->i_mode)) | 682 | if (S_ISREG(inode->i_mode)) |
685 | f->f_mode |= FMODE_ATOMIC_POS; | 683 | f->f_mode |= FMODE_ATOMIC_POS; |