osd: Fix scrub object state pins: crash when the object becomes clean, leak in scrub_recalc_state #158
Open
koolkhel
wants to merge 3 commits from
koolkhel/vitastor:scrub-recalc-pin into master
pull from: koolkhel/vitastor:scrub-recalc-pin
merge into: vitalif:master
vitalif:master
vitalif:primary-stickiness
vitalif:libvfn
vitalif:canceling
vitalif:immediate-repeering
vitalif:rdma-close-tcp
vitalif:use-degraded-writes
vitalif:fix-write-delete-flow
vitalif:openssl-3.0.12
vitalif:openssl-capture-secrets
vitalif:ignore-small-rdma-end
vitalif:encrypt-batch
vitalif:faster-peering-calc
vitalif:http-hello
vitalif:xxh3-bench
vitalif:create-user-etcd-based
vitalif:aesxts_streaming_nosupport
vitalif:refactor-heap-continue-write
vitalif:ston3lu-patch-0127
vitalif:rdma-credits
vitalif:heap-meta
vitalif:sendmsg-zc-no-more-error
vitalif:fix-clear-refs
vitalif:veeam-trick
vitalif:test-etcd-schizo
vitalif:test
vitalif:test1
vitalif:test2
vitalif:cow-meta
vitalif:kv-readahead
vitalif:qemu-fix-crash-idea
vitalif:eventloop-auto-init-trigger
vitalif:hugo-docs
vitalif:node-mutex-and-postpone
vitalif:check-writeback
vitalif:msgr-iothreads-v2
vitalif:antietcd
vitalif:rel-1.4
vitalif:test-fix-ec-unknown-state-51
vitalif:kv-update
vitalif:kv-debug
vitalif:hotfix-1.2.0
vitalif:rdma-simple-nodp
vitalif:zerocopy-tcp-send
vitalif:csi-staging
vitalif:hotfix-1.1.0
vitalif:hotfix-1.0.0
vitalif:fsync-feedback
vitalif:cached-reads
vitalif:qemu-send-loop
vitalif:test-double-alloc
vitalif:hier-failure-domains
vitalif:mon-self-restart
vitalif:epoch-deletions
vitalif:rdma-flow-control
vitalif:csi-use-vitastor-cli
vitalif:rdma-v2
vitalif:etcd-hide-base64
vitalif:lrc-matrix
vitalif:rm-left-on-dead
vitalif:nfs-proxy-old
vitalif:non-odp-rdma
vitalif:test-zctr
vitalif:separate-data-connections
vitalif:sec_osd_msgr
vitalif:test-assert
vitalif:nbd-vmsplice
vitalif:allow-etcd-address-option
vitalif:rdma-zerocopy
vitalif:rel-0.5
vitalif:openonload
vitalif:sync-io-test
vitalif:trace-sync
vitalif:trace-sqes
vitalif:test-submit-and-wait
vitalif:test-sq-poll
vitalif:blocking-uring-test
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
No description provided.
Delete Branch "koolkhel/vitastor:scrub-recalc-pin"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
Two follow-ups to
3bf0b45a("Pin object state while reading"):ref=truetomark_object(), which increments the ref count of the new state.add_object_to_set()returns NULL when the object becomes clean, somark_object()dereferences NULL. One way to get there: a scrub of a misplaced object finds its extra copy outside the PG gone, the copy is dropped, and the object is clean. Reads and writes that mark objects corrupted withref=truego the same way. Fix: skip the increment for a NULL state; all callers already handle NULL.scrub_recalc_state(). It still calledmark_object()withref=false. When it swapped states, the pin stayed on the old state, which then leaked with no objects. The final deref incontinue_primary_scrub()then decremented the new, unpinned state, so itsref_countwrapped around, or a write to the same object lost its pin. Fix:ref=true, as in the other scrub path.Tested: new
osd_testcases.test_scrub_drops_gone_misplaced_copysegfaults on master.test_scrub_recalc_state_pin(degraded)fails its "no pin left" assertion on master.test_scrub_recalc_state_pin(clean)segfaults with only theref=truechange.osd_testpasses with the fix.The second commit adds a check to
test_read_enoent_without_racing_op_marks_corruptedthat a failed primary read leaves no object state pinned, so the read-path pin from3bf0b45ahas a test too. It fails if the read never drops its pin.capturing_bs_t::read_bitmap()in the test fixture can now report a version, so the recalculation can find an older local copy.Contributor Name
Yury Luneff (MIND Software LLC, https://mindsw.io)
CLA
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.