Skip to contentSkip to conversation

hostfs: Fix writeback of dirty pages

PATCH In review Sjoerd Simons 4 participants 4 messages Nov 5, 2021 – Nov 11, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hostfs: Fix writeback of dirty pages

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.

---

 fs/hostfs/hostfs_kern.c | 3 +++
 1 file changed, 3 insertions(+)
fs/hostfs/hostfs_kern.c +3 -0
index d5c9d886cd9f..ef481c3d9019 100644
@@ -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)
Signature · 7 lines
2.33.1


_______________________________________________
linux-um mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-um
Reviewed-by on v1 1/1
#1 lore raw

Hi Sjoerd,

Quoted 5 lines · Sjoerd Simons

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.

Quoted 7 lines

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.

...replying mainly as I wonder if adding the stable tag in a reply will make the patch appear in stable (obviously once it is in mainline) ? :-)

Quoted 12 lines

---

  fs/hostfs/hostfs_kern.c | 3 +++
  1 file changed, 3 insertions(+)
fs/hostfs/hostfs_kern.c +0 -0
index d5c9d886cd9f..ef481c3d9019 100644

fs/hostfs/hostfs_kern.c static int hostfs_fill_sb_common(struct super_block *sb, void *d, int silent) · line 932

Quoted 9 lines
fs/hostfs/hostfs_kern.c +3 -0
@@ -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)

_______________________________________________
linux-um mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-um

Tested-by on v1 1/1
#2 lore raw
In reply to Sjoerd Simons
Quoted 7 lines · Sjoerd Simons

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.

Quoted 9 lines

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.

Quoted 20 lines

---

 fs/hostfs/hostfs_kern.c | 3 +++

 1 file changed, 3 insertions(+)
fs/hostfs/hostfs_kern.c +3 -0
index d5c9d886cd9f..ef481c3d9019 100644
@@ -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)

Signature · 2 lines
Ritesh Raj Sarraf
Collabora

_______________________________________________
linux-um mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-um

maintainer Acked-by on v1 1/1
#3 lore raw
In reply to Sjoerd Simons
Quoted 24 lines · Sjoerd Simons

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.

---

  fs/hostfs/hostfs_kern.c | 3 +++
  1 file changed, 3 insertions(+)
fs/hostfs/hostfs_kern.c +0 -0
index d5c9d886cd9f..ef481c3d9019 100644

fs/hostfs/hostfs_kern.c static int hostfs_fill_sb_common(struct super_block *sb, void *d, int silent) · line 932

Quoted 9 lines
fs/hostfs/hostfs_kern.c +3 -0
@@ -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)
Signature · 3 lines
Anton R. Ivanov
Cambridgegreys Limited. Registered in England. Company Number 10273661
https://www.cambridgegreys.com/