All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] zonefs: Fix file size of zones in full condition
@ 2021-02-17  9:58 Shin'ichiro Kawasaki
  2021-02-17 23:41 ` Damien Le Moal
  0 siblings, 1 reply; 2+ messages in thread
From: Shin'ichiro Kawasaki @ 2021-02-17  9:58 UTC (permalink / raw)
  To: Damien Le Moal; +Cc: linux-fsdevel, Johannes Thumshirn, Shinichiro Kawasaki

Per ZBC/ZAC/ZNS specifications, write pointers may not have valid values
when zones are in full condition. However, when zonefs mounts a zoned
block device, zonefs refers write pointers to set file size even when
the zones are in full condition. This results in wrong file size. To fix
this, refer maximum file size in place of write pointers for zones in
full condition.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Fixes: 8dcc1a9d90c1 ("fs: New zonefs file system")
Cc: <stable@vger.kernel.org> # 5.6+
---
 fs/zonefs/super.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/zonefs/super.c b/fs/zonefs/super.c
index bec47f2d074b..3fe933b1010c 100644
--- a/fs/zonefs/super.c
+++ b/fs/zonefs/super.c
@@ -250,6 +250,9 @@ static loff_t zonefs_check_zone_condition(struct inode *inode,
 		}
 		inode->i_mode &= ~0222;
 		return i_size_read(inode);
+	case BLK_ZONE_COND_FULL:
+		/* The write pointer of full zones is invalid. */
+		return zi->i_max_size;
 	default:
 		if (zi->i_ztype == ZONEFS_ZTYPE_CNV)
 			return zi->i_max_size;
-- 
2.28.0


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

* Re: [PATCH] zonefs: Fix file size of zones in full condition
  2021-02-17  9:58 [PATCH] zonefs: Fix file size of zones in full condition Shin'ichiro Kawasaki
@ 2021-02-17 23:41 ` Damien Le Moal
  0 siblings, 0 replies; 2+ messages in thread
From: Damien Le Moal @ 2021-02-17 23:41 UTC (permalink / raw)
  To: Shinichiro Kawasaki; +Cc: linux-fsdevel, Johannes Thumshirn

On 2021/02/17 18:58, Shin'ichiro Kawasaki wrote:
> Per ZBC/ZAC/ZNS specifications, write pointers may not have valid values
> when zones are in full condition. However, when zonefs mounts a zoned
> block device, zonefs refers write pointers to set file size even when
> the zones are in full condition. This results in wrong file size. To fix
> this, refer maximum file size in place of write pointers for zones in
> full condition.
> 
> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
> Fixes: 8dcc1a9d90c1 ("fs: New zonefs file system")
> Cc: <stable@vger.kernel.org> # 5.6+
> ---
>  fs/zonefs/super.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/fs/zonefs/super.c b/fs/zonefs/super.c
> index bec47f2d074b..3fe933b1010c 100644
> --- a/fs/zonefs/super.c
> +++ b/fs/zonefs/super.c
> @@ -250,6 +250,9 @@ static loff_t zonefs_check_zone_condition(struct inode *inode,
>  		}
>  		inode->i_mode &= ~0222;
>  		return i_size_read(inode);
> +	case BLK_ZONE_COND_FULL:
> +		/* The write pointer of full zones is invalid. */
> +		return zi->i_max_size;
>  	default:
>  		if (zi->i_ztype == ZONEFS_ZTYPE_CNV)
>  			return zi->i_max_size;
> 

Applied to for-5.12. Thanks !


-- 
Damien Le Moal
Western Digital Research

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

end of thread, other threads:[~2021-02-17 23:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-17  9:58 [PATCH] zonefs: Fix file size of zones in full condition Shin'ichiro Kawasaki
2021-02-17 23:41 ` Damien Le Moal

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.