diff options
Diffstat (limited to 'fs')
| -rw-r--r-- | fs/anon_inodes.c | 4 | ||||
| -rw-r--r-- | fs/compat_ioctl.c | 2 | ||||
| -rw-r--r-- | fs/eventfd.c | 2 | ||||
| -rw-r--r-- | fs/eventpoll.c | 2 | ||||
| -rw-r--r-- | fs/file_table.c | 4 | ||||
| -rw-r--r-- | fs/internal.h | 7 | ||||
| -rw-r--r-- | fs/jfs/super.c | 2 | ||||
| -rw-r--r-- | fs/namei.c | 8 | ||||
| -rw-r--r-- | fs/open.c | 13 | ||||
| -rw-r--r-- | fs/signalfd.c | 2 | ||||
| -rw-r--r-- | fs/timerfd.c | 2 |
11 files changed, 25 insertions, 23 deletions
diff --git a/fs/anon_inodes.c b/fs/anon_inodes.c index 2c994591f4d7..9f0bf13291e5 100644 --- a/fs/anon_inodes.c +++ b/fs/anon_inodes.c | |||
| @@ -121,13 +121,13 @@ struct file *anon_inode_getfile(const char *name, | |||
| 121 | d_instantiate(path.dentry, anon_inode_inode); | 121 | d_instantiate(path.dentry, anon_inode_inode); |
| 122 | 122 | ||
| 123 | error = -ENFILE; | 123 | error = -ENFILE; |
| 124 | file = alloc_file(&path, FMODE_READ | FMODE_WRITE, fops); | 124 | file = alloc_file(&path, OPEN_FMODE(flags), fops); |
| 125 | if (!file) | 125 | if (!file) |
| 126 | goto err_dput; | 126 | goto err_dput; |
| 127 | file->f_mapping = anon_inode_inode->i_mapping; | 127 | file->f_mapping = anon_inode_inode->i_mapping; |
| 128 | 128 | ||
| 129 | file->f_pos = 0; | 129 | file->f_pos = 0; |
| 130 | file->f_flags = O_RDWR | (flags & O_NONBLOCK); | 130 | file->f_flags = flags & (O_ACCMODE | O_NONBLOCK); |
| 131 | file->f_version = 0; | 131 | file->f_version = 0; |
| 132 | file->private_data = priv; | 132 | file->private_data = priv; |
| 133 | 133 | ||
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 14cbc831422a..332dd00f0894 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c | |||
| @@ -1600,8 +1600,6 @@ static long do_ioctl_trans(int fd, unsigned int cmd, | |||
| 1600 | case KDSKBMETA: | 1600 | case KDSKBMETA: |
| 1601 | case KDSKBLED: | 1601 | case KDSKBLED: |
| 1602 | case KDSETLED: | 1602 | case KDSETLED: |
| 1603 | /* SG stuff */ | ||
| 1604 | case SG_SET_TRANSFORM: | ||
| 1605 | /* AUTOFS */ | 1603 | /* AUTOFS */ |
| 1606 | case AUTOFS_IOC_READY: | 1604 | case AUTOFS_IOC_READY: |
| 1607 | case AUTOFS_IOC_FAIL: | 1605 | case AUTOFS_IOC_FAIL: |
diff --git a/fs/eventfd.c b/fs/eventfd.c index 8b47e4200e65..d26402ff06ea 100644 --- a/fs/eventfd.c +++ b/fs/eventfd.c | |||
| @@ -339,7 +339,7 @@ struct file *eventfd_file_create(unsigned int count, int flags) | |||
| 339 | ctx->flags = flags; | 339 | ctx->flags = flags; |
| 340 | 340 | ||
| 341 | file = anon_inode_getfile("[eventfd]", &eventfd_fops, ctx, | 341 | file = anon_inode_getfile("[eventfd]", &eventfd_fops, ctx, |
| 342 | flags & EFD_SHARED_FCNTL_FLAGS); | 342 | O_RDWR | (flags & EFD_SHARED_FCNTL_FLAGS)); |
| 343 | if (IS_ERR(file)) | 343 | if (IS_ERR(file)) |
| 344 | eventfd_free_ctx(ctx); | 344 | eventfd_free_ctx(ctx); |
| 345 | 345 | ||
diff --git a/fs/eventpoll.c b/fs/eventpoll.c index 366c503f9657..bd056a5b4efc 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c | |||
| @@ -1206,7 +1206,7 @@ SYSCALL_DEFINE1(epoll_create1, int, flags) | |||
| 1206 | * a file structure and a free file descriptor. | 1206 | * a file structure and a free file descriptor. |
| 1207 | */ | 1207 | */ |
| 1208 | error = anon_inode_getfd("[eventpoll]", &eventpoll_fops, ep, | 1208 | error = anon_inode_getfd("[eventpoll]", &eventpoll_fops, ep, |
| 1209 | flags & O_CLOEXEC); | 1209 | O_RDWR | (flags & O_CLOEXEC)); |
| 1210 | if (error < 0) | 1210 | if (error < 0) |
| 1211 | ep_free(ep); | 1211 | ep_free(ep); |
| 1212 | 1212 | ||
diff --git a/fs/file_table.c b/fs/file_table.c index 0afacf654398..69652c5bd5f0 100644 --- a/fs/file_table.c +++ b/fs/file_table.c | |||
| @@ -186,10 +186,8 @@ struct file *alloc_file(struct path *path, fmode_t mode, | |||
| 186 | * that we can do debugging checks at __fput() | 186 | * that we can do debugging checks at __fput() |
| 187 | */ | 187 | */ |
| 188 | if ((mode & FMODE_WRITE) && !special_file(path->dentry->d_inode->i_mode)) { | 188 | if ((mode & FMODE_WRITE) && !special_file(path->dentry->d_inode->i_mode)) { |
| 189 | int error = 0; | ||
| 190 | file_take_write(file); | 189 | file_take_write(file); |
| 191 | error = mnt_clone_write(path->mnt); | 190 | WARN_ON(mnt_clone_write(path->mnt)); |
| 192 | WARN_ON(error); | ||
| 193 | } | 191 | } |
| 194 | ima_counts_get(file); | 192 | ima_counts_get(file); |
| 195 | return file; | 193 | return file; |
diff --git a/fs/internal.h b/fs/internal.h index f67cd141d9a8..e96a1667d749 100644 --- a/fs/internal.h +++ b/fs/internal.h | |||
| @@ -85,3 +85,10 @@ extern struct file *get_empty_filp(void); | |||
| 85 | * super.c | 85 | * super.c |
| 86 | */ | 86 | */ |
| 87 | extern int do_remount_sb(struct super_block *, int, void *, int); | 87 | extern int do_remount_sb(struct super_block *, int, void *, int); |
| 88 | |||
| 89 | /* | ||
| 90 | * open.c | ||
| 91 | */ | ||
| 92 | struct nameidata; | ||
| 93 | extern struct file *nameidata_to_filp(struct nameidata *); | ||
| 94 | extern void release_open_intent(struct nameidata *); | ||
diff --git a/fs/jfs/super.c b/fs/jfs/super.c index 2234c73fc577..d929a822a74e 100644 --- a/fs/jfs/super.c +++ b/fs/jfs/super.c | |||
| @@ -524,7 +524,7 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent) | |||
| 524 | * Page cache is indexed by long. | 524 | * Page cache is indexed by long. |
| 525 | * I would use MAX_LFS_FILESIZE, but it's only half as big | 525 | * I would use MAX_LFS_FILESIZE, but it's only half as big |
| 526 | */ | 526 | */ |
| 527 | sb->s_maxbytes = min(((u64) PAGE_CACHE_SIZE << 32) - 1, sb->s_maxbytes); | 527 | sb->s_maxbytes = min(((u64) PAGE_CACHE_SIZE << 32) - 1, (u64)sb->s_maxbytes); |
| 528 | #endif | 528 | #endif |
| 529 | sb->s_time_gran = 1; | 529 | sb->s_time_gran = 1; |
| 530 | return 0; | 530 | return 0; |
diff --git a/fs/namei.c b/fs/namei.c index dad4b80257db..68921d9b5302 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
| @@ -37,8 +37,6 @@ | |||
| 37 | 37 | ||
| 38 | #include "internal.h" | 38 | #include "internal.h" |
| 39 | 39 | ||
| 40 | #define ACC_MODE(x) ("\000\004\002\006"[(x)&O_ACCMODE]) | ||
| 41 | |||
| 42 | /* [Feb-1997 T. Schoebel-Theuer] | 40 | /* [Feb-1997 T. Schoebel-Theuer] |
| 43 | * Fundamental changes in the pathname lookup mechanisms (namei) | 41 | * Fundamental changes in the pathname lookup mechanisms (namei) |
| 44 | * were necessary because of omirr. The reason is that omirr needs | 42 | * were necessary because of omirr. The reason is that omirr needs |
| @@ -1640,6 +1638,7 @@ struct file *do_filp_open(int dfd, const char *pathname, | |||
| 1640 | if (filp == NULL) | 1638 | if (filp == NULL) |
| 1641 | return ERR_PTR(-ENFILE); | 1639 | return ERR_PTR(-ENFILE); |
| 1642 | nd.intent.open.file = filp; | 1640 | nd.intent.open.file = filp; |
| 1641 | filp->f_flags = open_flag; | ||
| 1643 | nd.intent.open.flags = flag; | 1642 | nd.intent.open.flags = flag; |
| 1644 | nd.intent.open.create_mode = 0; | 1643 | nd.intent.open.create_mode = 0; |
| 1645 | error = do_path_lookup(dfd, pathname, | 1644 | error = do_path_lookup(dfd, pathname, |
| @@ -1685,6 +1684,7 @@ struct file *do_filp_open(int dfd, const char *pathname, | |||
| 1685 | if (filp == NULL) | 1684 | if (filp == NULL) |
| 1686 | goto exit_parent; | 1685 | goto exit_parent; |
| 1687 | nd.intent.open.file = filp; | 1686 | nd.intent.open.file = filp; |
| 1687 | filp->f_flags = open_flag; | ||
| 1688 | nd.intent.open.flags = flag; | 1688 | nd.intent.open.flags = flag; |
| 1689 | nd.intent.open.create_mode = mode; | 1689 | nd.intent.open.create_mode = mode; |
| 1690 | dir = nd.path.dentry; | 1690 | dir = nd.path.dentry; |
| @@ -1725,7 +1725,7 @@ do_last: | |||
| 1725 | mnt_drop_write(nd.path.mnt); | 1725 | mnt_drop_write(nd.path.mnt); |
| 1726 | goto exit; | 1726 | goto exit; |
| 1727 | } | 1727 | } |
| 1728 | filp = nameidata_to_filp(&nd, open_flag); | 1728 | filp = nameidata_to_filp(&nd); |
| 1729 | mnt_drop_write(nd.path.mnt); | 1729 | mnt_drop_write(nd.path.mnt); |
| 1730 | if (nd.root.mnt) | 1730 | if (nd.root.mnt) |
| 1731 | path_put(&nd.root); | 1731 | path_put(&nd.root); |
| @@ -1789,7 +1789,7 @@ ok: | |||
| 1789 | mnt_drop_write(nd.path.mnt); | 1789 | mnt_drop_write(nd.path.mnt); |
| 1790 | goto exit; | 1790 | goto exit; |
| 1791 | } | 1791 | } |
| 1792 | filp = nameidata_to_filp(&nd, open_flag); | 1792 | filp = nameidata_to_filp(&nd); |
| 1793 | if (!IS_ERR(filp)) { | 1793 | if (!IS_ERR(filp)) { |
| 1794 | error = ima_path_check(&filp->f_path, filp->f_mode & | 1794 | error = ima_path_check(&filp->f_path, filp->f_mode & |
| 1795 | (MAY_READ | MAY_WRITE | MAY_EXEC)); | 1795 | (MAY_READ | MAY_WRITE | MAY_EXEC)); |
| @@ -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 | ||
diff --git a/fs/signalfd.c b/fs/signalfd.c index b07565c94386..1dabe4ee02fe 100644 --- a/fs/signalfd.c +++ b/fs/signalfd.c | |||
| @@ -236,7 +236,7 @@ SYSCALL_DEFINE4(signalfd4, int, ufd, sigset_t __user *, user_mask, | |||
| 236 | * anon_inode_getfd() will install the fd. | 236 | * anon_inode_getfd() will install the fd. |
| 237 | */ | 237 | */ |
| 238 | ufd = anon_inode_getfd("[signalfd]", &signalfd_fops, ctx, | 238 | ufd = anon_inode_getfd("[signalfd]", &signalfd_fops, ctx, |
| 239 | flags & (O_CLOEXEC | O_NONBLOCK)); | 239 | O_RDWR | (flags & (O_CLOEXEC | O_NONBLOCK))); |
| 240 | if (ufd < 0) | 240 | if (ufd < 0) |
| 241 | kfree(ctx); | 241 | kfree(ctx); |
| 242 | } else { | 242 | } else { |
diff --git a/fs/timerfd.c b/fs/timerfd.c index b042bd7034b1..1bfc95ad5f71 100644 --- a/fs/timerfd.c +++ b/fs/timerfd.c | |||
| @@ -200,7 +200,7 @@ SYSCALL_DEFINE2(timerfd_create, int, clockid, int, flags) | |||
| 200 | hrtimer_init(&ctx->tmr, clockid, HRTIMER_MODE_ABS); | 200 | hrtimer_init(&ctx->tmr, clockid, HRTIMER_MODE_ABS); |
| 201 | 201 | ||
| 202 | ufd = anon_inode_getfd("[timerfd]", &timerfd_fops, ctx, | 202 | ufd = anon_inode_getfd("[timerfd]", &timerfd_fops, ctx, |
| 203 | flags & TFD_SHARED_FCNTL_FLAGS); | 203 | O_RDWR | (flags & TFD_SHARED_FCNTL_FLAGS)); |
| 204 | if (ufd < 0) | 204 | if (ufd < 0) |
| 205 | kfree(ctx); | 205 | kfree(ctx); |
| 206 | 206 | ||
