All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] hostfs: Fix writeback of dirty pages
@ 2021-11-05  8:10 ` Sjoerd Simons
  0 siblings, 0 replies; 7+ messages in thread
From: Sjoerd Simons @ 2021-11-05  8:10 UTC (permalink / raw)
  To: linux-um; +Cc: Anton Ivanov, Jeff Dike, Richard Weinberger, linux-kernel

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>

---

 fs/hostfs/hostfs_kern.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c
index d5c9d886cd9f..ef481c3d9019 100644
--- a/fs/hostfs/hostfs_kern.c
+++ b/fs/hostfs/hostfs_kern.c
@@ -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)
-- 
2.33.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH] hostfs: Fix writeback of dirty pages
@ 2021-11-05  8:10 ` Sjoerd Simons
  0 siblings, 0 replies; 7+ messages in thread
From: Sjoerd Simons @ 2021-11-05  8:10 UTC (permalink / raw)
  To: linux-um; +Cc: Anton Ivanov, Jeff Dike, Richard Weinberger, linux-kernel

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>

---

 fs/hostfs/hostfs_kern.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c
index d5c9d886cd9f..ef481c3d9019 100644
--- a/fs/hostfs/hostfs_kern.c
+++ b/fs/hostfs/hostfs_kern.c
@@ -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)
-- 
2.33.1


_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] hostfs: Fix writeback of dirty pages
  2021-11-05  8:10 ` Sjoerd Simons
@ 2021-11-11 13:26   ` Christopher Obbard
  -1 siblings, 0 replies; 7+ messages in thread
From: Christopher Obbard @ 2021-11-11 13:26 UTC (permalink / raw)
  To: Sjoerd Simons, linux-um
  Cc: Anton Ivanov, Jeff Dike, Richard Weinberger, linux-kernel, stable

Hi Sjoerd,

On 05/11/2021 08:10, Sjoerd Simons wrote:
> 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>

Cc: stable@vger.kernel.org
Reviewed-by: Christopher Obbard <chris.obbard@collabora.com>

...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) ? :-)


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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] hostfs: Fix writeback of dirty pages
@ 2021-11-11 13:26   ` Christopher Obbard
  0 siblings, 0 replies; 7+ messages in thread
From: Christopher Obbard @ 2021-11-11 13:26 UTC (permalink / raw)
  To: Sjoerd Simons, linux-um
  Cc: Anton Ivanov, Jeff Dike, Richard Weinberger, linux-kernel, stable

Hi Sjoerd,

On 05/11/2021 08:10, Sjoerd Simons wrote:
> 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>

Cc: stable@vger.kernel.org
Reviewed-by: Christopher Obbard <chris.obbard@collabora.com>

...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) ? :-)


> 
> ---
> 
>   fs/hostfs/hostfs_kern.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c
> index d5c9d886cd9f..ef481c3d9019 100644
> --- a/fs/hostfs/hostfs_kern.c
> +++ b/fs/hostfs/hostfs_kern.c
> @@ -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
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] hostfs: Fix writeback of dirty pages
  2021-11-05  8:10 ` Sjoerd Simons
@ 2021-11-11 17:10   ` Ritesh Raj Sarraf
  -1 siblings, 0 replies; 7+ messages in thread
From: Ritesh Raj Sarraf @ 2021-11-11 17:10 UTC (permalink / raw)
  To: Sjoerd Simons, linux-um
  Cc: Anton Ivanov, Jeff Dike, Richard Weinberger, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1475 bytes --]

On Fri, 2021-11-05 at 09:10 +0100, Sjoerd Simons wrote:
> 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>
> 

Tested-by: Ritesh Raj Sarraf <ritesh@collabora.com>

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

-- 
Ritesh Raj Sarraf
Collabora

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] hostfs: Fix writeback of dirty pages
@ 2021-11-11 17:10   ` Ritesh Raj Sarraf
  0 siblings, 0 replies; 7+ messages in thread
From: Ritesh Raj Sarraf @ 2021-11-11 17:10 UTC (permalink / raw)
  To: Sjoerd Simons, linux-um
  Cc: Anton Ivanov, Jeff Dike, Richard Weinberger, linux-kernel


[-- Attachment #1.1: Type: text/plain, Size: 1475 bytes --]

On Fri, 2021-11-05 at 09:10 +0100, Sjoerd Simons wrote:
> 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>
> 

Tested-by: Ritesh Raj Sarraf <ritesh@collabora.com>

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

-- 
Ritesh Raj Sarraf
Collabora

[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 152 bytes --]

_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] hostfs: Fix writeback of dirty pages
  2021-11-05  8:10 ` Sjoerd Simons
                   ` (2 preceding siblings ...)
  (?)
@ 2021-11-11 18:57 ` Anton Ivanov
  -1 siblings, 0 replies; 7+ messages in thread
From: Anton Ivanov @ 2021-11-11 18:57 UTC (permalink / raw)
  To: Sjoerd Simons, linux-um; +Cc: Jeff Dike, Richard Weinberger, linux-kernel

On 05/11/2021 08:10, Sjoerd Simons wrote:
> 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>
> 
> ---
> 
>   fs/hostfs/hostfs_kern.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c
> index d5c9d886cd9f..ef481c3d9019 100644
> --- a/fs/hostfs/hostfs_kern.c
> +++ b/fs/hostfs/hostfs_kern.c
> @@ -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)
> 

Acked-By: Anton Ivanov <anton.ivanov@cambridgegreys.com>

-- 
Anton R. Ivanov
Cambridgegreys Limited. Registered in England. Company Number 10273661
https://www.cambridgegreys.com/

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-11-11 18:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-05  8:10 [PATCH] hostfs: Fix writeback of dirty pages Sjoerd Simons
2021-11-05  8:10 ` Sjoerd Simons
2021-11-11 13:26 ` Christopher Obbard
2021-11-11 13:26   ` Christopher Obbard
2021-11-11 17:10 ` Ritesh Raj Sarraf
2021-11-11 17:10   ` Ritesh Raj Sarraf
2021-11-11 18:57 ` Anton Ivanov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.