hostfs: Fix writeback of dirty pages
authorSjoerd Simons <sjoerd@collabora.com>
Fri, 5 Nov 2021 08:10:51 +0000 (09:10 +0100)
committerRichard Weinberger <richard@nod.at>
Tue, 21 Dec 2021 20:44:27 +0000 (21:44 +0100)
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>
fs/hostfs/hostfs_kern.c

index d5c9d886cd9f7bc9efdfda6edc2fdf0b4c059b3d..ef481c3d901925cbfc2bd7e6cbd94f2b2672f915 100644 (file)
@@ -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)