Skip to content

Commit

Permalink
hostfs: Fix writeback of dirty pages
Browse files Browse the repository at this point in the history
Hostfs was not setting up the backing device information, which means it
uses the noop bdi. The noop bdi does not have the writeback capability
enabled, which in turns means  dirty pages never got written back to
storage.

In other words programs using mmap to write to files on  hostfs never
actually got their data written out...

Fix this by simply setting up the bdi with default settings as all the
required code for writeback is already in place.

Signed-off-by: Sjoerd Simons <sjoerd@collabora.com>
Reviewed-by: Christopher Obbard <chris.obbard@collabora.com>
Tested-by: Ritesh Raj Sarraf <ritesh@collabora.com>
Acked-By: Anton Ivanov <anton.ivanov@cambridgegreys.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
  • Loading branch information
Sjoerd Simons authored and Richard Weinberger committed Dec 21, 2021
1 parent 9b0da3f commit ce72750
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions fs/hostfs/hostfs_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -924,6 +924,9 @@ static int hostfs_fill_sb_common(struct super_block *sb, void *d, int silent)
sb->s_op = &hostfs_sbops;
sb->s_d_op = &simple_dentry_operations;
sb->s_maxbytes = MAX_LFS_FILESIZE;
err = super_setup_bdi(sb);
if (err)
goto out;

/* NULL is printed as '(null)' by printf(): avoid that. */
if (req_root == NULL)
Expand Down

0 comments on commit ce72750

Please sign in to comment.