History

vfs: don't allow writes to swap files

Don't let userspace write to an active swap file because the kernel effectively has a long term lease on the storage and things could get seriously corrupted if we let this happen.

Darrick J. Wong committed 7 years ago

Commit dc617f21 parent 16380456 files · +38 −3Browse files

Showing the changes to include/linux (1 of 6 files). Show all

Unified · Split

include/linux/fs.h+11−0
@@ -3547,4 +3547,15 @@ static inline void simple_fill_fsxattr(struct fsxattr *fa, __u32 xflags) · 3546 unmodified lines
3547 fa->fsx_xflags = xflags;3547 fa->fsx_xflags = xflags;
3548}3548}
3549 3549
3550/*
3551 * Flush file data before changing attributes. Caller must hold any locks
3552 * required to prevent further writes to this file until we're done setting
3553 * flags.
3554 */
3555static inline int inode_drain_writes(struct inode *inode)
3556{
3557 inode_dio_wait(inode);
3558 return filemap_write_and_wait(inode->i_mapping);
3559}
3560
3550#endif /* _LINUX_FS_H */3561#endif /* _LINUX_FS_H */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t