diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-22 17:20:48 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-22 17:20:48 -0500 |
commit | fe35d4a0289a8d6efcacb57e9a377b845686df10 (patch) | |
tree | 05ff26e6658d3ddc6e4885059bbf018b1681bb3b /fs/open.c | |
parent | 9917f7bbe96432012d3ad8075e9fd99390255d0c (diff) | |
parent | 28ba0ec64ca0f6ad2b0338ccec0b00a4e64e7a69 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6:
jfs: Fix 32bit build warning
Remove obsolete comment in fs.h
Sanitize f_flags helpers
Fix f_flags/f_mode in case of lookup_instantiate_filp() from open(pathname, 3)
anonfd: Allow making anon files read-only
fs/compat_ioctl.c: fix build error when !BLOCK
pohmelfs needs I_LOCK
alloc_file(): simplify handling of mnt_clone_write() errors
Diffstat (limited to 'fs/open.c')
-rw-r--r-- | fs/open.c | 13 |
1 files changed, 6 insertions, 7 deletions
@@ -821,15 +821,14 @@ static inline int __get_file_write_access(struct inode *inode, | |||
821 | } | 821 | } |
822 | 822 | ||
823 | static struct file *__dentry_open(struct dentry *dentry, struct vfsmount *mnt, | 823 | static struct file *__dentry_open(struct dentry *dentry, struct vfsmount *mnt, |
824 | int flags, struct file *f, | 824 | struct file *f, |
825 | int (*open)(struct inode *, struct file *), | 825 | int (*open)(struct inode *, struct file *), |
826 | const struct cred *cred) | 826 | const struct cred *cred) |
827 | { | 827 | { |
828 | struct inode *inode; | 828 | struct inode *inode; |
829 | int error; | 829 | int error; |
830 | 830 | ||
831 | f->f_flags = flags; | 831 | f->f_mode = OPEN_FMODE(f->f_flags) | FMODE_LSEEK | |
832 | f->f_mode = (__force fmode_t)((flags+1) & O_ACCMODE) | FMODE_LSEEK | | ||
833 | FMODE_PREAD | FMODE_PWRITE; | 832 | FMODE_PREAD | FMODE_PWRITE; |
834 | inode = dentry->d_inode; | 833 | inode = dentry->d_inode; |
835 | if (f->f_mode & FMODE_WRITE) { | 834 | if (f->f_mode & FMODE_WRITE) { |
@@ -930,7 +929,6 @@ struct file *lookup_instantiate_filp(struct nameidata *nd, struct dentry *dentry | |||
930 | if (IS_ERR(dentry)) | 929 | if (IS_ERR(dentry)) |
931 | goto out_err; | 930 | goto out_err; |
932 | nd->intent.open.file = __dentry_open(dget(dentry), mntget(nd->path.mnt), | 931 | nd->intent.open.file = __dentry_open(dget(dentry), mntget(nd->path.mnt), |
933 | nd->intent.open.flags - 1, | ||
934 | nd->intent.open.file, | 932 | nd->intent.open.file, |
935 | open, cred); | 933 | open, cred); |
936 | out: | 934 | out: |
@@ -949,7 +947,7 @@ EXPORT_SYMBOL_GPL(lookup_instantiate_filp); | |||
949 | * | 947 | * |
950 | * Note that this function destroys the original nameidata | 948 | * Note that this function destroys the original nameidata |
951 | */ | 949 | */ |
952 | struct file *nameidata_to_filp(struct nameidata *nd, int flags) | 950 | struct file *nameidata_to_filp(struct nameidata *nd) |
953 | { | 951 | { |
954 | const struct cred *cred = current_cred(); | 952 | const struct cred *cred = current_cred(); |
955 | struct file *filp; | 953 | struct file *filp; |
@@ -958,7 +956,7 @@ struct file *nameidata_to_filp(struct nameidata *nd, int flags) | |||
958 | filp = nd->intent.open.file; | 956 | filp = nd->intent.open.file; |
959 | /* Has the filesystem initialised the file for us? */ | 957 | /* Has the filesystem initialised the file for us? */ |
960 | if (filp->f_path.dentry == NULL) | 958 | if (filp->f_path.dentry == NULL) |
961 | filp = __dentry_open(nd->path.dentry, nd->path.mnt, flags, filp, | 959 | filp = __dentry_open(nd->path.dentry, nd->path.mnt, filp, |
962 | NULL, cred); | 960 | NULL, cred); |
963 | else | 961 | else |
964 | path_put(&nd->path); | 962 | path_put(&nd->path); |
@@ -997,7 +995,8 @@ struct file *dentry_open(struct dentry *dentry, struct vfsmount *mnt, int flags, | |||
997 | return ERR_PTR(error); | 995 | return ERR_PTR(error); |
998 | } | 996 | } |
999 | 997 | ||
1000 | return __dentry_open(dentry, mnt, flags, f, NULL, cred); | 998 | f->f_flags = flags; |
999 | return __dentry_open(dentry, mnt, f, NULL, cred); | ||
1001 | } | 1000 | } |
1002 | EXPORT_SYMBOL(dentry_open); | 1001 | EXPORT_SYMBOL(dentry_open); |
1003 | 1002 | ||