summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-09-18 17:35:20 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2019-09-18 17:35:20 -0700
commite6bc9de714972cac34daa1dc1567ee48a47a9342 (patch)
treebb688c082764b6ce11d1160f525f535836d3f591 /include
parentb6c0d35772468173b5d3a7f6162079611e68a1e8 (diff)
parentdc617f29dbe5ef0c8ced65ce62c464af1daaab3d (diff)
Merge tag 'vfs-5.4-merge-1' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux
Pull swap access updates from Darrick Wong: "Prohibit writing to active swap files and swap partitions. There's no non-malicious use case for allowing userspace to scribble on storage that the kernel thinks it owns" * tag 'vfs-5.4-merge-1' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux: vfs: don't allow writes to swap files mm: set S_SWAPFILE on blockdev swap devices
Diffstat (limited to 'include')
-rw-r--r--include/linux/fs.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 104a727f8a67..ae6648145d18 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -3565,4 +3565,15 @@ static inline void simple_fill_fsxattr(struct fsxattr *fa, __u32 xflags)
fa->fsx_xflags = xflags;
}
+/*
+ * Flush file data before changing attributes. Caller must hold any locks
+ * required to prevent further writes to this file until we're done setting
+ * flags.
+ */
+static inline int inode_drain_writes(struct inode *inode)
+{
+ inode_dio_wait(inode);
+ return filemap_write_and_wait(inode->i_mapping);
+}
+
#endif /* _LINUX_FS_H */