diff options
author | Alex Shi <alex.shi@linaro.org> | 2017-07-18 14:31:54 +0800 |
---|---|---|
committer | Alex Shi <alex.shi@linaro.org> | 2017-07-18 14:31:54 +0800 |
commit | 16e243013beb93902693c4bb90e4348c99588429 (patch) | |
tree | 6a5858d948085974ef1f26bb1e4b546cfb44cfc5 /fs/coredump.c | |
parent | 2120557722577d8cff75a33a799ad15582dbd8ef (diff) | |
parent | 5289d9c979092878f2bf741d8b365ef7565fb6db (diff) |
Merge branch 'linux-linaro-lsk-v4.4' into linux-linaro-lsk-v4.4-android
Diffstat (limited to 'fs/coredump.c')
-rw-r--r-- | fs/coredump.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/fs/coredump.c b/fs/coredump.c index fe0a28da18a6..2ce5ef429c48 100644 --- a/fs/coredump.c +++ b/fs/coredump.c @@ -810,3 +810,21 @@ int dump_align(struct coredump_params *cprm, int align) return mod ? dump_skip(cprm, align - mod) : 1; } EXPORT_SYMBOL(dump_align); + +/* + * Ensures that file size is big enough to contain the current file + * postion. This prevents gdb from complaining about a truncated file + * if the last "write" to the file was dump_skip. + */ +void dump_truncate(struct coredump_params *cprm) +{ + struct file *file = cprm->file; + loff_t offset; + + if (file->f_op->llseek && file->f_op->llseek != no_llseek) { + offset = file->f_op->llseek(file, 0, SEEK_CUR); + if (i_size_read(file->f_mapping->host) < offset) + do_truncate(file->f_path.dentry, offset, 0, file); + } +} +EXPORT_SYMBOL(dump_truncate); |