Fix vitastor-cli rm-data removing data outside the requested range or pool #93
Closed
koolkhel
wants to merge 2 commits from
koolkhel/vitastor:cli-rm-data into master
pull from: koolkhel/vitastor:cli-rm-data
merge into: vitalif:master
vitalif:master
vitalif:fatal-error-hook
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:cli-rm-data"
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
rm-data could remove data other than the user asked for, and report success:
--min-offset/--max-offsetwere read withuint64_value(), which gives 0 for8M, and 0 means "from the start" / "to the end". On a 32 MiB image,rm-data --pool 1 --inode 1 --min-offset 8M --max-offset 16Mprinted "Done" and zeroed all 32 MiB. Reversed ranges,--max-offset -8M,--max-offset 0and an overflowing value did the same. Offsets are now decimal or 0x hex with an optional K/M/G/T suffix, and an invalid value, an empty or reversed range or an explicit--max-offset 0fail with EINVAL before anything is removed. Numeric values from internal callers (modify --resize,rm) work as before.--pool <name> --inode <inode with another pool's bits>removed data in the other pool;--pool 2 --inode 0x1"removed" inode 0 and exited 0. Pool names are now resolved likelsdoes (ENOENT for an unknown one), and--inodemust be decimal or 0x hex.The second commit reuses the number parser and the EINVAL checks of the first.
Tested: tests/test_rm.sh, extended for both commits (the second with a second pool); each part fails without its fix and passes with it. test_rm_degraded still passes.
Contributor Name
Yury Luneff (MIND Software LLC, https://mindsw.io)
CLA
А вот это мержить не хочу, rm-data это низкоуровневая/внутренняя команда и никто не заявлял, что она должна поддерживать всякий сложный синтаксис
Единственное что добавил - валидацию численных значений - если уж передали нечисловое, будет EINVAL
Pull request closed