[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 0/5] file-posix: Clean up and fix zoned checks
From: |
Sam Li |
Subject: |
Re: [PATCH 0/5] file-posix: Clean up and fix zoned checks |
Date: |
Fri, 25 Aug 2023 00:53:50 +0800 |
Hi Hanna,
Hanna Czenczek <hreitz@redhat.com> 于2023年8月24日周四 23:53写道:
>
> Hi,
>
> As presented in [1] there is a bug in the zone code in raw_co_prw(),
> specifically we don’t check whether there actually is zone information
> before running code that assumes there is (and thus we run into a
> division by zero). This has now also been reported in [2].
Thanks for catching the bugs and your work.
>
> I believe the solution [1] is incomplete, though, which is why I’m
> sending this separate series: I don’t think checking bs->wps and/or
> bs->bl.zone_size to determine whether there is zone information is
> right; for example, we do not have raw_refresh_zoned_limits() clear
> those values if on a refresh, zone information were to disappear.
>
> It is also weird that we separate checking bs->wps and bs->bl.zone_size
> at all; raw_refresh_zoned_limits() seems to intend to ensure that either
> we have information with non-NULL bs->wps and non-zero bs->bl.zone_size,
> or we don’t.
>
> I think we should have a single flag that tells whether we have valid
> information or not, and it looks to me like bs->bl.zoned != BLK_Z_NONE
> is the condition that fits best.
The former way only checks zone information when it is being used to
avoid divide-by-zero or nullptr errors. Putting the error path with
non-zoned model implies a zoned device must have non-zero zone size
and allocated write pointers. Given that no other parts are changing
the zone_size to 0 and free wps, It does simplify the code path.
Thanks,
Sam
- [PATCH 0/5] file-posix: Clean up and fix zoned checks, Hanna Czenczek, 2023/08/24
- [PATCH 1/5] file-posix: Clear bs->bl.zoned on error, Hanna Czenczek, 2023/08/24
- [PATCH 2/5] file-posix: Check bs->bl.zoned for zone info, Hanna Czenczek, 2023/08/24
- [PATCH 4/5] file-posix: Simplify raw_co_prw's 'out' zone code, Hanna Czenczek, 2023/08/24
- [PATCH 3/5] file-posix: Fix zone update in I/O error path, Hanna Czenczek, 2023/08/24
- [PATCH 5/5] tests/file-io-error: New test, Hanna Czenczek, 2023/08/24
- Re: [PATCH 0/5] file-posix: Clean up and fix zoned checks,
Sam Li <=