diff options
| author | Hugh Dickins <hugh@veritas.com> | 2004-06-26 21:03:11 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-06-26 21:03:11 -0700 |
| commit | 7a35e30c2194c7de5514a6fb1678cd2da9421843 (patch) | |
| tree | 3672ba2d7eb7d6f2ee9bfc454054b6467ed08087 /include/linux | |
| parent | 53d4b32b482da634f2c6fee04046330e2865643f (diff) | |
[PATCH] Don't hold i_sem on swapfiles
We permanently hold the i_sem of swapfiles so that nobody can addidentally
ftruncate them, causing subsequent filesystem destruction.
Problem is, it's fairly easy for things like backup applications to get
stuck onthe swapfile, sleeping until someone does a swapoff.
So take all that out again and add a new S_SWAPFILE inode flag. Test that
in the truncate path and refuse to truncate an in-use swapfile.
Synchronisation between swapon and truncate is via i_sem.
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/fs.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h index 27dda18def71..f20e583bb41e 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -140,6 +140,7 @@ extern int leases_enable, dir_notify_enable, lease_break_time; #define S_NOQUOTA 64 /* Inode is not counted to quota */ #define S_DIRSYNC 128 /* Directory modifications are synchronous */ #define S_NOCMTIME 256 /* Do not update file c/mtime */ +#define S_SWAPFILE 512 /* Do not truncate: swapon got its bmaps */ /* * Note that nosuid etc flags are inode-specific: setting some file-system @@ -174,6 +175,7 @@ extern int leases_enable, dir_notify_enable, lease_break_time; #define IS_DEADDIR(inode) ((inode)->i_flags & S_DEAD) #define IS_NOCMTIME(inode) ((inode)->i_flags & S_NOCMTIME) +#define IS_SWAPFILE(inode) ((inode)->i_flags & S_SWAPFILE) /* the read-only stuff doesn't really belong here, but any other place is probably as bad and I don't want to create yet another include file. */ |
