Skip to content

Commit

Permalink
um: hostfs: Fix writeback
Browse files Browse the repository at this point in the history
We have to implement ->release() and trigger writeback from it.
Otherwise we might lose dirty pages at munmap().

Signed-off-by: Richard Weinberger <richard@nod.at>
  • Loading branch information
Richard Weinberger committed Sep 7, 2013
1 parent 6e46645 commit 65984ff
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion fs/hostfs/hostfs_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,13 @@ int hostfs_file_open(struct inode *ino, struct file *file)
return 0;
}

static int hostfs_file_release(struct inode *inode, struct file *file)
{
filemap_write_and_wait(inode->i_mapping);

return 0;
}

int hostfs_fsync(struct file *file, loff_t start, loff_t end, int datasync)
{
struct inode *inode = file->f_mapping->host;
Expand All @@ -386,7 +393,7 @@ static const struct file_operations hostfs_file_fops = {
.write = do_sync_write,
.mmap = generic_file_mmap,
.open = hostfs_file_open,
.release = NULL,
.release = hostfs_file_release,
.fsync = hostfs_fsync,
};

Expand Down

0 comments on commit 65984ff

Please sign in to comment.