diff options
author | Damien Le Moal | 2022-10-25 13:39:31 +0900 |
---|---|---|
committer | Damien Le Moal | 2022-11-16 16:08:28 +0900 |
commit | 7dd12d65ac646046a3fe0bbf9a4e86f4514207b3 (patch) | |
tree | 87bdb6b3eb3647d8595274785f59b74f04dd8519 /fs/utimes.c | |
parent | 094226ad94f471a9f19e8f8e7140a09c2625abaa (diff) |
zonefs: fix zone report size in __zonefs_io_error()
When an IO error occurs, the function __zonefs_io_error() is used to
issue a zone report to obtain the latest zone information from the
device. This function gets a zone report for all zones used as storage
for a file, which is always 1 zone except for files representing
aggregated conventional zones.
The number of zones of a zone report for a file is calculated in
__zonefs_io_error() by doing a bit-shift of the inode i_zone_size field,
which is equal to or larger than the device zone size. However, this
calculation does not take into account that the last zone of a zoned
device may be smaller than the zone size reported by bdev_zone_sectors()
(which is used to set the bit shift size). As a result, if an error
occurs for an IO targetting such last smaller zone, the zone report will
ask for 0 zones, leading to an invalid zone report.
Fix this by using the fact that all files require a 1 zone report,
except if the inode i_zone_size field indicates a zone size larger than
the device zone size. This exception case corresponds to a mount with
aggregated conventional zones.
A check for this exception is added to the file inode initialization
during mount. If an invalid setup is detected, emit an error and fail
the mount (check contributed by Johannes Thumshirn).
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Diffstat (limited to 'fs/utimes.c')
0 files changed, 0 insertions, 0 deletions