Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
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

+3-3
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)