[PATCH 5.10 619/663] zonefs: Fix file size of zones in full condition

From
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date
2021-03-02 00:03:49
Also in
lkml
Reply to
Greg Kroah-Hartman, 2021-03-02
From: Shin'ichiro Kawasaki <redacted>

commit 059c01039c0185dbee7ed080f1f2bd22cb1e4dab upstream.

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 <redacted>
Fixes: 8dcc1a9d90c1 ("fs: New zonefs file system")
Cc: <redacted> # 5.6+
Signed-off-by: Damien Le Moal <redacted>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 fs/zonefs/super.c |    3 +++
 1 file changed, 3 insertions(+)
--- a/fs/zonefs/super.c
+++ b/fs/zonefs/super.c
@@ -250,6 +250,9 @@ static loff_t zonefs_check_zone_conditio
 		}
 		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;

Thread (673 messages) 673 messages, 6 authors, last reply 2021-03-05
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help