On 2018-08-30 19:02:15 -0400, Tom Lane wrote:
> Andres Freund <andres@anarazel.de> writes:
> > It certainly should be warned about. Practically I don't think it's a
> > problem, because we pretty much always operate on a copy of the page
> > when writing out, as otherwise concurrently set hint bits would be
> > troublesome.
>
> The write end of things is not a problem IMO, since presumably the caller
> would be about to overwrite the checksum field anyway. The issue is for
> reading and/or verifying, where it's much less obvious that clobbering
> the page image is safe.
With "reading" you mean putting the page into the buffercache? If so,
that should be ok, the page isn't yet accessible (BM_VALID isn't set).
I don't think it's possible to do verification from the page in s_b,
because we don't keep the checksum current, so there should never be
calls to do so.
But we probably should still add a comment making clear that the
function modifies the buffer temporarily.
Greetings,
Andres Freund