dht: unwind mknod and symlink with their own FOP token - #4757
Open
ThalesBarretto wants to merge 1 commit into
Open
ThalesBarretto wants to merge 1 commit into
ThalesBarretto wants to merge 1 commit into
Conversation
dht_newfile_cbk is the callback of both dht_mknod and dht_symlink but always unwound with DHT_STACK_UNWIND(mknod, ...), and the error path of dht_symlink unwound with the token of the neighbouring dht_link. The token only selects the fop_*_cbk_t typedef STACK_UNWIND_STRICT casts frame->ret to; fop_mknod_cbk_t, fop_symlink_cbk_t and fop_link_cbk_t have the same signature, so there is no behaviour change. What the wrong token defeats is the compile-time check STACK_UNWIND_STRICT exists for. Both came from a310d0e ("cluster/dht: Change STACK_UNWIND to STACK_UNWIND_STRICT", 2009), a bulk conversion that copied the token of the adjacent function. Dispatch on local->fop, the way dht_file_setxattr_cbk, dht_file_removexattr_cbk and dht_common_xattrop_cbk already do for their path/fd pairs. Fixes: gluster#4756 Signed-off-by: Thales Antunes de Oliveira Barretto <thales.barretto.git@gmail.com>
ThalesBarretto
marked this pull request as draft
September 10, 2026 02:05
amarts
approved these changes
Sep 11, 2026
ThalesBarretto
marked this pull request as ready for review
September 11, 2026 13:15
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes: #4756
What
dht_newfile_cbkis the callback of bothdht_mknodanddht_symlink, but it always unwound the frame withDHT_STACK_UNWIND(mknod, ...), and the error path ofdht_symlinkunwound with the token of the neighbouringdht_link. The FOP token only selects whichfop_*_cbk_ttypedefSTACK_UNWIND_STRICTcastsframe->retto;fop_mknod_cbk_t,fop_symlink_cbk_tandfop_link_cbk_thave identical signatures, so there is no behaviourchange — what the wrong token defeats is the compile-time signature check
STACK_UNWIND_STRICTexists for.This dispatches on
local->fopindht_newfile_cbk, the waydht_file_setxattr_cbk,dht_file_removexattr_cbkand
dht_common_xattrop_cbkalready do for their path/fd pairs, and givesdht_symlink's error path its ownsymlinktoken. Both wrong tokens came froma310d0e6b0("cluster/dht: Change STACK_UNWIND toSTACK_UNWIND_STRICT", 2009), a bulk conversion that copied the token of the adjacent function.
Scope / relation to #4755
Behaviour-neutral type-safety cleanup, split out of #4755 (the decommissioned-brick lock-leak fix) so that PR
carries only the functional change. It touches a different region of
dht_newfile_cbkthan #4755 and the two mergein any order. One detail for a careful reader: in
dht_newfile_cbktheop_ret == -1path reachesout:withlocalstill NULL (it is read after the early exit), so the new symlink dispatch is effective on the success path,and the error-path unwind keeps falling through to the identical
mknodcast until #4755'slocalhoist lands —no observable difference either way, the typedefs being identical.
Verification
fop_mknod_cbk_t,fop_symlink_cbk_tandfop_link_cbk_tare byte-identical typedefs, andSTACK_UNWIND_STRICTinvokesframe->retregardless of the token, so nothing changes at runtime — this is atype-clarity / compile-time-check fix.