aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-04-06 14:07:08 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-04-06 14:07:08 -0400
commit9022ca6b1129da44e3d5c4fa779b8bb9ceabe2ce (patch)
tree6ff139aff1cf8a00cc057b7a706a81d91ee639ca
parent38c23685b273cfb4ccf31a199feccce3bdcb5d83 (diff)
parent0e11f6443f522f89509495b13ef1f3745640144d (diff)
Merge branch 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull misc vfs updates from Al Viro: "Assorted stuff, including Christoph's I_DIRTY patches" * 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: fs: move I_DIRTY_INODE to fs.h ubifs: fix bogus __mark_inode_dirty(I_DIRTY_SYNC | I_DIRTY_DATASYNC) call ntfs: fix bogus __mark_inode_dirty(I_DIRTY_SYNC | I_DIRTY_DATASYNC) call gfs2: fix bogus __mark_inode_dirty(I_DIRTY_SYNC | I_DIRTY_DATASYNC) calls fs: fold open_check_o_direct into do_dentry_open vfs: Replace stray non-ASCII homoglyph characters with their ASCII equivalents vfs: make sure struct filename->iname is word-aligned get rid of pointless includes of fs_struct.h [poll] annotate SAA6588_CMD_POLL users
-rw-r--r--arch/arc/kernel/troubleshoot.c1
-rw-r--r--drivers/media/i2c/saa6588.c4
-rw-r--r--drivers/media/pci/bt8xx/bttv-driver.c4
-rw-r--r--drivers/media/pci/saa7134/saa7134-video.c4
-rw-r--r--fs/ceph/dir.c1
-rw-r--r--fs/ext4/inode.c4
-rw-r--r--fs/fs-writeback.c9
-rw-r--r--fs/gfs2/super.c2
-rw-r--r--fs/gfs2/xattr.c8
-rw-r--r--fs/internal.h1
-rw-r--r--fs/namei.c9
-rw-r--r--fs/nfs/nfs4xdr.c1
-rw-r--r--fs/ntfs/mft.c4
-rw-r--r--fs/ocfs2/dlmglue.c2
-rw-r--r--fs/open.c44
-rw-r--r--fs/orangefs/acl.c1
-rw-r--r--fs/ubifs/file.c2
-rw-r--r--fs/xfs/xfs_aops.c2
-rw-r--r--include/linux/fs.h5
-rw-r--r--include/media/i2c/saa6588.h1
-rw-r--r--kernel/exec_domain.c1
-rw-r--r--security/loadpin/loadpin.c1
22 files changed, 46 insertions, 65 deletions
diff --git a/arch/arc/kernel/troubleshoot.c b/arch/arc/kernel/troubleshoot.c
index 6e9a0a9a6a04..783b20354f8b 100644
--- a/arch/arc/kernel/troubleshoot.c
+++ b/arch/arc/kernel/troubleshoot.c
@@ -10,7 +10,6 @@
10#include <linux/mm.h> 10#include <linux/mm.h>
11#include <linux/fs.h> 11#include <linux/fs.h>
12#include <linux/kdev_t.h> 12#include <linux/kdev_t.h>
13#include <linux/fs_struct.h>
14#include <linux/proc_fs.h> 13#include <linux/proc_fs.h>
15#include <linux/file.h> 14#include <linux/file.h>
16#include <linux/sched/mm.h> 15#include <linux/sched/mm.h>
diff --git a/drivers/media/i2c/saa6588.c b/drivers/media/i2c/saa6588.c
index c3089bd34df2..33d2987f9555 100644
--- a/drivers/media/i2c/saa6588.c
+++ b/drivers/media/i2c/saa6588.c
@@ -411,9 +411,9 @@ static long saa6588_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
411 break; 411 break;
412 /* --- poll() for /dev/radio --- */ 412 /* --- poll() for /dev/radio --- */
413 case SAA6588_CMD_POLL: 413 case SAA6588_CMD_POLL:
414 a->result = 0; 414 a->poll_mask = 0;
415 if (s->data_available_for_read) 415 if (s->data_available_for_read)
416 a->result |= EPOLLIN | EPOLLRDNORM; 416 a->poll_mask |= EPOLLIN | EPOLLRDNORM;
417 poll_wait(a->instance, &s->read_queue, a->event_list); 417 poll_wait(a->instance, &s->read_queue, a->event_list);
418 break; 418 break;
419 419
diff --git a/drivers/media/pci/bt8xx/bttv-driver.c b/drivers/media/pci/bt8xx/bttv-driver.c
index f697698fe38d..707f57a9f940 100644
--- a/drivers/media/pci/bt8xx/bttv-driver.c
+++ b/drivers/media/pci/bt8xx/bttv-driver.c
@@ -3344,10 +3344,10 @@ static __poll_t radio_poll(struct file *file, poll_table *wait)
3344 radio_enable(btv); 3344 radio_enable(btv);
3345 cmd.instance = file; 3345 cmd.instance = file;
3346 cmd.event_list = wait; 3346 cmd.event_list = wait;
3347 cmd.result = res; 3347 cmd.poll_mask = res;
3348 bttv_call_all(btv, core, ioctl, SAA6588_CMD_POLL, &cmd); 3348 bttv_call_all(btv, core, ioctl, SAA6588_CMD_POLL, &cmd);
3349 3349
3350 return cmd.result; 3350 return cmd.poll_mask;
3351} 3351}
3352 3352
3353static const struct v4l2_file_operations radio_fops = 3353static const struct v4l2_file_operations radio_fops =
diff --git a/drivers/media/pci/saa7134/saa7134-video.c b/drivers/media/pci/saa7134/saa7134-video.c
index 4f1091a11e91..1a50ec9d084f 100644
--- a/drivers/media/pci/saa7134/saa7134-video.c
+++ b/drivers/media/pci/saa7134/saa7134-video.c
@@ -1235,12 +1235,12 @@ static __poll_t radio_poll(struct file *file, poll_table *wait)
1235 1235
1236 cmd.instance = file; 1236 cmd.instance = file;
1237 cmd.event_list = wait; 1237 cmd.event_list = wait;
1238 cmd.result = 0; 1238 cmd.poll_mask = 0;
1239 mutex_lock(&dev->lock); 1239 mutex_lock(&dev->lock);
1240 saa_call_all(dev, core, ioctl, SAA6588_CMD_POLL, &cmd); 1240 saa_call_all(dev, core, ioctl, SAA6588_CMD_POLL, &cmd);
1241 mutex_unlock(&dev->lock); 1241 mutex_unlock(&dev->lock);
1242 1242
1243 return rc | cmd.result; 1243 return rc | cmd.poll_mask;
1244} 1244}
1245 1245
1246/* ------------------------------------------------------------------ */ 1246/* ------------------------------------------------------------------ */
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c
index f1d9c6cc0491..2bdd561c4c68 100644
--- a/fs/ceph/dir.c
+++ b/fs/ceph/dir.c
@@ -2,7 +2,6 @@
2#include <linux/ceph/ceph_debug.h> 2#include <linux/ceph/ceph_debug.h>
3 3
4#include <linux/spinlock.h> 4#include <linux/spinlock.h>
5#include <linux/fs_struct.h>
6#include <linux/namei.h> 5#include <linux/namei.h>
7#include <linux/slab.h> 6#include <linux/slab.h>
8#include <linux/sched.h> 7#include <linux/sched.h>
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 18aa2ef963ad..129205028300 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -5024,12 +5024,12 @@ static int other_inode_match(struct inode * inode, unsigned long ino,
5024 5024
5025 if ((inode->i_ino != ino) || 5025 if ((inode->i_ino != ino) ||
5026 (inode->i_state & (I_FREEING | I_WILL_FREE | I_NEW | 5026 (inode->i_state & (I_FREEING | I_WILL_FREE | I_NEW |
5027 I_DIRTY_SYNC | I_DIRTY_DATASYNC)) || 5027 I_DIRTY_INODE)) ||
5028 ((inode->i_state & I_DIRTY_TIME) == 0)) 5028 ((inode->i_state & I_DIRTY_TIME) == 0))
5029 return 0; 5029 return 0;
5030 spin_lock(&inode->i_lock); 5030 spin_lock(&inode->i_lock);
5031 if (((inode->i_state & (I_FREEING | I_WILL_FREE | I_NEW | 5031 if (((inode->i_state & (I_FREEING | I_WILL_FREE | I_NEW |
5032 I_DIRTY_SYNC | I_DIRTY_DATASYNC)) == 0) && 5032 I_DIRTY_INODE)) == 0) &&
5033 (inode->i_state & I_DIRTY_TIME)) { 5033 (inode->i_state & I_DIRTY_TIME)) {
5034 struct ext4_inode_info *ei = EXT4_I(inode); 5034 struct ext4_inode_info *ei = EXT4_I(inode);
5035 5035
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index d4d04fee568a..1280f915079b 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -1343,7 +1343,7 @@ __writeback_single_inode(struct inode *inode, struct writeback_control *wbc)
1343 1343
1344 dirty = inode->i_state & I_DIRTY; 1344 dirty = inode->i_state & I_DIRTY;
1345 if (inode->i_state & I_DIRTY_TIME) { 1345 if (inode->i_state & I_DIRTY_TIME) {
1346 if ((dirty & (I_DIRTY_SYNC | I_DIRTY_DATASYNC)) || 1346 if ((dirty & I_DIRTY_INODE) ||
1347 wbc->sync_mode == WB_SYNC_ALL || 1347 wbc->sync_mode == WB_SYNC_ALL ||
1348 unlikely(inode->i_state & I_DIRTY_TIME_EXPIRED) || 1348 unlikely(inode->i_state & I_DIRTY_TIME_EXPIRED) ||
1349 unlikely(time_after(jiffies, 1349 unlikely(time_after(jiffies,
@@ -2112,7 +2112,6 @@ static noinline void block_dump___mark_inode_dirty(struct inode *inode)
2112 */ 2112 */
2113void __mark_inode_dirty(struct inode *inode, int flags) 2113void __mark_inode_dirty(struct inode *inode, int flags)
2114{ 2114{
2115#define I_DIRTY_INODE (I_DIRTY_SYNC | I_DIRTY_DATASYNC)
2116 struct super_block *sb = inode->i_sb; 2115 struct super_block *sb = inode->i_sb;
2117 int dirtytime; 2116 int dirtytime;
2118 2117
@@ -2122,7 +2121,7 @@ void __mark_inode_dirty(struct inode *inode, int flags)
2122 * Don't do this for I_DIRTY_PAGES - that doesn't actually 2121 * Don't do this for I_DIRTY_PAGES - that doesn't actually
2123 * dirty the inode itself 2122 * dirty the inode itself
2124 */ 2123 */
2125 if (flags & (I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_TIME)) { 2124 if (flags & (I_DIRTY_INODE | I_DIRTY_TIME)) {
2126 trace_writeback_dirty_inode_start(inode, flags); 2125 trace_writeback_dirty_inode_start(inode, flags);
2127 2126
2128 if (sb->s_op->dirty_inode) 2127 if (sb->s_op->dirty_inode)
@@ -2197,7 +2196,7 @@ void __mark_inode_dirty(struct inode *inode, int flags)
2197 if (dirtytime) 2196 if (dirtytime)
2198 inode->dirtied_time_when = jiffies; 2197 inode->dirtied_time_when = jiffies;
2199 2198
2200 if (inode->i_state & (I_DIRTY_INODE | I_DIRTY_PAGES)) 2199 if (inode->i_state & I_DIRTY)
2201 dirty_list = &wb->b_dirty; 2200 dirty_list = &wb->b_dirty;
2202 else 2201 else
2203 dirty_list = &wb->b_dirty_time; 2202 dirty_list = &wb->b_dirty_time;
@@ -2221,8 +2220,6 @@ void __mark_inode_dirty(struct inode *inode, int flags)
2221 } 2220 }
2222out_unlock_inode: 2221out_unlock_inode:
2223 spin_unlock(&inode->i_lock); 2222 spin_unlock(&inode->i_lock);
2224
2225#undef I_DIRTY_INODE
2226} 2223}
2227EXPORT_SYMBOL(__mark_inode_dirty); 2224EXPORT_SYMBOL(__mark_inode_dirty);
2228 2225
diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c
index 620be0521866..cf5c7f3080d2 100644
--- a/fs/gfs2/super.c
+++ b/fs/gfs2/super.c
@@ -800,7 +800,7 @@ static void gfs2_dirty_inode(struct inode *inode, int flags)
800 int need_endtrans = 0; 800 int need_endtrans = 0;
801 int ret; 801 int ret;
802 802
803 if (!(flags & (I_DIRTY_DATASYNC|I_DIRTY_SYNC))) 803 if (!(flags & I_DIRTY_INODE))
804 return; 804 return;
805 if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) 805 if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
806 return; 806 return;
diff --git a/fs/gfs2/xattr.c b/fs/gfs2/xattr.c
index 05de20954659..f2bce1e0f6fb 100644
--- a/fs/gfs2/xattr.c
+++ b/fs/gfs2/xattr.c
@@ -308,7 +308,7 @@ static int ea_dealloc_unstuffed(struct gfs2_inode *ip, struct buffer_head *bh,
308 } 308 }
309 309
310 ip->i_inode.i_ctime = current_time(&ip->i_inode); 310 ip->i_inode.i_ctime = current_time(&ip->i_inode);
311 __mark_inode_dirty(&ip->i_inode, I_DIRTY_SYNC | I_DIRTY_DATASYNC); 311 __mark_inode_dirty(&ip->i_inode, I_DIRTY_DATASYNC);
312 312
313 gfs2_trans_end(sdp); 313 gfs2_trans_end(sdp);
314 314
@@ -768,7 +768,7 @@ static int ea_alloc_skeleton(struct gfs2_inode *ip, struct gfs2_ea_request *er,
768 goto out_end_trans; 768 goto out_end_trans;
769 769
770 ip->i_inode.i_ctime = current_time(&ip->i_inode); 770 ip->i_inode.i_ctime = current_time(&ip->i_inode);
771 __mark_inode_dirty(&ip->i_inode, I_DIRTY_SYNC | I_DIRTY_DATASYNC); 771 __mark_inode_dirty(&ip->i_inode, I_DIRTY_DATASYNC);
772 772
773out_end_trans: 773out_end_trans:
774 gfs2_trans_end(GFS2_SB(&ip->i_inode)); 774 gfs2_trans_end(GFS2_SB(&ip->i_inode));
@@ -896,7 +896,7 @@ static int ea_set_simple_noalloc(struct gfs2_inode *ip, struct buffer_head *bh,
896 ea_set_remove_stuffed(ip, es->es_el); 896 ea_set_remove_stuffed(ip, es->es_el);
897 897
898 ip->i_inode.i_ctime = current_time(&ip->i_inode); 898 ip->i_inode.i_ctime = current_time(&ip->i_inode);
899 __mark_inode_dirty(&ip->i_inode, I_DIRTY_SYNC | I_DIRTY_DATASYNC); 899 __mark_inode_dirty(&ip->i_inode, I_DIRTY_DATASYNC);
900 900
901 gfs2_trans_end(GFS2_SB(&ip->i_inode)); 901 gfs2_trans_end(GFS2_SB(&ip->i_inode));
902 return error; 902 return error;
@@ -1114,7 +1114,7 @@ static int ea_remove_stuffed(struct gfs2_inode *ip, struct gfs2_ea_location *el)
1114 } 1114 }
1115 1115
1116 ip->i_inode.i_ctime = current_time(&ip->i_inode); 1116 ip->i_inode.i_ctime = current_time(&ip->i_inode);
1117 __mark_inode_dirty(&ip->i_inode, I_DIRTY_SYNC | I_DIRTY_DATASYNC); 1117 __mark_inode_dirty(&ip->i_inode, I_DIRTY_DATASYNC);
1118 1118
1119 gfs2_trans_end(GFS2_SB(&ip->i_inode)); 1119 gfs2_trans_end(GFS2_SB(&ip->i_inode));
1120 1120
diff --git a/fs/internal.h b/fs/internal.h
index 980d005b21b4..e08972db0303 100644
--- a/fs/internal.h
+++ b/fs/internal.h
@@ -125,7 +125,6 @@ int do_fchmodat(int dfd, const char __user *filename, umode_t mode);
125int do_fchownat(int dfd, const char __user *filename, uid_t user, gid_t group, 125int do_fchownat(int dfd, const char __user *filename, uid_t user, gid_t group,
126 int flag); 126 int flag);
127 127
128extern int open_check_o_direct(struct file *f);
129extern int vfs_open(const struct path *, struct file *, const struct cred *); 128extern int vfs_open(const struct path *, struct file *, const struct cred *);
130extern struct file *filp_clone_open(struct file *); 129extern struct file *filp_clone_open(struct file *);
131 130
diff --git a/fs/namei.c b/fs/namei.c
index a09419379f5d..5661da1972cd 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -39,6 +39,7 @@
39#include <linux/bitops.h> 39#include <linux/bitops.h>
40#include <linux/init_task.h> 40#include <linux/init_task.h>
41#include <linux/uaccess.h> 41#include <linux/uaccess.h>
42#include <linux/build_bug.h>
42 43
43#include "internal.h" 44#include "internal.h"
44#include "mount.h" 45#include "mount.h"
@@ -130,6 +131,7 @@ getname_flags(const char __user *filename, int flags, int *empty)
130 struct filename *result; 131 struct filename *result;
131 char *kname; 132 char *kname;
132 int len; 133 int len;
134 BUILD_BUG_ON(offsetof(struct filename, iname) % sizeof(long) != 0);
133 135
134 result = audit_reusename(filename); 136 result = audit_reusename(filename);
135 if (result) 137 if (result)
@@ -3374,9 +3376,7 @@ finish_open_created:
3374 goto out; 3376 goto out;
3375 *opened |= FILE_OPENED; 3377 *opened |= FILE_OPENED;
3376opened: 3378opened:
3377 error = open_check_o_direct(file); 3379 error = ima_file_check(file, op->acc_mode, *opened);
3378 if (!error)
3379 error = ima_file_check(file, op->acc_mode, *opened);
3380 if (!error && will_truncate) 3380 if (!error && will_truncate)
3381 error = handle_truncate(file); 3381 error = handle_truncate(file);
3382out: 3382out:
@@ -3456,9 +3456,6 @@ static int do_tmpfile(struct nameidata *nd, unsigned flags,
3456 error = finish_open(file, child, NULL, opened); 3456 error = finish_open(file, child, NULL, opened);
3457 if (error) 3457 if (error)
3458 goto out2; 3458 goto out2;
3459 error = open_check_o_direct(file);
3460 if (error)
3461 fput(file);
3462out2: 3459out2:
3463 mnt_drop_write(path.mnt); 3460 mnt_drop_write(path.mnt);
3464out: 3461out:
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index 65c9c4175145..b993ad282de2 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -52,7 +52,6 @@
52#include <linux/nfs.h> 52#include <linux/nfs.h>
53#include <linux/nfs4.h> 53#include <linux/nfs4.h>
54#include <linux/nfs_fs.h> 54#include <linux/nfs_fs.h>
55#include <linux/fs_struct.h>
56 55
57#include "nfs4_fs.h" 56#include "nfs4_fs.h"
58#include "internal.h" 57#include "internal.h"
diff --git a/fs/ntfs/mft.c b/fs/ntfs/mft.c
index 2831f495a674..32c523cf5a2d 100644
--- a/fs/ntfs/mft.c
+++ b/fs/ntfs/mft.c
@@ -381,7 +381,7 @@ unm_err_out:
381 * vfs inode dirty. This ensures that any changes to the mft record are 381 * vfs inode dirty. This ensures that any changes to the mft record are
382 * written out to disk. 382 * written out to disk.
383 * 383 *
384 * NOTE: We only set I_DIRTY_SYNC and I_DIRTY_DATASYNC (and not I_DIRTY_PAGES) 384 * NOTE: We only set I_DIRTY_DATASYNC (and not I_DIRTY_PAGES)
385 * on the base vfs inode, because even though file data may have been modified, 385 * on the base vfs inode, because even though file data may have been modified,
386 * it is dirty in the inode meta data rather than the data page cache of the 386 * it is dirty in the inode meta data rather than the data page cache of the
387 * inode, and thus there are no data pages that need writing out. Therefore, a 387 * inode, and thus there are no data pages that need writing out. Therefore, a
@@ -407,7 +407,7 @@ void __mark_mft_record_dirty(ntfs_inode *ni)
407 else 407 else
408 base_ni = ni->ext.base_ntfs_ino; 408 base_ni = ni->ext.base_ntfs_ino;
409 mutex_unlock(&ni->extent_lock); 409 mutex_unlock(&ni->extent_lock);
410 __mark_inode_dirty(VFS_I(base_ni), I_DIRTY_SYNC | I_DIRTY_DATASYNC); 410 __mark_inode_dirty(VFS_I(base_ni), I_DIRTY_DATASYNC);
411} 411}
412 412
413static const char *ntfs_please_email = "Please email " 413static const char *ntfs_please_email = "Please email "
diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c
index 9479f99c2145..b552d1f8508c 100644
--- a/fs/ocfs2/dlmglue.c
+++ b/fs/ocfs2/dlmglue.c
@@ -3537,7 +3537,7 @@ static int ocfs2_downconvert_lock(struct ocfs2_super *osb,
3537 * On DLM_LKF_VALBLK, fsdlm behaves differently with o2cb. It always 3537 * On DLM_LKF_VALBLK, fsdlm behaves differently with o2cb. It always
3538 * expects DLM_LKF_VALBLK being set if the LKB has LVB, so that 3538 * expects DLM_LKF_VALBLK being set if the LKB has LVB, so that
3539 * we can recover correctly from node failure. Otherwise, we may get 3539 * we can recover correctly from node failure. Otherwise, we may get
3540 * invalid LVB in LKB, but without DLM_SBF_VALNOTVALID being set. 3540 * invalid LVB in LKB, but without DLM_SBF_VALNOTVALID being set.
3541 */ 3541 */
3542 if (!ocfs2_is_o2cb_active() && 3542 if (!ocfs2_is_o2cb_active() &&
3543 lockres->l_ops->flags & LOCK_TYPE_USES_LVB) 3543 lockres->l_ops->flags & LOCK_TYPE_USES_LVB)
diff --git a/fs/open.c b/fs/open.c
index d0e955b558ad..c5ee7cd60424 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -724,16 +724,6 @@ SYSCALL_DEFINE3(fchown, unsigned int, fd, uid_t, user, gid_t, group)
724 return ksys_fchown(fd, user, group); 724 return ksys_fchown(fd, user, group);
725} 725}
726 726
727int open_check_o_direct(struct file *f)
728{
729 /* NB: we're sure to have correct a_ops only after f_op->open */
730 if (f->f_flags & O_DIRECT) {
731 if (!f->f_mapping->a_ops || !f->f_mapping->a_ops->direct_IO)
732 return -EINVAL;
733 }
734 return 0;
735}
736
737static int do_dentry_open(struct file *f, 727static int do_dentry_open(struct file *f,
738 struct inode *inode, 728 struct inode *inode,
739 int (*open)(struct inode *, struct file *), 729 int (*open)(struct inode *, struct file *),
@@ -755,7 +745,7 @@ static int do_dentry_open(struct file *f,
755 if (unlikely(f->f_flags & O_PATH)) { 745 if (unlikely(f->f_flags & O_PATH)) {
756 f->f_mode = FMODE_PATH; 746 f->f_mode = FMODE_PATH;
757 f->f_op = &empty_fops; 747 f->f_op = &empty_fops;
758 return 0; 748 goto done;
759 } 749 }
760 750
761 if (f->f_mode & FMODE_WRITE && !special_file(inode->i_mode)) { 751 if (f->f_mode & FMODE_WRITE && !special_file(inode->i_mode)) {
@@ -808,7 +798,12 @@ static int do_dentry_open(struct file *f,
808 f->f_flags &= ~(O_CREAT | O_EXCL | O_NOCTTY | O_TRUNC); 798 f->f_flags &= ~(O_CREAT | O_EXCL | O_NOCTTY | O_TRUNC);
809 799
810 file_ra_state_init(&f->f_ra, f->f_mapping->host->i_mapping); 800 file_ra_state_init(&f->f_ra, f->f_mapping->host->i_mapping);
811 801done:
802 /* NB: we're sure to have correct a_ops only after f_op->open */
803 error = -EINVAL;
804 if ((f->f_flags & O_DIRECT) &&
805 (!f->f_mapping->a_ops || !f->f_mapping->a_ops->direct_IO))
806 goto out_fput;
812 return 0; 807 return 0;
813 808
814cleanup_all: 809cleanup_all:
@@ -823,6 +818,9 @@ cleanup_file:
823 f->f_path.dentry = NULL; 818 f->f_path.dentry = NULL;
824 f->f_inode = NULL; 819 f->f_inode = NULL;
825 return error; 820 return error;
821out_fput:
822 fput(f);
823 return error;
826} 824}
827 825
828/** 826/**
@@ -920,20 +918,14 @@ struct file *dentry_open(const struct path *path, int flags,
920 BUG_ON(!path->mnt); 918 BUG_ON(!path->mnt);
921 919
922 f = get_empty_filp(); 920 f = get_empty_filp();
923 if (!IS_ERR(f)) { 921 if (IS_ERR(f))
924 f->f_flags = flags; 922 return f;
925 error = vfs_open(path, f, cred); 923
926 if (!error) { 924 f->f_flags = flags;
927 /* from now on we need fput() to dispose of f */ 925 error = vfs_open(path, f, cred);
928 error = open_check_o_direct(f); 926 if (error) {
929 if (error) { 927 put_filp(f);
930 fput(f); 928 return ERR_PTR(error);
931 f = ERR_PTR(error);
932 }
933 } else {
934 put_filp(f);
935 f = ERR_PTR(error);
936 }
937 } 929 }
938 return f; 930 return f;
939} 931}
diff --git a/fs/orangefs/acl.c b/fs/orangefs/acl.c
index 480ea059a680..10587413b20e 100644
--- a/fs/orangefs/acl.c
+++ b/fs/orangefs/acl.c
@@ -9,7 +9,6 @@
9#include "orangefs-kernel.h" 9#include "orangefs-kernel.h"
10#include "orangefs-bufmap.h" 10#include "orangefs-bufmap.h"
11#include <linux/posix_acl_xattr.h> 11#include <linux/posix_acl_xattr.h>
12#include <linux/fs_struct.h>
13 12
14struct posix_acl *orangefs_get_acl(struct inode *inode, int type) 13struct posix_acl *orangefs_get_acl(struct inode *inode, int type)
15{ 14{
diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c
index cf348ba99238..1acb2ff505e6 100644
--- a/fs/ubifs/file.c
+++ b/fs/ubifs/file.c
@@ -1256,7 +1256,7 @@ static int do_setattr(struct ubifs_info *c, struct inode *inode,
1256 * Inode length changed, so we have to make sure 1256 * Inode length changed, so we have to make sure
1257 * @I_DIRTY_DATASYNC is set. 1257 * @I_DIRTY_DATASYNC is set.
1258 */ 1258 */
1259 __mark_inode_dirty(inode, I_DIRTY_SYNC | I_DIRTY_DATASYNC); 1259 __mark_inode_dirty(inode, I_DIRTY_DATASYNC);
1260 else 1260 else
1261 mark_inode_dirty_sync(inode); 1261 mark_inode_dirty_sync(inode);
1262 mutex_unlock(&ui->ui_mutex); 1262 mutex_unlock(&ui->ui_mutex);
diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c
index 19eadc807056..31f1f10eecd1 100644
--- a/fs/xfs/xfs_aops.c
+++ b/fs/xfs/xfs_aops.c
@@ -1390,7 +1390,7 @@ xfs_vm_bmap(
1390 1390
1391 /* 1391 /*
1392 * The swap code (ab-)uses ->bmap to get a block mapping and then 1392 * The swap code (ab-)uses ->bmap to get a block mapping and then
1393 * bypasseѕ the file system for actual I/O. We really can't allow 1393 * bypasses the file system for actual I/O. We really can't allow
1394 * that on reflinks inodes, so we have to skip out here. And yes, 1394 * that on reflinks inodes, so we have to skip out here. And yes,
1395 * 0 is the magic code for a bmap error. 1395 * 0 is the magic code for a bmap error.
1396 * 1396 *
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 070807ce3e41..0d798052bd85 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -2015,7 +2015,8 @@ static inline void init_sync_kiocb(struct kiocb *kiocb, struct file *filp)
2015#define I_WB_SWITCH (1 << 13) 2015#define I_WB_SWITCH (1 << 13)
2016#define I_OVL_INUSE (1 << 14) 2016#define I_OVL_INUSE (1 << 14)
2017 2017
2018#define I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_PAGES) 2018#define I_DIRTY_INODE (I_DIRTY_SYNC | I_DIRTY_DATASYNC)
2019#define I_DIRTY (I_DIRTY_INODE | I_DIRTY_PAGES)
2019#define I_DIRTY_ALL (I_DIRTY | I_DIRTY_TIME) 2020#define I_DIRTY_ALL (I_DIRTY | I_DIRTY_TIME)
2020 2021
2021extern void __mark_inode_dirty(struct inode *, int); 2022extern void __mark_inode_dirty(struct inode *, int);
@@ -2381,8 +2382,8 @@ struct audit_names;
2381struct filename { 2382struct filename {
2382 const char *name; /* pointer to actual string */ 2383 const char *name; /* pointer to actual string */
2383 const __user char *uptr; /* original userland pointer */ 2384 const __user char *uptr; /* original userland pointer */
2384 struct audit_names *aname;
2385 int refcnt; 2385 int refcnt;
2386 struct audit_names *aname;
2386 const char iname[]; 2387 const char iname[];
2387}; 2388};
2388 2389
diff --git a/include/media/i2c/saa6588.h b/include/media/i2c/saa6588.h
index b5ec1aa60ed5..a0825f532f71 100644
--- a/include/media/i2c/saa6588.h
+++ b/include/media/i2c/saa6588.h
@@ -32,6 +32,7 @@ struct saa6588_command {
32 unsigned char __user *buffer; 32 unsigned char __user *buffer;
33 struct file *instance; 33 struct file *instance;
34 poll_table *event_list; 34 poll_table *event_list;
35 __poll_t poll_mask;
35}; 36};
36 37
37/* These ioctls are internal to the kernel */ 38/* These ioctls are internal to the kernel */
diff --git a/kernel/exec_domain.c b/kernel/exec_domain.c
index 0975b0268545..a5697119290e 100644
--- a/kernel/exec_domain.c
+++ b/kernel/exec_domain.c
@@ -19,7 +19,6 @@
19#include <linux/syscalls.h> 19#include <linux/syscalls.h>
20#include <linux/sysctl.h> 20#include <linux/sysctl.h>
21#include <linux/types.h> 21#include <linux/types.h>
22#include <linux/fs_struct.h>
23 22
24#ifdef CONFIG_PROC_FS 23#ifdef CONFIG_PROC_FS
25static int execdomains_proc_show(struct seq_file *m, void *v) 24static int execdomains_proc_show(struct seq_file *m, void *v)
diff --git a/security/loadpin/loadpin.c b/security/loadpin/loadpin.c
index dbe6efde77a0..5fa191252c8f 100644
--- a/security/loadpin/loadpin.c
+++ b/security/loadpin/loadpin.c
@@ -19,7 +19,6 @@
19 19
20#include <linux/module.h> 20#include <linux/module.h>
21#include <linux/fs.h> 21#include <linux/fs.h>
22#include <linux/fs_struct.h>
23#include <linux/lsm_hooks.h> 22#include <linux/lsm_hooks.h>
24#include <linux/mount.h> 23#include <linux/mount.h>
25#include <linux/path.h> 24#include <linux/path.h>