summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorDamien Le Moal <damien.lemoal@opensource.wdc.com>2022-06-02 21:33:25 +0900
committerDamien Le Moal <damien.lemoal@opensource.wdc.com>2022-06-08 15:38:44 +0900
commit96eca145cb51f4e0132a3ea8066dfc6fdf75f24a (patch)
tree7bb705027e2513d25ca5ab1cdfbbc3a2b731877b /fs
parenta2a513be7139b279f1b5b2cee59c6c4950c34346 (diff)
downloadlinux-rpi-96eca145cb51f4e0132a3ea8066dfc6fdf75f24a.tar.gz
linux-rpi-96eca145cb51f4e0132a3ea8066dfc6fdf75f24a.tar.bz2
linux-rpi-96eca145cb51f4e0132a3ea8066dfc6fdf75f24a.zip
zonefs: Do not ignore explicit_open with active zone limit
A zoned device may have no limit on the number of open zones but may have a limit on the number of active zones it can support. In such case, the explicit_open mount option should not be ignored to ensure that the open() system call activates the zone with an explicit zone open command, thus guaranteeing that the zone can be written. Enforce this by ignoring the explicit_open mount option only for devices that have both the open and active zone limits equal to 0. Fixes: 87c9ce3ffec9 ("zonefs: Add active seq file accounting") Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'fs')
-rw-r--r--fs/zonefs/super.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/zonefs/super.c b/fs/zonefs/super.c
index ecce84909ca1..123464d2145a 100644
--- a/fs/zonefs/super.c
+++ b/fs/zonefs/super.c
@@ -1085,7 +1085,8 @@ static int zonefs_seq_file_write_open(struct inode *inode)
if (sbi->s_mount_opts & ZONEFS_MNTOPT_EXPLICIT_OPEN) {
- if (wro > sbi->s_max_wro_seq_files) {
+ if (sbi->s_max_wro_seq_files
+ && wro > sbi->s_max_wro_seq_files) {
atomic_dec(&sbi->s_wro_seq_files);
ret = -EBUSY;
goto unlock;
@@ -1785,8 +1786,10 @@ static int zonefs_fill_super(struct super_block *sb, void *data, int silent)
blkdev_nr_zones(sb->s_bdev->bd_disk));
if (!sbi->s_max_wro_seq_files &&
+ !sbi->s_max_active_seq_files &&
sbi->s_mount_opts & ZONEFS_MNTOPT_EXPLICIT_OPEN) {
- zonefs_info(sb, "No open zones limit. Ignoring explicit_open mount option\n");
+ zonefs_info(sb,
+ "No open and active zone limits. Ignoring explicit_open mount option\n");
sbi->s_mount_opts &= ~ZONEFS_MNTOPT_EXPLICIT_OPEN;
}