The file hash is calculated and written out as an xattr after calling fasync(). In order for the file data and metadata to be written out to disk at the same time, this patch calculates the file hash and stores it as an xattr before calling fasync.
Unified · Split
| @@ -201,11 +201,11 @@ static void __fput(struct file *file) · 200 unmodified lines | |||
| 201 | eventpoll_release(file); | 201 | eventpoll_release(file); |
| 202 | locks_remove_file(file); | 202 | locks_remove_file(file); |
| 203 | 203 | ||
| 204 | ima_file_free(file); | ||
| 204 | if (unlikely(file->f_flags & FASYNC)) { | 205 | if (unlikely(file->f_flags & FASYNC)) { |
| 205 | if (file->f_op->fasync) | 206 | if (file->f_op->fasync) |
| 206 | file->f_op->fasync(-1, file, 0); | 207 | file->f_op->fasync(-1, file, 0); |
| 207 | } | 208 | } |
| 208 | ima_file_free(file); | ||
| 209 | if (file->f_op->release) | 209 | if (file->f_op->release) |
| 210 | file->f_op->release(inode, file); | 210 | file->f_op->release(inode, file); |
| 211 | security_file_free(file); | 211 | security_file_free(file); |