Skip to content

Commit ee57892

Browse files
committed
smgr: Make SMgrRelation initialization safer against errors
In case the smgr_open callback failed, the ->pincount field would not be initialized and the relation would not be put onto the unpinned_relns list. This buglet was introduced in 21d9c3e, in 17. Discussion: https://postgr.es/m/3vae7l5ozvqtxmd7rr7zaeq3qkuipz365u3rtim5t5wdkr6f4g@vkgf2fogjirl Backpatch-through: 17
1 parent 09ef2f8 commit ee57892

File tree

1 file changed

+3
-3
lines changed
  • src/backend/storage/smgr

1 file changed

+3
-3
lines changed

src/backend/storage/smgr/smgr.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,12 +231,12 @@ smgropen(RelFileLocator rlocator, ProcNumber backend)
231231
reln->smgr_cached_nblocks[i] = InvalidBlockNumber;
232232
reln->smgr_which = 0; /* we only have md.c at present */
233233

234-
/* implementation-specific initialization */
235-
smgrsw[reln->smgr_which].smgr_open(reln);
236-
237234
/* it is not pinned yet */
238235
reln->pincount = 0;
239236
dlist_push_tail(&unpinned_relns, &reln->node);
237+
238+
/* implementation-specific initialization */
239+
smgrsw[reln->smgr_which].smgr_open(reln);
240240
}
241241

242242
return reln;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy