diff options
author | Jan Kara <jack@suse.cz> | 2013-05-04 00:11:23 +0200 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2013-05-04 14:57:58 -0400 |
commit | 5ae98f1589e076e4b314fc54ae2beac58842ddc2 (patch) | |
tree | ea0ea08edbc6f4f0644faca5e8c3a29a68f71c51 /include | |
parent | 9dcc26cf67fb7db7613290e62eeed6c4276c75ce (diff) |
fs: Fix hang with BSD accounting on frozen filesystem
When BSD process accounting is enabled and logs information to a
filesystem which gets frozen, system easily becomes unusable because
each attempt to account process information blocks. Thus e.g. every task
gets blocked in exit.
It seems better to drop accounting information (which can already happen
when filesystem is running out of space) instead of locking system up.
So we just skip the write if the filesystem is frozen.
Reported-by: Nikola Ciprich <nikola.ciprich@linuxbox.cz>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/fs.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h index e8cd6b839675..b5a24ba83b6f 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -2227,6 +2227,13 @@ static inline void file_start_write(struct file *file) __sb_start_write(file_inode(file)->i_sb, SB_FREEZE_WRITE, true); } +static inline bool file_start_write_trylock(struct file *file) +{ + if (!S_ISREG(file_inode(file)->i_mode)) + return true; + return __sb_start_write(file_inode(file)->i_sb, SB_FREEZE_WRITE, false); +} + static inline void file_end_write(struct file *file) { if (!S_ISREG(file_inode(file)->i_mode)) |