diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2023-01-23 15:56:00 +0300 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2023-01-23 15:56:00 +0300 |
commit | 91f67b9a6472a243e2c0630f637ddff0af08038e (patch) | |
tree | 2ba948b5b9a9c13b3494efb3a4006c15db1cbb37 /fs/zonefs/super.c | |
parent | 5670ebf54bd26482f57a094c53bdc562c106e0a9 (diff) | |
parent | 2475bf0250dee99b477e0c56d7dc9d7ac3f04117 (diff) | |
download | linux-91f67b9a6472a243e2c0630f637ddff0af08038e.tar.xz |
Merge remote-tracking branch 'torvalds/master' into perf/core
To pick fixes that went via perf/urgent.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'fs/zonefs/super.c')
-rw-r--r-- | fs/zonefs/super.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/fs/zonefs/super.c b/fs/zonefs/super.c index 2c53fbb8d918..a9c5c3f720ad 100644 --- a/fs/zonefs/super.c +++ b/fs/zonefs/super.c @@ -442,6 +442,10 @@ static int zonefs_io_error_cb(struct blk_zone *zone, unsigned int idx, data_size = zonefs_check_zone_condition(inode, zone, false, false); } + } else if (sbi->s_mount_opts & ZONEFS_MNTOPT_ERRORS_RO && + data_size > isize) { + /* Do not expose garbage data */ + data_size = isize; } /* @@ -805,6 +809,24 @@ static ssize_t zonefs_file_dio_append(struct kiocb *iocb, struct iov_iter *from) ret = submit_bio_wait(bio); + /* + * If the file zone was written underneath the file system, the zone + * write pointer may not be where we expect it to be, but the zone + * append write can still succeed. So check manually that we wrote where + * we intended to, that is, at zi->i_wpoffset. + */ + if (!ret) { + sector_t wpsector = + zi->i_zsector + (zi->i_wpoffset >> SECTOR_SHIFT); + + if (bio->bi_iter.bi_sector != wpsector) { + zonefs_warn(inode->i_sb, + "Corrupted write pointer %llu for zone at %llu\n", + wpsector, zi->i_zsector); + ret = -EIO; + } + } + zonefs_file_write_dio_end_io(iocb, size, ret, 0); trace_zonefs_file_dio_append(inode, size, ret); |