diff options
author | Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com> | 2021-02-17 18:58:11 +0900 |
---|---|---|
committer | Damien Le Moal <damien.lemoal@wdc.com> | 2021-02-18 08:36:40 +0900 |
commit | 059c01039c0185dbee7ed080f1f2bd22cb1e4dab (patch) | |
tree | ead159acff3dce3461a20a432c05c9768f973e48 /fs | |
parent | 62ab1aadcccd037a7ced4ed99b4d46d2b4190183 (diff) |
zonefs: Fix file size of zones in full condition
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+
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/zonefs/super.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/zonefs/super.c b/fs/zonefs/super.c index 96f0cb0c29aa..2e2a234d387b 100644 --- a/fs/zonefs/super.c +++ b/fs/zonefs/super.c @@ -256,6 +256,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; |