Skip to content

Commit 834c7ec

Browse files
kawasakigregkh
authored andcommitted
zonefs: Fix file size of zones in full condition
commit 059c010 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 <shinichiro.kawasaki@wdc.com> Fixes: 8dcc1a9 ("fs: New zonefs file system") Cc: <stable@vger.kernel.org> # 5.6+ Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 4e6e007 commit 834c7ec

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

‎fs/zonefs/super.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,9 @@ static loff_t zonefs_check_zone_condition(struct inode *inode,
250250
}
251251
inode->i_mode &= ~0222;
252252
return i_size_read(inode);
253+
case BLK_ZONE_COND_FULL:
254+
/* The write pointer of full zones is invalid. */
255+
return zi->i_max_size;
253256
default:
254257
if (zi->i_ztype == ZONEFS_ZTYPE_CNV)
255258
return zi->i_max_size;

0 commit comments

Comments
 (0)