├── .gitignore ├── .gitmodules ├── COPYING ├── INSTALL ├── LICENSE ├── LICENSE.txt ├── Makefile ├── Makefile.win ├── README.md ├── TODO ├── WHATSNEW.md ├── create-patch ├── crypto ├── .gitignore └── readme.txt ├── howto ├── inno-setup ├── .gitignore ├── 0001-Added-install-flag-to-pnputil-call-in-inno-setup.patch ├── README.txt ├── about-windrbd.txt ├── cygwin-binaries │ ├── bash.exe │ ├── cat.exe │ ├── chmod.exe │ ├── cp.exe │ ├── cygattr-1.dll │ ├── cygbz2-1.dll │ ├── cygiconv-2.dll │ ├── cygintl-8.dll │ ├── cygncursesw-10.dll │ ├── cygpath.exe │ ├── cygreadline7.dll │ ├── cygrunsrv.exe │ ├── cygwin1.dll │ ├── cygz.dll │ ├── cygzstd-1.dll │ ├── dumper.exe │ ├── ls.exe │ ├── mkdir.exe │ ├── mv.exe │ ├── sed.exe │ ├── sync.exe │ └── unzip.exe ├── deploy-with-ssh-ports.sh ├── deploy.sh ├── install-windrbd-1.1.0-rc2.exe-self-signed ├── install-windrbd.cmd ├── modpath.iss ├── oldver.iss ├── service-library.iss ├── services.iss ├── sysroot │ ├── README-windrbd.txt │ └── etc │ │ ├── drbd.conf │ │ └── drbd.d │ │ ├── global_common.conf │ │ └── windrbd-sample.res ├── uninstall-windrbd.cmd ├── update-cygwin-binaries.sh ├── windrbd.ico └── windrbd.iss ├── misc ├── converted-sources-gitignore ├── drbd.cgi ├── drbdadm-up-w0 ├── extract-ioctls.sh ├── extract-warnings.sh ├── grep-spinlock-errors.sh ├── ipxe-windrbd.pxe ├── makelogs │ ├── makelog-1036-warnings │ ├── makelog-1293-warnings │ ├── makelog-625-warnings │ ├── makelog-663-warnings │ └── makelog-999-warnings ├── ms-clustermanager │ ├── drbdadm.vbs │ ├── view-event-log.sh │ └── windrbd-cluster-manager-role.vbs ├── netlink-packets-up ├── olddoc │ ├── FEATURES │ ├── KNOWN-BUGS │ ├── KNOWN-BUGS-2020 │ ├── README.md.old2021 │ ├── TESTS │ ├── TODO.pm │ ├── WinDRBDReleaseDescriptionBeta1.txt │ ├── WinDRBDReleaseDescriptionBeta2.txt │ ├── WinDRBDReleaseDescriptionBeta3.txt │ ├── WinDRBDReleaseDescriptionBeta4.txt │ ├── WinDRBDReleaseDescriptionBeta5.txt │ ├── implementation-status.txt │ └── roadmap-to-1.0.txt ├── show-drbd-diff-stat.sh └── show-lock-time.sh ├── ms-cl-jt-opennebula-vm.cmd ├── ms-cl-jt-opennebula2022-vm.cmd ├── ms-cl-jt-server2016.cmd ├── ms-cl-jt-win10-32bit.cmd ├── ms-cl-jt-win10.cmd ├── ms-cl-jt-win10ent-2020.cmd ├── ms-cl-jt-win7.cmd ├── ms-cl-jt-wine.cmd ├── transform ├── transform.d ├── 000-remove-__must_hold.sh ├── 001-remove-other-preproc.pl ├── 100-undef_NOTHING.patch ├── 103-expect-and-the-polymorphic-printk.patch ├── 105-resource-add-wrcu.patch ├── 109-kthread_create_drbd_main.patch ├── 110-drbd_bitmap_C.patch ├── 111-kthread_drbd_int.patch ├── 112-get_ldev_if_state_drbd_int.patch ├── 113-typof_drbd_state.patch ├── 114-stable_state_change_drbd_state_H.patch ├── 115-stable_state_change_drbd_state_C.patch ├── 116-typecheck-in-dagtag_newer.patch ├── 117-drbd_req-C.patch ├── 118-drbd_int-H.patch ├── 119-assign_p_sizes_qlim_drbd_main.patch ├── 120-drbd_transport-C.patch ├── 121-dec_rs_pending_drbd_int-H.patch ├── 122-drbd_sender-all_zero-always-false-was-122-all_zero.patch ├── 123-drbd_vli-compiler-warning.patch ├── 124-drbd_transport_H.patch ├── 125-drbd_receiver_C.patch ├── 126-drbd_sender-Don-t-do-csums-was-126-disable_crypt_drb.patch ├── 127-schedule_drbd_sender_C.patch ├── 129-drbd_main_C-move-drbd_open.patch ├── 130-drbd_int_H-move-drbd_open.patch ├── 131-crc32_drbd_actlog_C.patch ├── 133-rm-obvious_drbd_init-drbd_main_C.patch ├── 134-set_resource_options_drbd_main_C.patch ├── 135-drbd_nl_C.patch ├── 136-genl_magic_func-genl_register_mc_group_H.patch ├── 137-QUEUE_FLAG_DISCARD-drbd_receiver_C.patch.x ├── 140-some-bio-BDI-drbd_main_C.patch ├── 141-drbd_main_C-struct.retry-worker.patch ├── 143-drbd_meta_data_H-4k-alignment.patch ├── 144-drbd_main_C-alloc_ordered_workqueue.patch ├── 146-drbd_main_C-initialize-var.patch ├── 147-drbd_nl_C-vsnprintf.patch ├── 148-drbd_main_C-drbd_cleanup_by_win_shutdown.patch ├── 200-idr_for_each_entry-type.pl ├── 202-except-is-a-keyword.pl ├── 203-list_first_or_null_rcu-return.pl ├── 204-timer_fn-arguments.pl ├── 206-empty-structures-initialize.pl ├── 207-ternary-with-2-terms.pl ├── 209-macro-giving-code-as-expr.pl ├── 211-macro-varargs.pl ├── 212-kzalloc-tag.pl ├── 213-bitops-include.pl ├── 215-drbd_protocol_h-packed.pl ├── 216-i_size_read.pl ├── 217-cmpxchg-to-atomic.pl ├── 218-inject-includes.pl ├── 219-tr_printk-and-rcu_read_lock.pl ├── 220-kmem-cache-size.sh ├── 220-set_capacity.pl ├── 221-kobject_uevent.pl ├── 222-types.sh ├── 223-bitmap.sh ├── 224-zero-sized-array-in-struct.sh ├── 226-list_next_entry.pl ├── 300-wait_event_timeout-return.cocci ├── 301-rcu_read_lock.cocci ├── 400-rcu-unbalanced.sh ├── 500-drbd_main-drbd_thread_setup-nonstatic.patch ├── 501-drbd-int-declare-drbd_thread_setup.patch ├── 502-add-ktime.h-to-drbd_int-includes.patch ├── 505-changes-to-main-for-new-architecture.patch ├── 507-free-mempool-after-bio-put.patch ├── 508-Handle-out-no-device-kmalloc-error.patch ├── 510-Removed-PVOLUME_EXTENSION-from-drbd_main.c.patch ├── 511-Make-bm_op-return-ULONG_PTR.patch ├── 512-Exporting-the-drbd_cleanup-function.patch ├── 513-Enabled-assign_p_sizes_qlim-again.patch ├── 514-wdrbd_get_capacity-windrbd_get_capacity.patch ├── 515-win_drbd_thread_setup-windrbd_thread_setup.patch ├── 516-Mount-point-flag-in-device_conf.patch ├── 517-Windows-max-pathname-define.patch ├── 518-Call-windrbd_mount-on-device-creation.patch ├── 519-Mount-windrbd-device-at-end-of-drbd_create_device.patch ├── 520-Disable-unintialized-local-variable-warning.patch ├── 522-drbd-create-device-fixes.patch ├── 525-Only-store-mount-point-on-drbdadm-create-minor.patch ├── 528-Also-cleaning-up-submit-workqueue.patch ├── 530-Ignore-signed-unsigned-mismatch-in-drbd_strings.patch ├── 531-Allow-for-pages-greater-than-PAGE_SIZE.patch ├── 532-Moved-netlink.c_inc-to-seperate-file.patch ├── 534-Undone-two-patches-by-mantech-that-broke-user-mode-h.patch ├── 535-Removed-ManTech-s-create-thread-code-reverted-to-ori.patch ├── 537-Removed-unneccessary-fields-in-struct-drbd_thread.patch ├── 538-Un-inlined-stable_state_change-function.patch ├── 539-Un-inlined-stable_state_change-function-header-patch.patch ├── 540-Removed-setting-mount_point-in-drbd_create_device.patch ├── 541-Removed-max-path-define.patch ├── 542-Removed-mount-point-field-from-netlink.patch ├── 543-Changed-default-of-user-mode-helper.patch ├── 550-New-old-patch-for-bitmap-was-in-110-drbd_bitmap_C.pa.patch ├── 552-New-old-patch-do-not-create-proc-drbd-was-133-rm-obv.patch ├── 553-New-old-patch-was-149-drbd_main_C-no_biosets.patch.patch ├── 554-bitmap-free-mempool-after-bio-put-was-507-free-mempo.patch ├── 555-Do-not-use-__reserved-as-identifier.patch ├── 557-Redone-missing-patch-from-505-create_device-patches.patch ├── 561-Disabled-most-of-debugfs-patch-for-DRBD-9.0.16.patch ├── 562-Do-not-use-zero-copy-for-sending-data-packets.patch ├── 563-Made-netlink-family-non-static.patch ├── 571-drbd_transport_tcp-tmp-patch-for-weird-wait_event_in.patch ├── 572-drbd_transport_tcp-added-type-of-iterator-to-list_xx.patch ├── 573-drbd_transport_tcp-free_page-takes-a-pointer-as-argu.patch ├── 574-drbd_transport_tcp-casts-to-char-from-void-where-nee.patch ├── 575-tcp_transport-Always-return-empty-buffer-on-MSG_DONT.patch ├── 576-drbd_transport_tcp-Currently-not-supporting-unread_r.patch ├── 577-drbd_transport_tcp-forward-buffer-sizes-to-wsk-layer.patch ├── 578-Use-Linux-ish-kernel-API-for-setting-REUSE_ADDR-kern.patch ├── 579-Use-WinDRBD-specific-SOCK_LISTEN-socket-type.patch ├── 581-Again-use-kernel_setsockopt-for-setting-REUSEADDR.patch ├── 584-drbd_transport_tcp-hint-NOSPACE-does-not-exist-on-Wi.patch ├── 585-drbd_transport_tcp-debugfs-again-unread-unacked-stat.patch ├── 586-drbd_transport_tcp-Made-initialize-cleanup-function-.patch ├── 587-Use-different-identifiers-for-return-value-and-timeo.patch ├── 591-First-patch-of-fixing-spinlocks.patch ├── 592-spin_lock_irq-spin_lock_irqsave-for-drbd_nl.c.patch ├── 593-spin_lock_irq-spin_lock_irqsave-for-drbd_req.c.patch ├── 594-spin_lock_irq-spin_lock_irqsave-for-drbd_sender.c.patch ├── 596-spin_lock_irq-spin_lock_irqsave-for-drbd_transport_t.patch ├── 597-More-spin_lock_irqsave-for-drbd_main.c.patch ├── 599-spin_lock_irqsave-for-some-functions-in-drbd_req.c.patch ├── 603-SCSI-Set-event-as-soon-as-there-is-a-valid-size-of-t.patch ├── 604-Made-try_to_promote-non-static.patch ├── 605-Rescan-Windows-PnP-bus-at-the-end-of-device-creation.patch ├── 606-drbd_main-Use-new-prepare_to_wait-implementation.patch ├── 607-drbd_req-Use-new-prepare_to_wait-implementation.patch ├── 608-drbd_receiver-Use-new-prepare_to_wait-implementation.patch ├── 609-drbd_sender-Use-new-prepare_to_wait-implementation.patch ├── 610-TCP-return-value-of-wait-macro-is-now-EINTR-when-a-s.patch ├── 611-drbd_main.c-Print-from-where-schedule-is-called.patch ├── 612-drbd_receiver.c-Print-from-where-schedule-is-called.patch ├── 613-drbd_sender.c-Print-from-where-schedule-is-called.patch ├── 614-drbd_req.c-Print-from-where-schedule-is-called.patch ├── 615-stable-state-change-return.cocci ├── 616-Attempt-to-fix-stable-state-change.patch ├── 617-Attempt-to-fix-stable-state-change.patch ├── 620-drbd_state-fixed-stable_state_change.patch ├── 621-CP-transport-dtt_wait_for_connect-always-return-EAG.patch ├── 622-drbd_main-restored-original-schedule-interface.patch ├── 623-drbd_receiver-restored-original-schedule-interface.patch ├── 624-drbd_req-restored-original-schedule-interface.patch ├── 625-drbd_sender-restored-original-schedule-interface.patch ├── 626-Check-for-device-NULL-in-tl_mark_for_resend_by_conne.patch ├── 628-drbd_int-include-kconfig.h.patch ├── 630-drbd_sender-include-type-in-from_timer-macro.patch ├── 631-drbd_sender-more-types-for-from_timer-macro.patch ├── 632-drbd_receiver-type-for-from_timer.patch ├── 633-drbd_receiver-initalize-iter.patch ├── 634-drbd_req-type-for-from_timer.patch ├── 635-drbd_main-removed-a-const-qualifier.patch ├── 636-drbd_main-type-for-from_timer-macro.patch ├── 637-drbd_main-initialize-iter.patch ├── 638-TCP-transport-initialize-iter.patch ├── 639-drbd_main-converted-to-old-bio_for_each_segment.patch ├── 640-drbd_receiver-converted-to-old-bio_for_each_segment.patch ├── 641-drbd_transport_tcp-converted-to-old-bio_for_each_seg.patch ├── 642-Run-ack-receiver-with-real-time-priority.patch ├── 643-drbd_sender-enabled-drbd_csums_.-functions.patch ├── 645-spin_lock_irqrestore.cocci ├── 646-init_transport-function.patch ├── 647-drbd_main-spin_lock_irq-spin_lock_irqsave-in-drbd_cr.patch ├── 648-drbd_main-spin_lock_irqsave-in-copy_bitmap-forget_bi.patch ├── 649-drbd_receiver-spin_lock_irqsave-in-failure-path.patch ├── 650-drbd_receiver-spin_lock_irqsave-around-abort_local_t.patch ├── 651-drbd_transport_tcp-spin_lock_irqsave-instead-of-writ.patch ├── 652-drbd_debugfs-spin_lock_irqsave.patch ├── 653-drbd_transport-spin_lock_bh-spin_lock_irqsave.patch ├── 655-drbd_actlog-Always-use-KIRQL-as-datatype-for-IRQ-fla.patch ├── 656-drbd_bitmap-Always-use-KIRQL-as-datatype-for-IRQ-fla.patch ├── 657-drbd_int.h-Always-use-KIRQL-as-datatype-for-IRQ-flag.patch ├── 658-drbd_main-Always-use-KIRQL-as-datatype-for-IRQ-flags.patch ├── 659-drbd_nl-Always-use-KIRQL-as-datatype-for-IRQ-flags.patch ├── 660-drbd_receiver-Always-use-KIRQL-as-datatype-for-IRQ-f.patch ├── 661-drbd_sender-Always-use-KIRQL-as-datatype-for-IRQ-fla.patch ├── 662-drbd_state.c-Always-use-KIRQL-as-datatype-for-IRQ-fl.patch ├── 663-drbd_state.h-Always-use-KIRQL-as-datatype-for-IRQ-fl.patch ├── 664-drbd_transport_tcp.c-Always-use-KIRQL-as-datatype-fo.patch ├── 665-kref_debug-Always-use-KIRQL-as-datatype-for-IRQ-flag.patch ├── 666-drbd_req-Always-use-KIRQL-as-datatype-for-IRQ-flags.patch ├── 667-Do-not-use-struct_size-macro.patch ├── 671-Pass-KIRQL-flags-argument-to-abort.-function.patch ├── 672-Reverted-to-old-blk_alloc_queue-interface.patch ├── 673-drbd_main.c-Eliminate-spin_lock_irq-from-drbd_wait_m.patch ├── 674-drbd_receiver.c-Eliminate-spin_lock_irq-from-drbd_wa.patch ├── 675-drbd_int.h-Eliminate-spin_lock_irq-from-drbd_wait_mi.patch ├── 676-drbd_receiver.c-Eliminate-spin_lock_irq-from-drbd_re.patch ├── 677-drbd_req.c-Eliminate-spin_lock_irq-from-complete_con.patch ├── 678-drbd_sender.c-Eliminate-spin_lock_irq-from-tl_mark_f.patch ├── 679-drbd_release-make-sure-open-counts-don-t-get-negativ.patch ├── 680-drbd_transport-patch-set-for-speeding-up-sync-then-S.patch ├── 681-drbd_receiver-patch-set-for-speeding-up-sync-then-Sy.patch ├── 682-drbd_sender-patch-set-for-speeding-up-sync-then-Sync.patch ├── 683-drbd_transport_tcp-patch-set-for-speeding-up-sync-th.patch ├── 684-drbd_receiver.c-Wait-for-all-bios-to-complete-on-dis.patch ├── 685-Have-WinDRBD-hooks-when-changing-role.patch ├── 686-gendisk-now-has-a-reference-to-block_device.patch ├── 687-Added-this_bdev-member-to-drbd_device-struct.patch ├── 688-Use-pp_-fields-from-resource.patch ├── 689-More-drbd_receiver-patches.patch ├── 691-drbd_nl-initialize-variables.patch ├── 692-drbd_transport_tcp-patched-in-one-variable-again.patch ├── 694-set_my_capacity-set-block-device-size-directly.patch ├── 695-commented-out-opener-timestamp-code.patch ├── 696-Commented-out-module-parameter-code.patch ├── 699-Added-type-to-list-iterator.patch ├── 700-struct-opener-as-list-iterator-type.patch ├── 701-Fixed-wait_event-macro-call.patch ├── 702-Commented-out-fsync_bdev-code.patch ├── 703-Silence-an-unintialized-variable-warning.patch ├── 704-Do-not-call-sk_write_space.patch ├── 705-drbd_main-Do-not-use-__free_pages-use-put_page-to-ho.patch ├── 706-drbd_bitmap-Do-not-use-__free_pages-use-put_page-to-.patch ├── 707-drbd_bitmap-free-page-via-put_page-instead-of-freein.patch ├── 708-Use-windrbd_ioctl-from-drbd-headers.patch ├── 709-drbd_main-req_lock-spin_lock_irq-to-spin_lock_irqsav.patch ├── 710-drbd_sender-Use-KIRQL-for-IRQ-flags-also-in-new-code.patch ├── 711-drbd_main-initialize-devices_spin_lock-in-init-funct.patch ├── 712-drbd_main.c-use-req_lock_flags-for-unlocking-req_loc.patch ├── 713-drbd_main.c-There-is-no-DEFINE_MUTEX-either.patch ├── 714-drbd_main.c-initialize-notification-mutex.patch ├── 715-drbd_nl.c-define-notification-mutex.patch ├── 716-drbd_main.c-Patches-for-DRBD-9.0.31.patch ├── 717-drbd_receiver.c-Patches-for-DRBD-9.0.31.patch ├── 718-drbd_actlog-unsigned-long-ULONG_PTR.patch ├── 719-drbd_bitmap-unsigned-long-ULONG_PTR.patch ├── 720-drbd_receiver-unsigned-long-ULONG_PTR.patch ├── 721-drbd_req-unsigned-long-ULONG_PTR.patch ├── 722-drbd_sender-unsigned-long-ULONG_PTR.patch ├── 723-drbd_transport_tcp-long-LONG_PTR.patch ├── 724-drbd_transport.h-unsigned-long-ULONG_PTR.patch ├── 725-drbd_state-llu-for-displaying-how-much-there-is-to-s.patch ├── 727-Never-put-big-pages-onto-page-pool.patch ├── 728-create_device-check-if-block-device-has-already-a-di.patch ├── 729-drbd_transport.h-Reapply-big-pages-interface-to-drbd.patch ├── 730-drbd_main-use-put_page-instead-of-__free_page.patch ├── 731-drbd_actlog-pass-code-analysis-and-codeql-tests.patch ├── 732-drbd.h-pass-code-analysis-and-codeql-tests.patch ├── 733-pass-code-analysis-and-codeql-tests.patch ├── 734-drbd_bitmap-pass-code-analysis-and-codeql-tests.patch ├── 735-drbd_debugfs-pass-code-analysis-and-codeql-tests.patch ├── 736-drbd_int.h-pass-code-analysis-and-codeql-tests.patch ├── 737-drbd-interval-pass-code-analysis-and-codeql-tests.patch ├── 738-drbd_nl-pass-code-analysis-and-codeql-tests.patch ├── 739-drbd_req-pass-code-analysis-and-codeql-tests.patch ├── 740-drbd_state-pass-code-analysis-and-codeql-tests.patch ├── 741-drbd_transport_tcp-pass-code-analysis-and-codeql-tes.patch ├── 742-lru_cache-pass-code-analysis-and-codeql-tests.patch ├── 743-Make-nr_requests-comparision-signed.patch ├── 744-Fixed-online-resize-while-connected.patch ├── 745-drbd-do-not-wait-for-negotiation-result-with-unconne.patch ├── 746-Use-only-one-spin-lock-flag-in-receive_state.patch ├── 747-Check-all-connections-for-two-phase-commit-support-i.patch ├── 748-drbd_main-fill-out-part0-field-of-struct-gendisk.patch ├── 749-drbd-headers-set-shutdown-flag-ioctl.patch ├── 750-stable_state_change-retry-after-1-second-as-long-as-.patch ├── 751-drbd_receiver-use-wake_up_all-for-state_wait.patch ├── 752-drbd_sender-use-wake_up_all-for-state_wait.patch ├── 753-drbd_state-use-wake_up_all-for-state_wait.patch ├── 754-Call-hook-on-size-change.patch ├── 755-drbd-headers-IOCTL_WINDRBD_ROOT_ARE_THERE_NL_PACKETS.patch ├── 756-Corking-Uncorking-backing-device-request-in-bitmap-I.patch.disabled ├── 756-WinDRBD-New-ioctl-code-for-allowing-unloading-the-dr.patch ├── 757-drbd_request_endio-avoid-unnecessary-BSOD-s.patch ├── 758-WinDRBD-Suspend-Resume-I-O-for-a-minor-on-the-WinDRB.patch ├── 759-DRBD-chk-I-O-error-check-if-ldev-exists-already.patch └── cocci-cache │ └── .gitignore ├── versioninfo.sh ├── visual-studio-2019-files ├── .gitignore └── WinDRBD │ ├── WinDRBD.sln │ └── WinDRBD │ ├── WinDRBD.inf │ ├── WinDRBD.vcxproj │ ├── WinDRBD.vcxproj.filters │ ├── WinDRBD.vcxproj.user │ └── run-msbuild.cmd ├── visual-studio-files ├── .gitignore ├── WinDRBD.sln └── WinDRBD │ ├── WinDRBD.vcxproj │ ├── WinDRBD.vcxproj.filters │ └── WinDRBD.vcxproj.user ├── windrbd-test ├── .gitignore ├── 1megloop.sh ├── Makefile ├── README.md ├── busy-write-one-block.sh ├── connect-test.sh ├── connection-loss-while-syncing.sh ├── data-coherence-test.sh ├── detach-attach-loop.sh ├── detatch-attach-wait-sync-loop.sh ├── disconnect-connect-loop-bsod.sh ├── disconnect-connect-loop.sh ├── disconnect-connect-up-down-wait-connect.sh ├── disconnect-connect-wait-connected-loop-check-if-disconnect-succeeded-and-attach.sh ├── disconnect-connect-wait-connected-loop-check-if-disconnect-succeeded.sh ├── disconnect-connect-wait-connected-loop-no-bsod.sh ├── disconnect-connect-wait-connected-loop.sh ├── disconnect-connect-wait-sync-loop.h ├── disk-timeout-loop2023.sh ├── drbd-device.cpp ├── drbd-device.hpp ├── dump-disk.sh ├── flush-loop.sh ├── inject-attach-loop.sh ├── inject-completion-attach-loop.sh ├── invalidate-loop.sh ├── invalidate-loop2023.sh ├── invalidate-remote-loop.sh ├── invalidate-wait-sync-loop.sh ├── io-loop.sh ├── io-loop2023.sh ├── iptables-dont-drop-diskless.sh ├── iptables-dont-drop-port.sh ├── iptables-dont-drop.sh ├── iptables-drop-diskless.sh ├── iptables-drop-dont-drop-loop.sh ├── iptables-drop-port.sh ├── iptables-drop.sh ├── load-unload-test.sh ├── loop.sh ├── main.cpp ├── primary-secondary-loop.sh ├── read_m_test.sh ├── resize-test │ ├── resize-backing-device.diskpart │ ├── resize-test.sh │ └── resize-windrbd-device.diskpart ├── resync-secs.sh ├── resync-speed-test.sh ├── secondary-and-invalidate-remote-loop.sh ├── simple-wait-connect-test.sh ├── suspend-io-and-invalidate-remote-loop.sh ├── test-case-io-larger-than-1m.sh ├── test-case-write-2m-chunks-no-fault-injection.sh ├── test-loop.sh ├── test-reading-past-end-of-device.sh ├── test.cpp ├── test.sh ├── tests-from-4 │ ├── busy-sync-monitor.ps1 │ ├── del-all-linbit-drivers.sh │ ├── disk-timeout-loop.sh │ ├── do-debug.sh │ ├── install-windrbd-certificates.sh │ ├── io-loop.sh │ └── start-rds-resource.sh ├── updown-loop-disconnect-while-still-syncing.sh ├── updown-loop-wait-connected.sh ├── updown-loop-wait-until-synced.sh ├── updown-loop.sh ├── updown-loop2023.sh ├── verify-content.c ├── wait-for-connect-test.sh ├── write-disk-one-meg.sh ├── write-disk.sh ├── write-fs-loop-2021.sh ├── write-fs-loop-l.sh ├── write-fs-loop-linux-1m-blocks.sh ├── write-fs-loop-linux-direct.sh ├── write-fs-loop-linux-raw.sh ├── write-fs-loop-linux-w2.sh ├── write-fs-loop-linux.sh ├── write-fs-loop-m-paralell.sh ├── write-fs-loop-m.sh └── write-fs-loop.sh └── windrbd ├── include ├── asm │ ├── byteorder.h │ ├── kmap_types.h │ ├── types.h │ └── unaligned.h ├── compat.h ├── crypto │ └── hash.h ├── disp.h ├── drbd_polymorph_printk.h ├── drbd_url.h ├── drbd_windows.h ├── drbd_wingenl.h ├── drbd_wrappers.h ├── generic_compat_stuff.h ├── kmalloc_debug.h ├── linux │ ├── backing-dev.h │ ├── bio.h │ ├── bitops.h │ ├── bitsperlong.h │ ├── blkdev.h │ ├── blkpg.h │ ├── bvec.h │ ├── compiler.h │ ├── cpumask.h │ ├── crc32c.h │ ├── ctype.h │ ├── debugfs.h │ ├── device.h │ ├── drbd_endian.h │ ├── dynamic_debug.h │ ├── errno.h │ ├── file.h │ ├── fs.h │ ├── genetlink.h │ ├── genhd.h │ ├── gfp_types.h │ ├── highmem.h │ ├── hweight.h │ ├── idr.h │ ├── in.h │ ├── init.h │ ├── jiffies.h │ ├── kconfig.h │ ├── kernel.h │ ├── kref.h │ ├── kthread.h │ ├── ktime.h │ ├── libnvdimm.h │ ├── list.h │ ├── major.h │ ├── math64.h │ ├── memcontrol.h │ ├── mempool.h │ ├── mm.h │ ├── mm_inline.h │ ├── module.h │ ├── moduleparam.h │ ├── mutex.h │ ├── net.h │ ├── net │ │ └── sock.h │ ├── net_namespace.h │ ├── netlink.h │ ├── notifier.h │ ├── overflow.h │ ├── part_stat.h │ ├── pkt_sched.h │ ├── prefetch.h │ ├── proc_fs.h │ ├── random.h │ ├── ratelimit.h │ ├── rbtree.h │ ├── reboot.h │ ├── refcount.h │ ├── rwlock.h │ ├── rwlock_types.h │ ├── scatterlist.h │ ├── sched.h │ ├── sched │ │ └── signal.h │ ├── security.h │ ├── seq_file.h │ ├── slab.h │ ├── socket.h │ ├── spinlock.h │ ├── stat.h │ ├── stddef.h │ ├── string.h │ ├── stringify.h │ ├── swab.h │ ├── tcp.h │ ├── tcp_states.h │ ├── time64.h │ ├── timer.h │ ├── types.h │ ├── uaccess.h │ ├── uio.h │ ├── unistd.h │ ├── vermagic.h │ ├── version.h │ ├── vmalloc.h │ ├── wait.h │ └── workqueue.h ├── net │ ├── genetlink.h │ ├── ipv6.h │ ├── netlink.h │ └── sock.h ├── partition_table_template.h ├── stdint.h ├── tiktok.h ├── uapi │ └── linux │ │ └── sched │ │ └── types.h ├── windrbd-event-log.h ├── windrbd_device.h ├── windrbd_threads.h └── wingenl.h ├── src ├── Attr.c ├── disp.c ├── drbd_windows.c ├── hweight.c ├── idr.c ├── kmalloc_debug.c ├── mempool.c ├── partition_table_template.c ├── printk-to-syslog.c ├── rbtree.c ├── seq_file.c ├── slab.c ├── tiktok.c ├── util.c ├── windrbd_bootdevice.c ├── windrbd_device.c ├── windrbd_drbd_url_parser.c ├── windrbd_locking.c ├── windrbd_module.c ├── windrbd_netlink.c ├── windrbd_test.c ├── windrbd_threads.c ├── windrbd_usermodehelper.c ├── windrbd_waitqueue.c └── windrbd_winsocket.c ├── windrbd-event-log.mc └── windrbd.inf.in /.gitignore: -------------------------------------------------------------------------------- 1 | converted-sources*/ 2 | *.bak 3 | *~ 4 | windrbd/src/*.obj 5 | windrbd/src/*.pdb 6 | 7 | .*.sw? 8 | codeql-database 9 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "drbd"] 2 | path = drbd 3 | url = https://github.com/LINBIT/drbd-9.0.git 4 | update = rebase 5 | fetchRecurseSubmodules = true 6 | -------------------------------------------------------------------------------- /create-patch: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | PATCH=$1 4 | 5 | TRANS_DEST=converted-sources/ 6 | 7 | GENERATED=$(<$TRANS_DEST.generated) 8 | 9 | for F in $GENERATED; do 10 | UPSTREAM_FILE=${F/$TRANS_DEST/drbd\/} 11 | TMP_FILE=${F/$TRANS_DEST/.tmp\/} 12 | ./transform $UPSTREAM_FILE $TMP_FILE 13 | done 14 | 15 | echo 16 | ln -s .tmp a 17 | ln -s $TRANS_DEST b 18 | if test "$PATCH"; then 19 | LC_ALL=C diff -rup a b | grep -v "Only in" >$PATCH 20 | cat $PATCH 21 | else 22 | LC_ALL=C diff -rup a b | grep -v "Only in" 23 | fi 24 | rm a 25 | rm b 26 | 27 | rm -rf .tmp 28 | -------------------------------------------------------------------------------- /crypto/.gitignore: -------------------------------------------------------------------------------- 1 | *.cer 2 | *.pfx 3 | *.pvk 4 | *.spc 5 | *.p12 6 | *.pem 7 | *.crt 8 | -------------------------------------------------------------------------------- /crypto/readme.txt: -------------------------------------------------------------------------------- 1 | rem see http://woshub.com/how-to-sign-an-unsigned-driver-for-windows-7-x64/ 2 | 3 | /cygdrive/c/Ewdk/Program\ Files/Windows\ Kits/10/bin/x64/makecert.exe -r -sv linbit-2019.pvk -n CN=LINBIT linbit-2019.cer 4 | /cygdrive/c/Ewdk/Program\ Files/Windows\ Kits/10/bin/x64/cert2spc.exe linbit-2019.cer linbit-2019.spc 5 | /cygdrive/c/Ewdk/Program\ Files/Windows\ Kits/10/bin/x64/pvk2pfx.exe -pvk linbit-2019.pvk -spc linbit-2019.spc -pfx linbit-2019.pfx 6 | 7 | ----- 8 | 9 | cd "Z:\installs\ewdk\Program Files\Windows Kits\10\bin\x64" 10 | 11 | 12 | makecert -r -sv z:\wdrbd9\crypto\linbit.pvk -n CN=LINBIT z:\wdrbd9\crypto\linbit.cer 13 | rem password was "a" 14 | 15 | cert2spc.exe z:\wdrbd9\crypto\linbit.cer z:\wdrbd9\crypto\linbit.spc 16 | 17 | 18 | pvk2pfx -pvk z:\wdrbd9\crypto\linbit.pvk -pi a -spc z:\wdrbd9\crypto\linbit.spc -pfx z:\wdrbd9\crypto\linbit.pfx -po a 19 | 20 | update: create pvk from pem using: 21 | 22 | openssl rsa -in linbit-ha-code-signing_no_pw.pem -outform PVK -pvk-strong -out linbit.pvk 23 | 24 | (openssl should be installed on Linux) 25 | 26 | update: cert manager has to be run manually (usually double clicking the crt file adds it to the system) 27 | -------------------------------------------------------------------------------- /inno-setup/.gitignore: -------------------------------------------------------------------------------- 1 | install*.exe 2 | version.iss 3 | resource-version.iss 4 | -------------------------------------------------------------------------------- /inno-setup/README.txt: -------------------------------------------------------------------------------- 1 | This directory contains packaging information for the Windows installer 2 | and uninstaller of WinDRBD. It was added with version windrbd-0.8.9. 3 | 4 | We are using inno-setup (http://www.jrsoftware.org) which perfectly 5 | fits our needs (thanks to the authors Jordan Russell and Martijn Laan!) 6 | and saved a lot of work. 7 | 8 | To obtain inno-setup go to their website, install it (sorry only runs 9 | under Microsoft Windows platforms) and make sure the application 10 | directory is in the PATH (we need to call the iscc command line 11 | compiler to generate the .EXE). 12 | 13 | -------------------------------------------------------------------------------- /inno-setup/cygwin-binaries/bash.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/inno-setup/cygwin-binaries/bash.exe -------------------------------------------------------------------------------- /inno-setup/cygwin-binaries/cat.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/inno-setup/cygwin-binaries/cat.exe -------------------------------------------------------------------------------- /inno-setup/cygwin-binaries/chmod.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/inno-setup/cygwin-binaries/chmod.exe -------------------------------------------------------------------------------- /inno-setup/cygwin-binaries/cp.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/inno-setup/cygwin-binaries/cp.exe -------------------------------------------------------------------------------- /inno-setup/cygwin-binaries/cygattr-1.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/inno-setup/cygwin-binaries/cygattr-1.dll -------------------------------------------------------------------------------- /inno-setup/cygwin-binaries/cygbz2-1.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/inno-setup/cygwin-binaries/cygbz2-1.dll -------------------------------------------------------------------------------- /inno-setup/cygwin-binaries/cygiconv-2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/inno-setup/cygwin-binaries/cygiconv-2.dll -------------------------------------------------------------------------------- /inno-setup/cygwin-binaries/cygintl-8.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/inno-setup/cygwin-binaries/cygintl-8.dll -------------------------------------------------------------------------------- /inno-setup/cygwin-binaries/cygncursesw-10.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/inno-setup/cygwin-binaries/cygncursesw-10.dll -------------------------------------------------------------------------------- /inno-setup/cygwin-binaries/cygpath.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/inno-setup/cygwin-binaries/cygpath.exe -------------------------------------------------------------------------------- /inno-setup/cygwin-binaries/cygreadline7.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/inno-setup/cygwin-binaries/cygreadline7.dll -------------------------------------------------------------------------------- /inno-setup/cygwin-binaries/cygrunsrv.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/inno-setup/cygwin-binaries/cygrunsrv.exe -------------------------------------------------------------------------------- /inno-setup/cygwin-binaries/cygwin1.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/inno-setup/cygwin-binaries/cygwin1.dll -------------------------------------------------------------------------------- /inno-setup/cygwin-binaries/cygz.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/inno-setup/cygwin-binaries/cygz.dll -------------------------------------------------------------------------------- /inno-setup/cygwin-binaries/cygzstd-1.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/inno-setup/cygwin-binaries/cygzstd-1.dll -------------------------------------------------------------------------------- /inno-setup/cygwin-binaries/dumper.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/inno-setup/cygwin-binaries/dumper.exe -------------------------------------------------------------------------------- /inno-setup/cygwin-binaries/ls.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/inno-setup/cygwin-binaries/ls.exe -------------------------------------------------------------------------------- /inno-setup/cygwin-binaries/mkdir.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/inno-setup/cygwin-binaries/mkdir.exe -------------------------------------------------------------------------------- /inno-setup/cygwin-binaries/mv.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/inno-setup/cygwin-binaries/mv.exe -------------------------------------------------------------------------------- /inno-setup/cygwin-binaries/sed.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/inno-setup/cygwin-binaries/sed.exe -------------------------------------------------------------------------------- /inno-setup/cygwin-binaries/sync.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/inno-setup/cygwin-binaries/sync.exe -------------------------------------------------------------------------------- /inno-setup/cygwin-binaries/unzip.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/inno-setup/cygwin-binaries/unzip.exe -------------------------------------------------------------------------------- /inno-setup/deploy-with-ssh-ports.sh: -------------------------------------------------------------------------------- 1 | if [ $# -lt 2 ] 2 | then 3 | echo "Usage: $0 " 4 | echo "Use this if VMs are accessible via port forwarding" 5 | echo "Port forwarding can be configured with:" 6 | echo "ssh -L 0.0.0.0:2222:192.168.122.234:22 Administrator@192.168.122.234 \"tail -f /dev/null\"" 7 | echo 8 | echo "For example:" 9 | echo "$0 install-windrbd-1.1.3.exe 10.43.224.38 2234 2235" 10 | exit 1 11 | fi 12 | 13 | FILE=$1 14 | shift 15 | IP=$1 16 | shift 17 | 18 | PROG=$( basename $FILE ) 19 | 20 | parallel scp -P {} ./$FILE Administrator@$IP: ::: $* 21 | parallel ssh -p {} Administrator@$IP "./$PROG /verysilent /norestart" ::: $* 22 | parallel ssh -p {} Administrator@$IP "drbdadm --version" ::: $* 23 | -------------------------------------------------------------------------------- /inno-setup/deploy.sh: -------------------------------------------------------------------------------- 1 | if [ $# -lt 2 ] 2 | then 3 | echo "Usage: $0 " 4 | echo "For example:" 5 | echo "$0 install-windrbd-1.1.3.exe 10.43.224.37 10.43.224.50 10.43.224.69 10.43.224.72 10.43.224.73 10.43.224.74 10.43.224.75" 6 | exit 1 7 | fi 8 | 9 | FILE=$1 10 | shift 11 | 12 | parallel scp ./$FILE Administrator@{}: ::: $* 13 | parallel ssh Administrator@{} "./$FILE /verysilent /norestart" ::: $* 14 | parallel ssh Administrator@{} "drbdadm --version" ::: $* 15 | -------------------------------------------------------------------------------- /inno-setup/install-windrbd-1.1.0-rc2.exe-self-signed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/inno-setup/install-windrbd-1.1.0-rc2.exe-self-signed -------------------------------------------------------------------------------- /inno-setup/services.iss: -------------------------------------------------------------------------------- 1 | #include "service-library.iss" 2 | 3 | function MyStopService(SvcName: String): boolean; 4 | var 5 | S: Longword; 6 | begin 7 | Result := False; 8 | if ServiceExists(SvcName) then begin 9 | S:= SimpleQueryService(SvcName); 10 | if S <> SERVICE_STOPPED then begin 11 | SimpleStopService(SvcName, True, False); 12 | Result := True; 13 | end; 14 | end; 15 | end; 16 | 17 | procedure MyStartService(SvcName: String); 18 | begin 19 | if ServiceExists(SvcName) then begin 20 | SimpleStartService(SvcName, True, False); 21 | end; 22 | end; 23 | 24 | -------------------------------------------------------------------------------- /inno-setup/sysroot/etc/drbd.conf: -------------------------------------------------------------------------------- 1 | # You can find an example in /usr/share/doc/drbd.../drbd.conf.example 2 | 3 | include "drbd.d/global_common.conf"; 4 | include "drbd.d/*.res"; 5 | -------------------------------------------------------------------------------- /inno-setup/uninstall-windrbd.cmd: -------------------------------------------------------------------------------- 1 | rem see https://stackoverflow.com/questions/4051883/batch-script-how-to-check-for-admin-rights#21295806 2 | 3 | fsutil dirty query %systemdrive% >nul 4 | if %errorlevel% NEQ 0 ( 5 | msg "%username%" "Please run this with Administrator privileges" 6 | exit 7 | ) 8 | 9 | rem Don't do that .. it will start the kernel driver with sc start windrbd 10 | rem again which causes it not to unload later. It is done in windrbd.iss 11 | rem (procedure stopDriver) 12 | rem drbdadm down all 13 | rem This is done in the windrbd.iss stopDriver now: 14 | rem sc stop windrbd 15 | sc stop windrbdlog 16 | sc stop windrbdumhelper 17 | 18 | cygrunsrv -R windrbdlog 19 | cygrunsrv -R windrbdumhelper 20 | 21 | rem This is done in stopDriver section of windrbd.iss 22 | rem windrbd remove-bus-device C:\windows\inf\windrbd.inf 23 | 24 | start /wait rundll32.exe setupapi.dll,InstallHinfSection DefaultUninstall 132 C:\windows\inf\windrbd.inf 25 | 26 | -------------------------------------------------------------------------------- /inno-setup/update-cygwin-binaries.sh: -------------------------------------------------------------------------------- 1 | for i in cygwin-binaries/* 2 | do 3 | name=`basename $i` 4 | from=`which $name` 5 | echo "$from -> $i ..." 6 | cp $from $i 7 | done 8 | -------------------------------------------------------------------------------- /inno-setup/windrbd.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/inno-setup/windrbd.ico -------------------------------------------------------------------------------- /misc/converted-sources-gitignore: -------------------------------------------------------------------------------- 1 | *.bak 2 | *.orig 3 | *.obj 4 | *.pdb 5 | *.tmp* 6 | .*.sw? 7 | *.ilk 8 | *.sys 9 | *.cat 10 | -------------------------------------------------------------------------------- /misc/drbdadm-up-w0: -------------------------------------------------------------------------------- 1 | drbdsetup new-resource w0 2 2 | drbdsetup new-minor w0 5 17 3 | windrbd -q set-mount-point-for-minor 5 K: 4 | drbdsetup new-peer w0 3 --_name=johannes-VirtualBox --verify-alg=crc32c --rcvbuf-size=10m --sndbuf-size=64k --use-rle=no --protocol=C 5 | drbdsetup new-path w0 3 ipv4:192.168.56.101:7600 ipv4:192.168.56.102:7600 6 | drbdsetup peer-device-options w0 3 17 --c-max-rate=4048000 --c-fill-target=1048000 7 | windrbd -q hide-filesystem F: 8 | drbdmeta 5 v09 G: flex-external apply-al 9 | drbdsetup attach 5 F: G: flexible 10 | drbdsetup connect w0 3 11 | -------------------------------------------------------------------------------- /misc/extract-ioctls.sh: -------------------------------------------------------------------------------- 1 | grep "IoCtl request not im" /var/log/syslog | cut -d ' ' -f 14- | sort | uniq 2 | -------------------------------------------------------------------------------- /misc/extract-warnings.sh: -------------------------------------------------------------------------------- 1 | grep 'warning C' makelog | sed -e 's/^.*C\([0-9]*\).*$/\1/g' | sort | uniq 2 | 3 | -------------------------------------------------------------------------------- /misc/grep-spinlock-errors.sh: -------------------------------------------------------------------------------- 1 | grep '(called from' /var/log/syslog | sed -e 's/.*called from \([^(]*\).*/\1/g' | sort | uniq 2 | -------------------------------------------------------------------------------- /misc/ipxe-windrbd.pxe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/misc/ipxe-windrbd.pxe -------------------------------------------------------------------------------- /misc/ms-clustermanager/drbdadm.vbs: -------------------------------------------------------------------------------- 1 | Function DrbdAdm(Cmd, Res) 2 | Set shell = CreateObject("WScript.Shell") 3 | ' must be .exe else endless loop (restarts this script): 4 | Set p = shell.Exec("drbdadm.exe " + Cmd + " " + Res) 5 | 6 | While p.Status = WshRunning 7 | ' WScript.Sleep 50 8 | Sleep 50 9 | Wend 10 | 11 | if p.ExitCode <> 0 Then 12 | DrbdAdm = "Error" 13 | else 14 | DrbdAdm = p.stdout.readline 15 | end If 16 | End Function 17 | 18 | Select Case DrbdAdm("role", "w0") 19 | Case "Error" 20 | WScript.Echo "Error getting Role" 21 | Case "Primary" 22 | WScript.Echo "Is Primary" 23 | Case "Secondary" 24 | WScript.Echo "Is Secondary" 25 | End Select 26 | 27 | -------------------------------------------------------------------------------- /misc/ms-clustermanager/view-event-log.sh: -------------------------------------------------------------------------------- 1 | wevtutil.exe qe 'C:\Windows\System32\winevt\Logs\Microsoft-Windows-FailoverClustering%4Diagnostic.evtx' /rd:true /f:text /lf:true 2 | -------------------------------------------------------------------------------- /misc/netlink-packets-up: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/misc/netlink-packets-up -------------------------------------------------------------------------------- /misc/olddoc/TODO.pm: -------------------------------------------------------------------------------- 1 | 2 | * Check ULONG_PTR which ones need to be 64bit on 64bit arch 3 | * simply changing all means that we'd break 32bit - would we want/need to support that? 4 | 5 | * Change kmem_cache_alloc etc. to "Lookaside Lists" 6 | https://msdn.microsoft.com/en-us/library/windows/hardware/ff565416(v=vs.85).aspx 7 | 8 | * WriteSame not supported 9 | 10 | * Thin should be supported? 11 | https://msdn.microsoft.com/en-us/windows/hardware/drivers/storage/thin-provisioning 12 | 13 | * receiver wakeup (signals, for ping) 14 | 15 | * transport_tcp: 16 | It can not be derived from the Linux transport_tcp. The WinSock API is very 17 | different from the Linux TCP API. Simply take mantech's edition and ripp out 18 | all the useless #ifdefs. 19 | 20 | * Mantech's submit_bio doesn't run bio_endio() on failure? 21 | 22 | * Timeouts, SND_BUFF etc.? 23 | +#define DRBD_SNDBUF_SIZE_MAX (1024*1024*1024*2) 24 | +#define DRBD_SNDBUF_SIZE_DEF (1024*1024*20) 25 | 26 | 27 | ########################### done #################### 28 | 29 | 30 | * RCU -- okay for Phil 9f2ece44099531b6d0155414386a4c1e04426ce6 31 | -------------------------------------------------------------------------------- /misc/show-drbd-diff-stat.sh: -------------------------------------------------------------------------------- 1 | echo -n "Total lines changed: " 2 | diff -r drbd converted-sources | grep '^[<>]' | wc -l 3 | echo -n "Lines added: " 4 | diff -r drbd converted-sources | grep '^>' | wc -l 5 | echo -n "Lines removed: " 6 | diff -r drbd converted-sources | grep '^<' | wc -l 7 | 8 | -------------------------------------------------------------------------------- /misc/show-lock-time.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Show and sort log output of SPINLOCK_DEBUG2 3 | # typical usage is: 4 | # cat /var/log/syslog | ./show-lock-time.sh 5 | 6 | grep 'locked by' | sed -e 's/.*locked by \([^)]*))\).*time is \([0-9]*\)/\2 \1/g' | sort -n 7 | 8 | -------------------------------------------------------------------------------- /ms-cl-jt-opennebula-vm.cmd: -------------------------------------------------------------------------------- 1 | @call %EWDK_BASE%\BuildEnv\SetupBuildEnv.cmd amd64 2 | @cl.exe %* 3 | -------------------------------------------------------------------------------- /ms-cl-jt-opennebula2022-vm.cmd: -------------------------------------------------------------------------------- 1 | @call %EWDK_BASE%\BuildEnv\SetupBuildEnv.cmd amd64 2 | @cl.exe %* 3 | -------------------------------------------------------------------------------- /ms-cl-jt-server2016.cmd: -------------------------------------------------------------------------------- 1 | rem set EWDK_BASE=e: 2 | call %EWDK_BASE%\BuildEnv\SetupBuildEnv.cmd amd64 3 | rem set PATH=%PATH%;"E:\Program Files\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.14.26428\bin\Hostx64\x64" 4 | cl.exe %* 5 | -------------------------------------------------------------------------------- /ms-cl-jt-win10-32bit.cmd: -------------------------------------------------------------------------------- 1 | set EWDK_BASE=d: 2 | call %EWDK_BASE%\BuildEnv\SetupBuildEnv.cmd x86 3 | set PATH=%PATH%;"D:\Program Files\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.14.26428\bin\Hostx64\x86" 4 | cl.exe %* 5 | -------------------------------------------------------------------------------- /ms-cl-jt-win10.cmd: -------------------------------------------------------------------------------- 1 | set EWDK_BASE=e: 2 | call %EWDK_BASE%\BuildEnv\SetupBuildEnv.cmd amd64 3 | set PATH=%PATH%;"D:\Program Files\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.14.26428\bin\Hostx64\x64" 4 | cl.exe %* 5 | -------------------------------------------------------------------------------- /ms-cl-jt-win10ent-2020.cmd: -------------------------------------------------------------------------------- 1 | set EWDK_BASE=e: 2 | call %EWDK_BASE%\BuildEnv\SetupBuildEnv.cmd amd64 3 | set PATH=%PATH%;"E:\Program Files\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.23.28105\bin\Hostx64\x64" 4 | cl.exe %* 5 | -------------------------------------------------------------------------------- /ms-cl-jt-win7.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | @call %EWDK_BASE%\BuildEnv\SetupBuildEnv.cmd amd64 3 | @cl.exe %* 4 | -------------------------------------------------------------------------------- /ms-cl-jt-wine.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | @call %EWDK_BASE%\BuildEnv\SetupBuildEnv.cmd amd64 3 | "%EWDK_BASE%\Program Files\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.31.31103\bin\Hostx64\x64\cl.exe" %* 4 | -------------------------------------------------------------------------------- /transform.d/000-remove-__must_hold.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -pi.bak 2 | 3 | # remove definition 4 | s/\#\s*define\s*__must_hold.*//; 5 | 6 | s/([\s)])__must_hold\(.*?\)([\s;]+)$/$1$2/; 7 | 8 | 9 | -------------------------------------------------------------------------------- /transform.d/001-remove-other-preproc.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -pi.bak 2 | 3 | # BVD => -> 4 | s/\s+BVD\s+/->/g; 5 | 6 | # In 7 | # #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 8 | # coccinelle doesn´t like KBUILD_MODNAME 9 | s/^.define pr_fmt.*\sKBUILD_MODNAME.*/#define pr_fmt(fmt) ":" fmt/; 10 | 11 | s/\s__printf\([ 0-9,]+\)\s/ /g; 12 | 13 | # collapse lines 14 | # s/\\\r?\n$/ /g; ## doesn´t help 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /transform.d/100-undef_NOTHING.patch: -------------------------------------------------------------------------------- 1 | diff --git a/drbd/drbd_req.h b/drbd/drbd_req.h 2 | --- a/drbd/drbd_req.h 3 | +++ b/drbd/drbd_req.h 4 | @@ -75,6 +75,10 @@ 5 | * with or without "success". 6 | */ 7 | 8 | +#ifdef NOTHING 9 | +#undef NOTHING 10 | +#endif 11 | + 12 | enum drbd_req_event { 13 | CREATED, 14 | TO_BE_SENT, 15 | -------------------------------------------------------------------------------- /transform.d/103-expect-and-the-polymorphic-printk.patch: -------------------------------------------------------------------------------- 1 | diff --git i/drbd/drbd_int.h w/drbd/drbd_int.h 2 | index a9afac8c..982fcc1c 100644 3 | --- i/drbd/drbd_int.h 4 | +++ w/drbd/drbd_int.h 5 | @@ -54,7 +54,6 @@ 6 | #include "drbd_protocol.h" 7 | #include "drbd_kref_debug.h" 8 | #include "drbd_transport.h" 9 | -#include "drbd_polymorph_printk.h" 10 | 11 | #ifdef __CHECKER__ 12 | # define __protected_by(x) __attribute__((require_context(x,1,999,"rdwr"))) 13 | @@ -1273,6 +1272,8 @@ struct drbd_device { 14 | u64 read_nodes; /* used for balancing read requests among peers */ 15 | }; 16 | 17 | +#include "drbd_polymorph_printk.h" 18 | + 19 | struct drbd_bm_aio_ctx { 20 | struct drbd_device *device; 21 | struct list_head list; /* on device->pending_bitmap_io */ 22 | 23 | -------------------------------------------------------------------------------- /transform.d/105-resource-add-wrcu.patch: -------------------------------------------------------------------------------- 1 | diff --git a/drbd/drbd_int.h b/drbd/drbd_int.h 2 | index a9afac8..9dee4d2 100644 3 | --- a/drbd/drbd_int.h 4 | +++ b/drbd/drbd_int.h 5 | @@ -816,6 +816,7 @@ struct drbd_send_buffer { 6 | 7 | 8 | struct drbd_resource { 9 | + KIRQL wrcu_flags; 10 | char *name; 11 | #ifdef CONFIG_DEBUG_FS 12 | struct dentry *debugfs_res; 13 | -------------------------------------------------------------------------------- /transform.d/110-drbd_bitmap_C.patch: -------------------------------------------------------------------------------- 1 | diff --git i/drbd/drbd_bitmap.c w/drbd/drbd_bitmap.c 2 | index 51cfdc8d..4a58ca68 100644 3 | --- i/drbd/drbd_bitmap.c 4 | +++ w/drbd/drbd_bitmap.c 5 | @@ -23,6 +23,8 @@ 6 | 7 | #include "drbd_int.h" 8 | #include "drbd_dax_pmem.h" 9 | +#include "drbd_windows.h" 10 | +#include 11 | 12 | #ifndef BITS_PER_PAGE 13 | #define BITS_PER_PAGE (((ULONG_PTR)1) << (PAGE_SHIFT + 3)) 14 | @@ -1523,7 +1529,7 @@ unsigned int drbd_bm_clear_bits(struct drbd_device *device, unsigned int bitmap_ 15 | * 0 ... bit not set 16 | * -1 ... first out of bounds access, stop testing for bits! 17 | */ 18 | -int drbd_bm_test_bit(struct drbd_peer_device *peer_device, const unsigned long bitnr) 19 | +int drbd_bm_test_bit(struct drbd_peer_device *peer_device, unsigned long bitnr) 20 | { 21 | struct drbd_bitmap *bitmap = peer_device->device->bitmap; 22 | unsigned long irq_flags; 23 | -------------------------------------------------------------------------------- /transform.d/111-kthread_drbd_int.patch: -------------------------------------------------------------------------------- 1 | diff --git a/drbd/drbd_int.h b/drbd/drbd_int.h 2 | --- a/drbd/drbd_int.h 3 | +++ b/drbd/drbd_int.h 4 | @@ -217,6 +217,9 @@ enum drbd_thread_state { 5 | }; 6 | 7 | struct drbd_thread { 8 | + struct task_struct *nt; 9 | + KEVENT start_event; 10 | + KEVENT wait_event; 11 | spinlock_t t_lock; 12 | struct task_struct *task; 13 | struct completion stop; 14 | -------------------------------------------------------------------------------- /transform.d/112-get_ldev_if_state_drbd_int.patch: -------------------------------------------------------------------------------- 1 | diff --git a/drbd/drbd_int.h b/drbd/drbd_int.h 2 | --- a/drbd/drbd_int.h 3 | +++ b/drbd/drbd_int.h 4 | @@ -2478,7 +2478,7 @@ static inline bool is_sync_state(struct drbd_peer_device *peer_device, 5 | */ 6 | #define get_ldev_if_state(_device, _min_state) \ 7 | (_get_ldev_if_state((_device), (_min_state)) ? \ 8 | - ({ __acquire(x); true; }) : false) 9 | + true : false) 10 | #define get_ldev(_device) get_ldev_if_state(_device, D_INCONSISTENT) 11 | 12 | static inline void put_ldev(struct drbd_device *device) 13 | -------------------------------------------------------------------------------- /transform.d/113-typof_drbd_state.patch: -------------------------------------------------------------------------------- 1 | diff --git a/drbd/drbd_state.c b/drbd/drbd_state.c 2 | index 6caf8df..0c6c65c 100644 3 | --- a/drbd/drbd_state.c 4 | +++ b/drbd/drbd_state.c 5 | @@ -2189,7 +2189,7 @@ static void notify_state_change(struct drbd_state_change *state_change) 6 | }) 7 | #define REMEMBER_STATE_CHANGE(func, arg, type) \ 8 | ({ FINAL_STATE_CHANGE(type | NOTIFY_CONTINUES); \ 9 | - last_func = (typeof(last_func))func; \ 10 | + last_func = func; \ 11 | last_arg = arg; \ 12 | }) 13 | 14 | -------------------------------------------------------------------------------- /transform.d/114-stable_state_change_drbd_state_H.patch: -------------------------------------------------------------------------------- 1 | diff --git a/drbd/drbd_state.h b/drbd/drbd_state.h 2 | index 5db9b48..99ae9f4 100644 3 | --- a/drbd/drbd_state.h 4 | +++ b/drbd/drbd_state.h 5 | @@ -65,17 +65,7 @@ extern union drbd_state drbd_get_device_state(struct drbd_device *, enum which_s 6 | extern union drbd_state drbd_get_peer_device_state(struct drbd_peer_device *, enum which_state); 7 | extern union drbd_state drbd_get_connection_state(struct drbd_connection *, enum which_state); 8 | 9 | -#define stable_state_change(resource, change_state) ({ \ 10 | - enum drbd_state_rv rv; \ 11 | - int err; \ 12 | - err = wait_event_interruptible((resource)->state_wait, \ 13 | - (rv = (change_state)) != SS_IN_TRANSIENT_STATE); \ 14 | - if (err) \ 15 | - err = -SS_UNKNOWN_ERROR; \ 16 | - else \ 17 | - err = rv; \ 18 | - err; \ 19 | - }) 20 | +inline int stable_state_change(struct drbd_resource *resource, enum drbd_state_rv change_state); 21 | 22 | extern int nested_twopc_work(struct drbd_work *work, int cancel); 23 | extern enum drbd_state_rv nested_twopc_request(struct drbd_resource *, int, enum drbd_packet, struct p_twopc_request *); 24 | -------------------------------------------------------------------------------- /transform.d/115-stable_state_change_drbd_state_C.patch: -------------------------------------------------------------------------------- 1 | diff --git a/drbd/drbd_state.c b/drbd/drbd_state.c 2 | index 21ae14e..fe81c20 100644 3 | --- a/drbd/drbd_state.c 4 | +++ b/drbd/drbd_state.c 5 | @@ -4253,6 +4253,16 @@ enum drbd_state_rv change_repl_state(struct drbd_peer_device *peer_device, 6 | return change_cluster_wide_state(do_change_repl_state, &repl_context.context); 7 | } 8 | 9 | +inline int stable_state_change(struct drbd_resource *resource, enum drbd_state_rv change_state) { 10 | + int err; 11 | + err = wait_event_interruptible(resource->state_wait, change_state != SS_IN_TRANSIENT_STATE); 12 | + if (err) 13 | + err = -SS_UNKNOWN_ERROR; 14 | + else 15 | + err = change_state; 16 | + return err; \ 17 | +} 18 | + 19 | enum drbd_state_rv stable_change_repl_state(struct drbd_peer_device *peer_device, 20 | enum drbd_repl_state repl_state, 21 | enum chg_state_flags flags) 22 | -------------------------------------------------------------------------------- /transform.d/116-typecheck-in-dagtag_newer.patch: -------------------------------------------------------------------------------- 1 | diff --git i/drbd/drbd_int.h w/drbd/drbd_int.h 2 | index a9afac8c..4a853bca 100644 3 | --- i/drbd/drbd_int.h 4 | +++ w/drbd/drbd_int.h 5 | @@ -267,14 +267,10 @@ extern u64 directly_connected_nodes(struct drbd_resource *, enum which_state); 6 | /* sequence arithmetic for dagtag (data generation tag) sector numbers. 7 | * dagtag_newer_eq: true, if a is newer than b */ 8 | #define dagtag_newer_eq(a,b) \ 9 | - (typecheck(u64, a) && \ 10 | - typecheck(u64, b) && \ 11 | - ((s64)(a) - (s64)(b) >= 0)) 12 | + ((s64)(a) - (s64)(b) >= 0) 13 | 14 | #define dagtag_newer(a,b) \ 15 | - (typecheck(u64, a) && \ 16 | - typecheck(u64, b) && \ 17 | - ((s64)(a) - (s64)(b) > 0)) 18 | + ((s64)(a) - (s64)(b) > 0) 19 | 20 | struct drbd_request { 21 | struct drbd_device *device; 22 | -------------------------------------------------------------------------------- /transform.d/118-drbd_int-H.patch: -------------------------------------------------------------------------------- 1 | Needed so that the macro can correctly generate the correct printk name. 2 | 3 | diff --git i/drbd/drbd_int.h w/drbd/drbd_int.h 4 | index a9afac8c..fd4f5726 100644 5 | --- i/drbd/drbd_int.h 6 | +++ w/drbd/drbd_int.h 7 | @@ -2391,7 +2391,7 @@ static inline void inc_ap_pending(struct drbd_peer_device *peer_device) 8 | } 9 | 10 | #define dec_ap_pending(peer_device) \ 11 | - ((void)expect((peer_device), __dec_ap_pending(peer_device) >= 0)) 12 | + ((void)expect(peer_device, __dec_ap_pending(peer_device) >= 0)) 13 | static inline int __dec_ap_pending(struct drbd_peer_device *peer_device) 14 | { 15 | int ap_pending_cnt = atomic_dec_return(&peer_device->ap_pending_cnt); 16 | -------------------------------------------------------------------------------- /transform.d/121-dec_rs_pending_drbd_int-H.patch: -------------------------------------------------------------------------------- 1 | diff --git a/drbd/drbd_int.h b/drbd/drbd_int.h 2 | index a9afac8..6425611 100644 3 | --- a/drbd/drbd_int.h 4 | +++ b/drbd/drbd_int.h 5 | @@ -2412,7 +2412,7 @@ static inline void inc_rs_pending(struct drbd_peer_device *peer_device) 6 | } 7 | 8 | #define dec_rs_pending(peer_device) \ 9 | - ((void)expect((peer_device), __dec_rs_pending(peer_device) >= 0)) 10 | + ((void)expect(peer_device, __dec_rs_pending(peer_device) >= 0)) 11 | static inline int __dec_rs_pending(struct drbd_peer_device *peer_device) 12 | { 13 | return atomic_dec_return(&peer_device->rs_pending_cnt); 14 | -------------------------------------------------------------------------------- /transform.d/122-drbd_sender-all_zero-always-false-was-122-all_zero.patch: -------------------------------------------------------------------------------- 1 | From c3c676eff084b0f0e1ccf43c9a5b1cea6baf623a Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Tue, 3 Mar 2020 20:12:30 +0100 4 | Subject: [PATCH 1/2] drbd_sender: all_zero always false (was 5 | 122-all_zero_drbd_send) 6 | 7 | --- 8 | drbd/drbd_sender.c | 3 +++ 9 | 1 file changed, 3 insertions(+) 10 | 11 | diff --git a/drbd/drbd_sender.c b/drbd/drbd_sender.c 12 | index b11ab01..b9b4b26 100644 13 | --- a/drbd/drbd_sender.c 14 | +++ b/drbd/drbd_sender.c 15 | @@ -1337,6 +1337,7 @@ int w_e_end_data_req(struct drbd_work *w, int cancel) 16 | static bool all_zero(struct drbd_peer_request *peer_req) 17 | /* kmap compat: KM_USER1 */ 18 | { 19 | +#if 0 20 | struct page *page = peer_req->page_chain.head; 21 | unsigned int len = peer_req->i.size; 22 | 23 | @@ -1357,6 +1358,8 @@ static bool all_zero(struct drbd_peer_request *peer_req) 24 | } 25 | 26 | return true; 27 | +#endif 28 | + return false; 29 | } 30 | 31 | /** 32 | -- 33 | 2.17.0 34 | 35 | -------------------------------------------------------------------------------- /transform.d/123-drbd_vli-compiler-warning.patch: -------------------------------------------------------------------------------- 1 | diff --git i/drbd/drbd_vli.h w/drbd/drbd_vli.h 2 | index 8cb1532a..49022ff3 100644 3 | --- i/drbd/drbd_vli.h 4 | +++ w/drbd/drbd_vli.h 5 | @@ -161,6 +161,7 @@ static inline int vli_decode_bits(u64 *out, const u64 in) 6 | /* NOT REACHED, if VLI_LEVELS code table is defined properly */ 7 | BUG(); 8 | #undef LEVEL 9 | + return 0; 10 | } 11 | 12 | /* return number of code bits needed, 13 | -------------------------------------------------------------------------------- /transform.d/127-schedule_drbd_sender_C.patch: -------------------------------------------------------------------------------- 1 | diff --git a/drbd/drbd_sender.c b/drbd/drbd_sender.c 2 | index af7e7bd..045aedd 100644 3 | --- a/drbd/drbd_sender.c 4 | +++ b/drbd/drbd_sender.c 5 | @@ -2499,7 +2499,7 @@ static void wait_for_sender_todo(struct drbd_connection *connection) 6 | if (get_t_state(&connection->sender) != RUNNING) 7 | break; 8 | 9 | - schedule(); 10 | + schedule(&connection->sender_work.q_wait, SENDER_SCHEDULE_TIMEOUT, __FUNCTION__, __LINE__); 11 | /* may be woken up for other things but new work, too, 12 | * e.g. if the current epoch got closed. 13 | * In which case we send the barrier above. */ 14 | -------------------------------------------------------------------------------- /transform.d/129-drbd_main_C-move-drbd_open.patch: -------------------------------------------------------------------------------- 1 | diff --git i/drbd/drbd_main.c w/drbd/drbd_main.c 2 | index e207d805..8d173dd3 100644 3 | --- i/drbd/drbd_main.c 4 | +++ w/drbd/drbd_main.c 5 | @@ -52,7 +52,7 @@ 6 | #include "drbd_meta_data.h" 7 | #include "drbd_dax_pmem.h" 8 | 9 | -static int drbd_open(struct block_device *bdev, fmode_t mode); 10 | +int drbd_open(struct block_device *bdev, fmode_t mode); 11 | static void drbd_release(struct gendisk *gd, fmode_t mode); 12 | static void md_sync_timer_fn(struct timer_list *t); 13 | static int w_bitmap_io(struct drbd_work *w, int unused); 14 | @@ -2478,7 +2477,7 @@ static int ro_open_cond(struct drbd_device *device) 15 | return -EAGAIN; 16 | } 17 | 18 | -static int drbd_open(struct block_device *bdev, fmode_t mode) 19 | +int drbd_open(struct block_device *bdev, fmode_t mode) 20 | { 21 | struct drbd_device *device = bdev->bd_disk->private_data; 22 | struct drbd_resource *resource = device->resource; 23 | -------------------------------------------------------------------------------- /transform.d/130-drbd_int_H-move-drbd_open.patch: -------------------------------------------------------------------------------- 1 | diff --git i/drbd/drbd_int.h w/drbd/drbd_int.h 2 | index a9afac8c..a285fb9f 100644 3 | --- i/drbd/drbd_int.h 4 | +++ w/drbd/drbd_int.h 5 | @@ -2783,4 +2783,6 @@ static inline struct drbd_connection *first_connection(struct drbd_resource *res 6 | 7 | #define NODE_MASK(id) ((u64)1 << (id)) 8 | 9 | +int drbd_open(struct block_device *bdev, fmode_t mode); 10 | + 11 | #endif 12 | -------------------------------------------------------------------------------- /transform.d/131-crc32_drbd_actlog_C.patch: -------------------------------------------------------------------------------- 1 | diff --git a/drbd/drbd_actlog.c b/drbd/drbd_actlog.c 2 | index a36204b..e86aefd 100644 3 | --- a/drbd/drbd_actlog.c 4 | +++ b/drbd/drbd_actlog.c 5 | @@ -463,7 +463,7 @@ static int __al_write_transaction(struct drbd_device *device, struct al_transact 6 | 7 | sector = al_tr_number_to_on_disk_sector(device); 8 | 9 | - crc = crc32c(0, buffer, 4096); 10 | + crc = crc32c(0, (uint8_t*)buffer, 4096); 11 | buffer->crc32c = cpu_to_be32(crc); 12 | 13 | if (drbd_bm_write_hinted(device)) 14 | -------------------------------------------------------------------------------- /transform.d/133-rm-obvious_drbd_init-drbd_main_C.patch: -------------------------------------------------------------------------------- 1 | diff --git a/drbd/drbd_main.c b/drbd/drbd_main.c 2 | index e207d80..56fcab0 100644 3 | --- a/drbd/drbd_main.c 4 | +++ b/drbd/drbd_main.c 5 | @@ -3827,7 +3827,7 @@ void drbd_put_connection(struct drbd_connection *connection) 6 | kref_sub(&connection->kref, refs, drbd_destroy_connection); 7 | } 8 | 9 | -static int __init drbd_init(void) 10 | +int __init drbd_init(void) 11 | { 12 | int err; 13 | 14 | @@ -4086,7 +4086,9 @@ int __init drbd_init(void) 15 | spin_lock_init(&retry.lock); 16 | INIT_LIST_HEAD(&retry.writes); 17 | 18 | +#if 0 19 | drbd_debugfs_init(); 20 | +#endif 21 | 22 | pr_info("initialized. " 23 | "Version: " REL_VERSION " (api:%d/proto:%d-%d)\n", 24 | -------------------------------------------------------------------------------- /transform.d/134-set_resource_options_drbd_main_C.patch: -------------------------------------------------------------------------------- 1 | From db6e8c2780c2044617c00913846a22fec91ec454 Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Fri, 6 Mar 2020 18:22:16 +0100 4 | Subject: [PATCH 4/7] drbd_main: set_resource_options is a NOOP. 5 | 6 | --- 7 | drbd/drbd_main.c | 5 ++++- 8 | 1 file changed, 4 insertions(+), 1 deletion(-) 9 | 10 | diff --git a/drbd/drbd_main.c b/drbd/drbd_main.c 11 | index 95672d4..85fdf53 100644 12 | --- a/drbd/drbd_main.c 13 | +++ b/drbd/drbd_main.c 14 | @@ -3308,5 +3308,6 @@ static void wake_all_device_misc(struct drbd_resource *resource) 15 | 16 | int set_resource_options(struct drbd_resource *resource, struct res_opts *res_opts) 17 | { 18 | +#if 0 19 | struct drbd_connection *connection; 20 | cpumask_var_t new_cpu_mask; 21 | @@ -3388,7 +3389,10 @@ int set_resource_options(struct drbd_resource *resource, struct res_opts *res_op 22 | fail: 23 | free_cpumask_var(new_cpu_mask); 24 | return err; 25 | - 26 | +#else 27 | + resource->res_opts = *res_opts; 28 | + return 0; 29 | +#endif 30 | } 31 | 32 | struct drbd_resource *drbd_create_resource(const char *name, 33 | -- 34 | 2.17.0 35 | 36 | -------------------------------------------------------------------------------- /transform.d/136-genl_magic_func-genl_register_mc_group_H.patch: -------------------------------------------------------------------------------- 1 | This patch deactivates defining the "drbd_genl_multicast_group" function, 2 | which gets overridden. 3 | 4 | 5 | diff --git i/drbd/linux/genl_magic_func-genl_register_mc_group.h w/drbd/linux/genl_magic_func-genl_register_mc_group.h 6 | index e042f165..1d46d84d 100644 7 | --- i/drbd/linux/genl_magic_func-genl_register_mc_group.h 8 | +++ w/drbd/linux/genl_magic_func-genl_register_mc_group.h 9 | @@ -4,7 +4,7 @@ static struct genl_multicast_group \ 10 | CONCAT_(GENL_MAGIC_FAMILY, _mcg_ ## group) __read_mostly = { \ 11 | .name = #group, \ 12 | }; \ 13 | -static int CONCAT_(GENL_MAGIC_FAMILY, _genl_multicast_ ## group)( \ 14 | +static int CONCAT_(GENL_MAGIC_FAMILY, _genl_multicast_ ## group ## _UNUSED)( \ 15 | struct sk_buff *skb, gfp_t flags) \ 16 | { \ 17 | unsigned int group_id = \ 18 | -------------------------------------------------------------------------------- /transform.d/137-QUEUE_FLAG_DISCARD-drbd_receiver_C.patch.x: -------------------------------------------------------------------------------- 1 | diff --git a/drbd/drbd_receiver.c b/drbd/drbd_receiver.c 2 | index 13ec23c..955d6be 100644 3 | --- a/drbd/drbd_receiver.c 4 | +++ b/drbd/drbd_receiver.c 5 | @@ -1305,7 +1305,7 @@ int drbd_issue_discard_or_zero_out(struct drbd_device *device, sector_t start, u 6 | 7 | static bool can_do_reliable_discards(struct drbd_device *device) 8 | { 9 | -#ifdef QUEUE_FLAG_DISCARD 10 | +#if 0 11 | struct request_queue *q = bdev_get_queue(device->ldev->backing_bdev); 12 | struct disk_conf *dc; 13 | bool can_do; 14 | -------------------------------------------------------------------------------- /transform.d/140-some-bio-BDI-drbd_main_C.patch: -------------------------------------------------------------------------------- 1 | diff --git a/drbd/drbd_main.c b/drbd/drbd_main.c 2 | index f332da2..7ef6dc4 100644 3 | --- a/drbd/drbd_main.c 4 | +++ b/drbd/drbd_main.c 5 | @@ -2328,9 +2328,11 @@ int drbd_send_dblock(struct drbd_peer_device *peer_device, struct drbd_request * 6 | 7 | err = 0; 8 | if (wsame) { 9 | +#if 0 10 | additional_size_command(peer_device->connection, DATA_STREAM, 11 | bio_iovec(req->master_bio).bv_len); 12 | err = __send_command(peer_device->connection, device->vnr, P_WSAME, DATA_STREAM); 13 | +#endif 14 | } else { 15 | additional_size_command(peer_device->connection, DATA_STREAM, req->i.size); 16 | err = __send_command(peer_device->connection, device->vnr, P_DATA, DATA_STREAM); 17 | -------------------------------------------------------------------------------- /transform.d/141-drbd_main_C-struct.retry-worker.patch: -------------------------------------------------------------------------------- 1 | diff --git i/drbd/drbd_main.c w/drbd/drbd_main.c 2 | index e207d805..98eb6778 100644 3 | --- i/drbd/drbd_main.c 4 | +++ w/drbd/drbd_main.c 5 | @@ -2865,6 +2865,7 @@ static struct retry_worker { 6 | 7 | spinlock_t lock; 8 | struct list_head writes; 9 | + struct task_struct task; 10 | } retry; 11 | 12 | static void drbd_req_destroy_lock(struct kref *kref) 13 | -------------------------------------------------------------------------------- /transform.d/143-drbd_meta_data_H-4k-alignment.patch: -------------------------------------------------------------------------------- 1 | diff --git i/drbd_meta_data.h w/drbd_meta_data.h 2 | index e87cf09..8ab3e2d 100644 3 | --- i/drbd_meta_data.h 4 | +++ w/drbd_meta_data.h 5 | @@ -46,7 +46,7 @@ struct meta_data_on_disk_9 { 6 | struct peer_dev_md_on_disk_9 peers[DRBD_PEERS_MAX]; 7 | be_u64 history_uuids[HISTORY_UUIDS]; 8 | 9 | - char padding[0] __attribute__((aligned(4096))); 10 | + __declspec(align(4096)) char padding[0] __attribute__((aligned(4096))); 11 | } __packed; 12 | 13 | 14 | -------------------------------------------------------------------------------- /transform.d/144-drbd_main_C-alloc_ordered_workqueue.patch: -------------------------------------------------------------------------------- 1 | diff --git i/drbd/drbd_main.c w/drbd/drbd_main.c 2 | index e207d805..7e67e7ae 100644 3 | --- i/drbd/drbd_main.c 4 | +++ w/drbd/drbd_main.c 5 | @@ -3877,7 +3877,7 @@ static int __init drbd_init(void) 6 | goto fail; 7 | } 8 | 9 | - retry.wq = create_singlethread_workqueue("drbd-reissue"); 10 | + retry.wq = alloc_ordered_workqueue("drbd-reissue", 0); 11 | if (!retry.wq) { 12 | pr_err("unable to create retry workqueue\n"); 13 | goto fail; 14 | -------------------------------------------------------------------------------- /transform.d/146-drbd_main_C-initialize-var.patch: -------------------------------------------------------------------------------- 1 | diff --git i/drbd/drbd_main.c w/drbd/drbd_main.c 2 | index e207d805..e73d77af 100644 3 | --- i/drbd/drbd_main.c 4 | +++ w/drbd/drbd_main.c 5 | @@ -2280,6 +2280,7 @@ int drbd_send_dblock(struct drbd_peer_device *peer_device, struct drbd_request * 6 | if (digest_size && digest_out) 7 | drbd_csum_bio(peer_device->connection->integrity_tfm, req->master_bio, digest_out); 8 | 9 | + err = 0; 10 | if (wsame) { 11 | additional_size_command(peer_device->connection, DATA_STREAM, 12 | bio_iovec(req->master_bio) BVD bv_len); 13 | -------------------------------------------------------------------------------- /transform.d/147-drbd_nl_C-vsnprintf.patch: -------------------------------------------------------------------------------- 1 | diff --git i/drbd/drbd_nl.c w/drbd/drbd_nl.c 2 | index bf5ed5e6..fde52e13 100644 3 | --- i/drbd/drbd_nl.c 4 | +++ w/drbd/drbd_nl.c 5 | @@ -478,7 +478,7 @@ static __printf(2, 3) int env_print(struct env *env, const char *fmt, ...) 6 | if (pos < 0) 7 | return pos; 8 | va_start(args, fmt); 9 | - ret = vsnprintf(env->buffer + pos, env->size - pos, fmt, args); 10 | + ret = RtlStringCbVPrintfA(env->buffer + pos, env->size - pos, fmt, args); 11 | va_end(args); 12 | if (ret < 0) { 13 | env->pos = ret; 14 | -------------------------------------------------------------------------------- /transform.d/148-drbd_main_C-drbd_cleanup_by_win_shutdown.patch: -------------------------------------------------------------------------------- 1 | diff --git i/drbd/drbd_main.c w/drbd/drbd_main.c 2 | index e207d805..00790073 100644 3 | --- i/drbd/drbd_main.c 4 | +++ w/drbd/drbd_main.c 5 | @@ -5344,6 +5344,27 @@ _drbd_insert_fault(struct drbd_device *device, unsigned int type) 6 | } 7 | #endif 8 | 9 | + 10 | +void drbd_cleanup_by_win_shutdown(PVOLUME_EXTENSION VolumeExtension) 11 | +{ 12 | + int i; 13 | + 14 | + struct device_list { 15 | + struct drbd_device *device; 16 | + struct list_head list; 17 | + } device_list; 18 | + struct device_list *device_list_p, *p; 19 | + 20 | + WDRBD_INFO("Shutdown: IRQL(%d) device(%ws) Name(%wZ)\n", 21 | + KeGetCurrentIrql(), VolumeExtension->PhysicalDeviceName, &VolumeExtension->MountPoint); 22 | + 23 | + if (retry.wq) 24 | + destroy_workqueue(retry.wq); 25 | + retry.wq = NULL; 26 | + 27 | + gbShutdown = TRUE; 28 | +} 29 | + 30 | module_init(drbd_init) 31 | module_exit(drbd_cleanup) 32 | 33 | -------------------------------------------------------------------------------- /transform.d/202-except-is-a-keyword.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -pi.bak 2 | 3 | s/([^\w\s]\s*except\b)/\1_/g; 4 | 5 | # drbd_nl.c: +#define try try_val 6 | 7 | s/(\btry\b)/\1_/g; 8 | -------------------------------------------------------------------------------- /transform.d/203-list_first_or_null_rcu-return.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -pi.bak 2 | 3 | # - peer_device = list_first_or_null_rcu(&device->peer_devices, 4 | #- struct drbd_peer_device, 5 | #- peer_devices); 6 | #+ list_first_or_null_rcu(peer_device, &device->peer_devices, struct drbd_peer_device, peer_devices); 7 | 8 | 9 | s/^(\s*)(\w+)\s*=\s*(list_first_or_null_rcu\()/$1$3$2, /; 10 | -------------------------------------------------------------------------------- /transform.d/204-timer_fn-arguments.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -pi.bak 2 | 3 | 4 | sub BEGIN { 5 | $/ = "}"; 6 | } 7 | 8 | 9 | # -void connect_timer_fn(unsigned long data) 10 | # -{ 11 | # +void connect_timer_fn(PKDPC Dpc, PVOID data, PVOID arg1, PVOID arg2) 12 | # +{ 13 | # + UNREFERENCED_PARAMETER(...) 14 | s( ^ (void \s* \w+_timer_fn ) \( unsigned \s long \s (\w+) \) \s* \{ ) 15 | ( "$1(PKDPC Dpc, PVOID $2, PVOID arg1, PVOID arg2)" . 16 | "{\n" . 17 | " UNREFERENCED_PARAMETER(Dpc);\n" . 18 | " UNREFERENCED_PARAMETER(arg1);\n" . 19 | " UNREFERENCED_PARAMETER(arg2);\n" 20 | )ex; 21 | 22 | 23 | # - resync_timer_fn((unsigned long)peer_device); 24 | # + resync_timer_fn(NULL, peer_device, 0, 0); 25 | s( ^ ( \s* \w+_timer_fn ) \( \( unsigned \s long\) (\w+) \) ) 26 | ( "$1(NULL, $2, 0, 0);" )ex; 27 | 28 | -------------------------------------------------------------------------------- /transform.d/206-empty-structures-initialize.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -pi.bak 2 | 3 | 4 | # - union drbd_state mask = {}, val = {}; 5 | # + union drbd_state mask = { 0, }; 6 | # + union drbd_state val = { 0, }; 7 | s( (= \s* \{) \s* \} )( "$1 0 }" )gxe; 8 | 9 | -------------------------------------------------------------------------------- /transform.d/207-ternary-with-2-terms.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -pi.bak 2 | 3 | 4 | # - m->error = ok ? 0 : (error ?: -EIO); 5 | # + m->error = ok ? 0 : (error ? error : -EIO); 6 | 7 | # - timeout = (nc->sock_check_timeo ?: nc->ping_timeo) * HZ / 10; 8 | # + timeout = (nc->sock_check_timeo ? nc->sock_check_timeo : nc->ping_timeo) * HZ / 10; 9 | 10 | 11 | # whitespace or parenthesis as separator; not really C conform, but works for our current code. 12 | 13 | s{ (? [\s(]+ (? \S+ ) \s* ) \?\: } 14 | { 15 | "$+{part1}? $+{cond} : "; 16 | }xeg; 17 | 18 | -------------------------------------------------------------------------------- /transform.d/209-macro-giving-code-as-expr.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -pi.bak 2 | 3 | 4 | # - ({ if (last_func) \ 5 | # + { if (last_func) \ 6 | 7 | s/\(\{/{/g; 8 | s/\}\)/}/g; 9 | -------------------------------------------------------------------------------- /transform.d/211-macro-varargs.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -pi.bak 2 | 3 | # -#define GENL_op_init(args...) args 4 | # +#define GENL_op_init(...) __VA_ARGS__ 5 | 6 | 7 | s{ ^ ( \s* \#define \s+ \w+ ) \( (\w+) \.\.\. \) \s+ \2 $} 8 | { "$1(...) __VA_ARGS__" }xeg; 9 | 10 | 11 | # for the transport layer: 12 | 13 | # define tr_printk(level, transport, fmt, args...) ({ \ 14 | # ... 15 | # ## args); \ 16 | # rcu_read_unlock(); \ 17 | # }) 18 | sub BEGIN { 19 | # go through the file per paragraph 20 | $/ = ""; 21 | # therefore the "g" modifier on the RE above. 22 | } 23 | 24 | if (s{ ^ ( \#define \s+ \w+ \( .*? ) (\w+) \.\.\. \)} 25 | { "$1...)" }xmesg) { 26 | my $varname = $2; 27 | s{ \b $varname \b }{__VA_ARGS__}gmx; 28 | } 29 | 30 | -------------------------------------------------------------------------------- /transform.d/213-bitops-include.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -pi.bak 2 | 3 | # - #include "drbd-kernel-compat/bitops.h" 4 | # + #include "bitops.h" 5 | 6 | s{ 7 | ^ \s* \# \s* include \s* .* bitops.h .* 8 | }{ 9 | "#include " 10 | }xe; 11 | 12 | 13 | -------------------------------------------------------------------------------- /transform.d/215-drbd_protocol_h-packed.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -i.bak 2 | 3 | # for drbd_protocol.h packet sizes 4 | 5 | sub BEGIN 6 | { 7 | @ARGV = grep(/drbd_protocol\.h/, @ARGV); 8 | # warn "No protocol.h on the commandline.\n", 9 | exit unless @ARGV; 10 | undef $/; 11 | } 12 | 13 | while (<>) { 14 | print "#pragma pack(push, 1)\n" . $_ . "\n#pragma pack(pop)\n"; 15 | } 16 | -------------------------------------------------------------------------------- /transform.d/216-i_size_read.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -pi.bak 2 | 3 | sub BEGIN 4 | { 5 | @ARGV = grep(/drbd_int\.h/, @ARGV); 6 | exit unless @ARGV; 7 | } 8 | 9 | s{i_size_read\((\w+)\-\>bd_inode\)} 10 | {(wdrbd_get_capacity($1) << 9)}; 11 | -------------------------------------------------------------------------------- /transform.d/217-cmpxchg-to-atomic.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -pi.bak 2 | 3 | sub BEGIN { 4 | $/ = ';'; 5 | } 6 | 7 | # rck> | #ifdef _WIN32 8 | # rck> | val = atomic_cmpxchg((atomic_t *)&lc->flags, 0, LC_LOCKED); 9 | # rck> | #else 10 | # rck> | val = cmpxchg(&lc->flags, 0, LC_LOCKED); 11 | # rck> | #endif 12 | 13 | 14 | s{ (? \b cmpxchg\( ) 15 | (? [^,]+ ) , 16 | (? [^,]+ ) , 17 | (? [^)]+ ) \) 18 | }{ 19 | "atomic_cmpxchg((atomic_t*)($+{arg1}),$+{arg2},$+{arg3})" 20 | }ex; 21 | -------------------------------------------------------------------------------- /transform.d/218-inject-includes.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -i.bak 2 | 3 | sub BEGIN 4 | { 5 | @ARGV = grep(/genl_magic_struct\.h/, @ARGV); 6 | exit unless @ARGV; 7 | } 8 | 9 | # when encountering linux/genetlink.h, add drbd_wingenl.h. 10 | # Doesn't work earlier, must not be added later. 11 | while (<>) { 12 | print; 13 | 14 | print "#include \n" if m(include.*linux/genetlink.h); 15 | } 16 | -------------------------------------------------------------------------------- /transform.d/220-kmem-cache-size.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | echo $1 | egrep -q "lru_cache.c" && (sed -ie '/WARN_ON(cache_obj_size < e_size);/,+3d' $1 && sed -ie '/cache_obj_size/d' $1) 4 | exit 0 5 | -------------------------------------------------------------------------------- /transform.d/220-set_capacity.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -pi.bak 2 | 3 | sub BEGIN 4 | { 5 | @ARGV = grep(/drbd_int\.h/, @ARGV); 6 | exit unless @ARGV; 7 | } 8 | #\-\>vdisk\,(\w+)size\)} 9 | s{set_capacity\(device\-\>vdisk, size\)} 10 | {if (device && device->this_bdev && device->this_bdev) 11 | \tdevice->this_bdev->d_size = size << 9}; 12 | # windows as diskless client 13 | 14 | 15 | s{\tdevice\-\>this_bdev\-\>bd_inode\-\>i_size = \(loff_t\)size \<\< 9;}{}; 16 | -------------------------------------------------------------------------------- /transform.d/221-kobject_uevent.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -pi.bak 2 | 3 | sub BEGIN 4 | { 5 | @ARGV = grep(/drbd_int\.h/, @ARGV); 6 | exit unless @ARGV; 7 | } 8 | 9 | s{kobject_uevent\(disk_to_kobj\(device\-\>vdisk\), KOBJ_CHANGE\);} 10 | {/* kobject_uevent(...) call removed by transformation 0121 */}; 11 | -------------------------------------------------------------------------------- /transform.d/223-bitmap.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | 4 | exit 0 5 | 6 | # 7 | # 8 | # BITS_PER_LONG => BITS_PER_BM_WORD? 9 | # 10 | # __test_and_clear_bit from kernel headers, or reimplement? 11 | -------------------------------------------------------------------------------- /transform.d/226-list_next_entry.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -pi.bak 2 | 3 | s{list_next_entry\(req, tl_requests\)} 4 | {list_next_entry\(struct drbd_request, req, tl_requests\)}; 5 | -------------------------------------------------------------------------------- /transform.d/301-rcu_read_lock.cocci: -------------------------------------------------------------------------------- 1 | @@ 2 | identifier func; 3 | @@ 4 | func(...) { 5 | + KIRQL rcu_flags; 6 | <+... 7 | - rcu_read_lock(); 8 | + rcu_flags = rcu_read_lock(); 9 | ... 10 | - rcu_read_unlock(); 11 | + rcu_read_unlock(rcu_flags); 12 | ...+> 13 | } 14 | -------------------------------------------------------------------------------- /transform.d/400-rcu-unbalanced.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # you have to make SURE that this is executed after the balanced replace 4 | echo $1 | grep -q drbd_state.c || exit 0 # maybe add more later 5 | sed -ie 's/rcu_read_unlock();/rcu_read_unlock(resource->wrcu_flags);/' $1 6 | sed -ie 's/^\srcu_read_lock();/resource->wrcu_flags = rcu_read_lock();/' $1 7 | -------------------------------------------------------------------------------- /transform.d/500-drbd_main-drbd_thread_setup-nonstatic.patch: -------------------------------------------------------------------------------- 1 | diff -ru converted-sources/drbd/drbd_main.c converted-sources-drbd-thread-setup-nonstatic/drbd/drbd_main.c 2 | --- converted-sources/drbd/drbd_main.c 2017-09-08 19:16:50.699554424 +0200 3 | +++ converted-sources-drbd-thread-setup-nonstatic/drbd/drbd_main.c 2017-09-08 19:19:53.450884423 +0200 4 | @@ -508,7 +508,7 @@ 5 | spin_unlock_irq(&resource->req_lock); 6 | } 7 | 8 | -static int drbd_thread_setup(void *arg) 9 | +int drbd_thread_setup(void *arg) 10 | { 11 | struct drbd_thread *thi = (struct drbd_thread *) arg; 12 | struct drbd_resource *resource = thi->resource; 13 | -------------------------------------------------------------------------------- /transform.d/501-drbd-int-declare-drbd_thread_setup.patch: -------------------------------------------------------------------------------- 1 | diff -ru converted-sources/drbd/drbd_int.h converted-sources-drbd-thread-setup-nonstatic/drbd/drbd_int.h 2 | --- converted-sources/drbd/drbd_int.h 2017-09-08 19:16:53.633020424 +0200 3 | +++ converted-sources-drbd-thread-setup-nonstatic/drbd/drbd_int.h 2017-09-08 19:23:01.512868424 +0200 4 | @@ -2341,6 +2341,7 @@ 5 | extern int conn_send_state_req(struct drbd_connection *, int vnr, enum drbd_packet, union drbd_state, union drbd_state); 6 | extern int conn_send_twopc_request(struct drbd_connection *, int vnr, enum drbd_packet, struct p_twopc_request *); 7 | extern int drbd_send_peer_ack(struct drbd_connection *, struct drbd_request *); 8 | +extern int drbd_thread_setup(void *arg); 9 | 10 | static inline void drbd_thread_stop(struct drbd_thread *thi) 11 | { 12 | -------------------------------------------------------------------------------- /transform.d/502-add-ktime.h-to-drbd_int-includes.patch: -------------------------------------------------------------------------------- 1 | From d206557a921a4e6d847c44d1693456baa6c663e0 Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Mon, 25 Sep 2017 16:14:56 +0200 4 | Subject: [PATCH 2/4] Added ktime.h to drbd_int includes. 5 | 6 | --- 7 | drbd/drbd_int.h | 1 + 8 | drbd/drbd_receiver.pdb | Bin 102400 -> 126976 bytes 9 | 2 files changed, 1 insertion(+) 10 | 11 | diff --git a/drbd/drbd_int.h b/drbd/drbd_int.h 12 | index 4037f6c..f6adb9c 100644 13 | --- a/drbd/drbd_int.h 14 | +++ b/drbd/drbd_int.h 15 | @@ -47,6 +47,7 @@ 16 | #include 17 | #include 18 | #include 19 | +#include 20 | 21 | #include "drbd_wrappers.h" 22 | #include "drbd_strings.h" 23 | -------------------------------------------------------------------------------- /transform.d/505-changes-to-main-for-new-architecture.patch: -------------------------------------------------------------------------------- 1 | diff --git a/drbd/drbd_main.c b/drbd/drbd_main.c 2 | index 8274e6a..52cf9fa 100644 3 | --- a/drbd/drbd_main.c 4 | +++ b/drbd/drbd_main.c 5 | @@ -3691,6 +3723,10 @@ void drbd_unregister_device(struct drbd_device *device) 6 | destroy_workqueue(device->submit.wq); 7 | device->submit.wq = NULL; 8 | del_timer_sync(&device->request_timer); 9 | + 10 | + /* TODO: Ask phil if that is correct */ 11 | + bdput(device->this_bdev); 12 | + device->this_bdev = NULL; 13 | } 14 | 15 | void drbd_reclaim_device(struct rcu_head *rp) 16 | 17 | @@ -3751,4 +3751,8 @@ 18 | disk->private_data = device; 19 | 20 | + device->this_bdev = block_device; 21 | + /* TODO: leaks existing disk */ 22 | + device->this_bdev->bd_disk = disk; 23 | + 24 | blk_queue_flag_set(QUEUE_FLAG_STABLE_WRITES, q); 25 | blk_queue_write_cache(q, true, true); 26 | 27 | -------------------------------------------------------------------------------- /transform.d/507-free-mempool-after-bio-put.patch: -------------------------------------------------------------------------------- 1 | diff --git a/drbd/drbd_bitmap.c b/drbd/drbd_bitmap.c 2 | index b675c6f..cbdbb0c 100644 3 | --- a/drbd/drbd_bitmap.c 4 | +++ b/drbd/drbd_bitmap.c 5 | @@ -1045,6 +1045,7 @@ static void drbd_bm_endio BIO_ENDIO_ARGS(struct bio *bio, blk_status_t status) 6 | struct drbd_device *device = ctx->device; 7 | struct drbd_bitmap *b = device->bitmap; 8 | unsigned int idx = bm_page_to_idx(bio->bi_io_vec[0].bv_page); 9 | + struct page *page = NULL; 10 | 11 | BIO_ENDIO_FN_START; 12 | -------------------------------------------------------------------------------- /transform.d/508-Handle-out-no-device-kmalloc-error.patch: -------------------------------------------------------------------------------- 1 | From 22ff0ccc9fedf364a6e00e789ef203201a5d9306 Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Tue, 9 Jan 2018 15:50:12 +0100 4 | Subject: [PATCH 1/2] Handle out no device (kmalloc error) 5 | 6 | --- 7 | drbd/drbd_main.c | 3 +++ 8 | 1 file changed, 3 insertions(+) 9 | 10 | diff --git a/drbd/drbd_main.c b/drbd/drbd_main.c 11 | index 72cd858..150f35c 100644 12 | --- a/drbd/drbd_main.c 13 | +++ b/drbd/drbd_main.c 14 | @@ -3728,6 +3728,9 @@ out_no_q: 15 | kref_put(&resource->kref, drbd_destroy_resource); 16 | kref_debug_destroy(&device->kref_debug); 17 | kfree(device); 18 | +out_no_device: 19 | + bdput(block_device); 20 | + 21 | return err; 22 | } 23 | 24 | -- 25 | 2.8.0-rc4 26 | 27 | -------------------------------------------------------------------------------- /transform.d/514-wdrbd_get_capacity-windrbd_get_capacity.patch: -------------------------------------------------------------------------------- 1 | From c672b053d4339431e8f8c3bf73126f3182069998 Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Mon, 29 Jan 2018 19:27:32 +0100 4 | Subject: [PATCH] wdrbd_get_capacity -> windrbd_get_capacity. 5 | 6 | --- 7 | drbd/drbd_int.h | 3 +-- 8 | 1 file changed, 1 insertion(+), 2 deletions(-) 9 | 10 | diff --git a/drbd/drbd_int.h b/drbd/drbd_int.h 11 | index c5ff9e3..064964a 100644 12 | --- a/drbd/drbd_int.h 13 | +++ b/drbd/drbd_int.h 14 | @@ -1976,8 +1976,7 @@ drbd_commit_size_change(struct drbd_device *device, struct resize_parms *rs, u64 15 | 16 | static inline sector_t drbd_get_capacity(struct block_device *bdev) 17 | { 18 | - /* return bdev ? get_capacity(bdev->bd_disk) : 0; */ 19 | - return bdev ? (wdrbd_get_capacity(bdev) << 9) >> 9 : 0; 20 | + return bdev ? (windrbd_get_capacity(bdev) << 9) >> 9 : 0; 21 | } 22 | 23 | /* sets the number of 512 byte sectors of our virtual device */ 24 | -- 25 | 2.7.4 26 | 27 | -------------------------------------------------------------------------------- /transform.d/515-win_drbd_thread_setup-windrbd_thread_setup.patch: -------------------------------------------------------------------------------- 1 | From 0280a0c5f5ac501046263483b8f981905f207cf7 Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Mon, 29 Jan 2018 19:31:21 +0100 4 | Subject: [PATCH] win_drbd_thread_setup -> windrbd_thread_setup 5 | 6 | --- 7 | drbd/drbd_main.c | 2 +- 8 | 1 file changed, 1 insertion(+), 1 deletion(-) 9 | 10 | diff --git a/drbd/drbd_main.c b/drbd/drbd_main.c 11 | index 321fa13..8e53d3d 100644 12 | --- a/drbd/drbd_main.c 13 | +++ b/drbd/drbd_main.c 14 | @@ -606,7 +606,7 @@ int drbd_thread_start(struct drbd_thread *thi) 15 | 16 | KeInitializeEvent(&thi->start_event, SynchronizationEvent, FALSE); 17 | KeInitializeEvent(&thi->wait_event, SynchronizationEvent, FALSE); 18 | - Status = PsCreateSystemThread(&hThread, THREAD_ALL_ACCESS, NULL, NULL, NULL, win_drbd_thread_setup, (void *) thi); 19 | + Status = PsCreateSystemThread(&hThread, THREAD_ALL_ACCESS, NULL, NULL, NULL, windrbd_thread_setup, (void *) thi); 20 | if (!NT_SUCCESS(Status)) { 21 | return false; 22 | } 23 | -- 24 | 2.7.4 25 | 26 | -------------------------------------------------------------------------------- /transform.d/516-Mount-point-flag-in-device_conf.patch: -------------------------------------------------------------------------------- 1 | From 783390d402e7c5692b53dcefc76d6b7e0162782b Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Wed, 28 Mar 2018 17:09:06 +0200 4 | Subject: [PATCH 1/2] Mount point flag in device_conf 5 | 6 | --- 7 | drbd-headers/linux/drbd_genl.h | 1 + 8 | 1 file changed, 1 insertions(+) 9 | 10 | diff --git a/drbd-headers/linux/drbd_genl.h b/drbd-headers/linux/drbd_genl.h 11 | index 4bbf1d9..6aa7283 100644 12 | --- a/drbd-headers/linux/drbd_genl.h 13 | +++ b/drbd-headers/linux/drbd_genl.h 14 | @@ -218,6 +218,7 @@ GENL_struct(DRBD_NLA_DETACH_PARMS, 13, detach_parms, 15 | GENL_struct(DRBD_NLA_DEVICE_CONF, 14, device_conf, 16 | __u32_field_def(1, DRBD_F_INVARIANT, max_bio_size, DRBD_MAX_BIO_SIZE_DEF) 17 | __flg_field_def(2, 0 /* OPTIONAL */, intentional_diskless, DRBD_DISK_DISKLESS_DEF) 18 | + __str_field_def(3, DRBD_F_INVARIANT, mount_point, DRBD_WINDOWS_PATH_MAX) 19 | ) 20 | 21 | GENL_struct(DRBD_NLA_RESOURCE_INFO, 15, resource_info, 22 | -- 23 | 2.7.4 24 | 25 | -------------------------------------------------------------------------------- /transform.d/517-Windows-max-pathname-define.patch: -------------------------------------------------------------------------------- 1 | From 783390d402e7c5692b53dcefc76d6b7e0162782b Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Wed, 28 Mar 2018 17:09:06 +0200 4 | Subject: [PATCH 1/2] Max length of windows pathname define 5 | 6 | --- 7 | drbd-headers/linux/drbd.h | 4 ++++ 8 | 1 files changed, 4 insertions(+) 9 | 10 | diff --git a/drbd-headers/linux/drbd.h b/drbd-headers/linux/drbd.h 11 | index e43a898..ee39fb3 100644 12 | --- a/drbd-headers/linux/drbd.h 13 | +++ b/drbd-headers/linux/drbd.h 14 | @@ -51,6 +51,10 @@ 15 | 16 | #endif 17 | 18 | +/* Maximal length for the mount point in windrbd */ 19 | + 20 | +#define DRBD_WINDOWS_PATH_MAX 260 21 | + 22 | enum drbd_io_error_p { 23 | EP_PASS_ON, /* FIXME should the better be named "Ignore"? */ 24 | EP_CALL_HELPER, 25 | -------------------------------------------------------------------------------- /transform.d/525-Only-store-mount-point-on-drbdadm-create-minor.patch: -------------------------------------------------------------------------------- 1 | From bcee6d49f7ce794f4fabbd06c9e30ec0304de37d Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Mon, 28 May 2018 16:25:50 +0200 4 | Subject: [PATCH 2/3] Only store mount point on drbdadm create-minor. 5 | 6 | Mount it (next patch) on secondary -> primary state transistion. 7 | --- 8 | drbd/drbd_main.c | 2 +- 9 | 1 file changed, 1 insertion(+), 1 deletion(-) 10 | 11 | diff --git a/drbd/drbd_main.c b/drbd/drbd_main.c 12 | index 64544b2..8e54cf8 100644 13 | --- a/drbd/drbd_main.c 14 | +++ b/drbd/drbd_main.c 15 | @@ -3710,7 +3710,7 @@ enum drbd_ret_code drbd_create_device(struct drbd_config_context *adm_ctx, unsig 16 | } 17 | 18 | if (device_conf->mount_point && device_conf->mount_point[0]) { 19 | - if (windrbd_mount(block_device, device_conf->mount_point) < 0) { 20 | + if (windrbd_set_mount_point(block_device, device_conf->mount_point) < 0) { 21 | err = ERR_INVALID_REQUEST; 22 | goto out_couldnt_mount; 23 | } 24 | -- 25 | 2.7.4 26 | 27 | -------------------------------------------------------------------------------- /transform.d/530-Ignore-signed-unsigned-mismatch-in-drbd_strings.patch: -------------------------------------------------------------------------------- 1 | From 57619c6ff24a1170ef13e65369e5ce7c5b120071 Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Wed, 4 Jul 2018 20:48:52 +0200 4 | Subject: [PATCH] Ignore signed/unsigned mismatch in drbd_strings. 5 | 6 | --- 7 | drbd/drbd_strings.c | 3 +++ 8 | 1 file changed, 3 insertions(+) 9 | 10 | diff --git a/drbd/drbd_strings.c b/drbd/drbd_strings.c 11 | index 698a706..af02f5d 100644 12 | --- a/drbd/drbd_strings.c 13 | +++ b/drbd/drbd_strings.c 14 | @@ -200,6 +200,9 @@ struct state_names drbd_packet_names = { 15 | .size = sizeof __packet_names / sizeof __packet_names[0], 16 | }; 17 | 18 | +/* Do not warn about signed/unsigned mismatch */ 19 | +#pragma warning (disable : 4018) 20 | + 21 | const char *drbd_repl_str(enum drbd_repl_state s) 22 | { 23 | return (s < 0 || s >= drbd_repl_state_names.size || 24 | -- 25 | 2.17.0 26 | 27 | -------------------------------------------------------------------------------- /transform.d/537-Removed-unneccessary-fields-in-struct-drbd_thread.patch: -------------------------------------------------------------------------------- 1 | From ced50dcef37b6b2adafa71c37f38698b9d53783d Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Tue, 11 Sep 2018 15:37:05 +0200 4 | Subject: [PATCH] Removed unneccessary fields in struct drbd_thread. 5 | 6 | Since we are now (well .. almost) Linux compatible, we don't need 7 | them any more. 8 | --- 9 | drbd/drbd_int.h | 3 --- 10 | 1 file changed, 3 deletions(-) 11 | 12 | diff --git a/drbd/drbd_int.h b/drbd/drbd_int.h 13 | index 6a63fd8..6472d53 100644 14 | --- a/drbd/drbd_int.h 15 | +++ b/drbd/drbd_int.h 16 | @@ -214,9 +214,6 @@ enum drbd_thread_state { 17 | }; 18 | 19 | struct drbd_thread { 20 | - struct task_struct *nt; 21 | - KEVENT start_event; 22 | - KEVENT wait_event; 23 | spinlock_t t_lock; 24 | struct task_struct *task; 25 | struct completion stop; 26 | -- 27 | 2.17.0 28 | 29 | -------------------------------------------------------------------------------- /transform.d/541-Removed-max-path-define.patch: -------------------------------------------------------------------------------- 1 | From 1a5dd7b5d552d2ff1686a3e072d29ff5c99ef0b9 Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Tue, 18 Sep 2018 15:12:50 +0200 4 | Subject: [PATCH 2/3] Removed max path define. 5 | 6 | Since we are not passing mount point over netlink, this became 7 | obsolete. 8 | --- 9 | drbd-headers/linux/drbd.h | 4 ---- 10 | 1 file changed, 4 deletions(-) 11 | 12 | diff --git a/drbd-headers/linux/drbd.h b/drbd-headers/linux/drbd.h 13 | index 763d02d..d6b475c 100644 14 | --- a/drbd-headers/linux/drbd.h 15 | +++ b/drbd-headers/linux/drbd.h 16 | @@ -51,10 +51,6 @@ 17 | 18 | #endif 19 | 20 | -/* Maximal length for the mount point in windrbd */ 21 | - 22 | -#define DRBD_WINDOWS_PATH_MAX 260 23 | - 24 | enum drbd_io_error_p { 25 | EP_PASS_ON, /* FIXME should the better be named "Ignore"? */ 26 | EP_CALL_HELPER, 27 | -- 28 | 2.17.0 29 | 30 | -------------------------------------------------------------------------------- /transform.d/542-Removed-mount-point-field-from-netlink.patch: -------------------------------------------------------------------------------- 1 | From 625971ce444a05391fe3e098b833fcff5c9a5d4f Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Tue, 18 Sep 2018 15:13:25 +0200 4 | Subject: [PATCH 3/3] Removed mount-point field from netlink. 5 | 6 | We are now using ioctl's to pass this to kernel. Netlink interface is 7 | now the same (again) as the Linux version. 8 | --- 9 | drbd-headers/linux/drbd_genl.h | 1 - 10 | 1 file changed, 1 deletion(-) 11 | 12 | diff --git a/drbd-headers/linux/drbd_genl.h b/drbd-headers/linux/drbd_genl.h 13 | index e584787..011ae59 100644 14 | --- a/drbd-headers/linux/drbd_genl.h 15 | +++ b/drbd-headers/linux/drbd_genl.h 16 | @@ -218,7 +218,6 @@ GENL_struct(DRBD_NLA_DETACH_PARMS, 13, detach_parms, 17 | GENL_struct(DRBD_NLA_DEVICE_CONF, 14, device_conf, 18 | __u32_field_def(1, DRBD_F_INVARIANT, max_bio_size, DRBD_MAX_BIO_SIZE_DEF) 19 | __flg_field_def(2, 0 /* OPTIONAL */, intentional_diskless, DRBD_DISK_DISKLESS_DEF) 20 | - __str_field_def(3, DRBD_F_INVARIANT, mount_point, DRBD_WINDOWS_PATH_MAX) 21 | ) 22 | 23 | GENL_struct(DRBD_NLA_RESOURCE_INFO, 15, resource_info, 24 | -- 25 | 2.17.0 26 | 27 | -------------------------------------------------------------------------------- /transform.d/543-Changed-default-of-user-mode-helper.patch: -------------------------------------------------------------------------------- 1 | From 4239882c93f12eeccee2737a99ec67bdb2477fc4 Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Mon, 8 Oct 2018 19:36:14 +0200 4 | Subject: [PATCH] Changed default of user mode helper. 5 | 6 | /sbin does not exist if the application runs as a Windows service. 7 | --- 8 | drbd/drbd_main.c | 2 +- 9 | 1 file changed, 1 insertion(+), 1 deletion(-) 10 | 11 | diff --git a/drbd/drbd_main.c b/drbd/drbd_main.c 12 | index 01684cd..c9fb9fa 100644 13 | --- a/drbd/drbd_main.c 14 | +++ b/drbd/drbd_main.c 15 | @@ -118,7 +118,7 @@ module_param_named(allow_oos, drbd_allow_oos, bool, 0); 16 | unsigned int drbd_minor_count = DRBD_MINOR_COUNT_DEF; 17 | /* Module parameter for setting the user mode helper program 18 | * to run. Default is /sbin/drbdadm */ 19 | -char drbd_usermode_helper[80] = "/sbin/drbdadm"; 20 | +char drbd_usermode_helper[80] = "/cygdrive/c/windrbd/usr/sbin/drbdadm"; 21 | module_param_named(minor_count, drbd_minor_count, uint, 0444); 22 | module_param_string(usermode_helper, drbd_usermode_helper, sizeof(drbd_usermode_helper), 0644); 23 | 24 | -- 25 | 2.7.4 26 | 27 | -------------------------------------------------------------------------------- /transform.d/550-New-old-patch-for-bitmap-was-in-110-drbd_bitmap_C.pa.patch: -------------------------------------------------------------------------------- 1 | From ce07a1e86dcd21e395489b15786cc9634219c895 Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Fri, 12 Oct 2018 19:07:12 +0200 4 | Subject: [PATCH 1/5] New old patch for bitmap (was in 110-drbd_bitmap_C.patch) 5 | 6 | --- 7 | drbd/drbd_bitmap.c | 6 +++++- 8 | 1 file changed, 5 insertions(+), 1 deletion(-) 9 | 10 | diff --git a/drbd/drbd_bitmap.c b/drbd/drbd_bitmap.c 11 | index 9d84039..62efe7e 100644 12 | --- a/drbd/drbd_bitmap.c 13 | +++ b/drbd/drbd_bitmap.c 14 | @@ -1121,7 +1121,11 @@ static void bm_page_io_async(struct drbd_bm_aio_ctx *ctx, int page_nr) 15 | if (ctx->flags & BM_AIO_COPY_PAGES) { 16 | page = mempool_alloc(&drbd_md_io_page_pool, 17 | GFP_NOIO | __GFP_HIGHMEM); 18 | - copy_highpage(page, b->bm_pages[page_nr]); 19 | + expect(device, page); 20 | + 21 | + page->private = b->bm_pages[page_nr]->private; 22 | + memcpy(page->addr, b->bm_pages[page_nr]->addr, PAGE_SIZE); 23 | + 24 | bm_store_page_idx(page, page_nr); 25 | } else 26 | page = b->bm_pages[page_nr]; 27 | -- 28 | 2.17.0 29 | 30 | -------------------------------------------------------------------------------- /transform.d/552-New-old-patch-do-not-create-proc-drbd-was-133-rm-obv.patch: -------------------------------------------------------------------------------- 1 | From c1c9cfe858e68676138b17baf77c6e42b92c299e Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Fri, 12 Oct 2018 19:13:27 +0200 4 | Subject: [PATCH 3/5] New "old" patch: do not create /proc/drbd (was 5 | 133-rm-obvious_drbd_init-drbd_main_C.patch) 6 | 7 | --- 8 | drbd/drbd_main.c | 7 ------- 9 | 1 file changed, 7 deletions(-) 10 | 11 | diff --git a/drbd/drbd_main.c b/drbd/drbd_main.c 12 | index 59c8e3a..e022eea 100644 13 | --- a/drbd/drbd_main.c 14 | +++ b/drbd/drbd_main.c 15 | @@ -4055,13 +4055,6 @@ int __init drbd_init(void) 16 | goto fail; 17 | 18 | err = -ENOMEM; 19 | - drbd_proc = proc_create_single("drbd", S_IFREG | 0444 , NULL, 20 | - drbd_seq_show); 21 | - 22 | - if (!drbd_proc) { 23 | - pr_err("unable to register proc file\n"); 24 | - goto fail; 25 | - } 26 | 27 | retry.wq = alloc_ordered_workqueue("drbd-reissue", 0); 28 | if (!retry.wq) { 29 | -- 30 | 2.17.0 31 | 32 | -------------------------------------------------------------------------------- /transform.d/553-New-old-patch-was-149-drbd_main_C-no_biosets.patch.patch: -------------------------------------------------------------------------------- 1 | From d6ca9926bb1c053c483c1376b440bf283be48912 Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Fri, 12 Oct 2018 19:16:25 +0200 4 | Subject: [PATCH 4/5] New "old" patch: was 149-drbd_main_C-no_biosets.patch 5 | 6 | --- 7 | drbd/drbd_main.c | 2 ++ 8 | 1 file changed, 2 insertions(+) 9 | 10 | diff --git a/drbd/drbd_main.c b/drbd/drbd_main.c 11 | index e022eea..e1fd8c1 100644 12 | --- a/drbd/drbd_main.c 13 | +++ b/drbd/drbd_main.c 14 | @@ -2894,6 +2894,7 @@ static int drbd_create_mempools(void) 15 | if (drbd_al_ext_cache == NULL) 16 | goto Enomem; 17 | 18 | +#if 0 19 | /* mempools */ 20 | ret = bioset_init(&drbd_io_bio_set, BIO_POOL_SIZE, 0, 0); 21 | if (ret) 22 | @@ -2903,6 +2904,7 @@ static int drbd_create_mempools(void) 23 | BIOSET_NEED_BVECS); 24 | if (ret) 25 | goto Enomem; 26 | +#endif 27 | 28 | ret = mempool_init_page_pool(&drbd_md_io_page_pool, DRBD_MIN_POOL_PAGES, 0); 29 | if (ret) 30 | -- 31 | 2.17.0 32 | 33 | -------------------------------------------------------------------------------- /transform.d/554-bitmap-free-mempool-after-bio-put-was-507-free-mempo.patch: -------------------------------------------------------------------------------- 1 | From a6b0ebe6c33b4ace9798e3c775cb19295093ca73 Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Fri, 12 Oct 2018 19:20:17 +0200 4 | Subject: [PATCH 5/5] bitmap: free mempool after bio put (was 5 | 507-free-mempool-after-bio-put.patch) 6 | 7 | --- 8 | drbd/drbd_bitmap.c | 5 ++++- 9 | 1 file changed, 4 insertions(+), 1 deletion(-) 10 | 11 | diff --git a/drbd/drbd_bitmap.c b/drbd/drbd_bitmap.c 12 | index 62efe7e..e4cb5ee 100644 13 | --- a/drbd/drbd_bitmap.c 14 | +++ b/drbd/drbd_bitmap.c 15 | @@ -1082,10 +1082,13 @@ static void drbd_bm_endio BIO_ENDIO_ARGS(struct bio *bio) 16 | bm_page_unlock_io(device, idx); 17 | 18 | if (ctx->flags & BM_AIO_COPY_PAGES) 19 | - mempool_free(bio->bi_io_vec[0].bv_page, &drbd_md_io_page_pool); 20 | + page = bio->bi_io_vec[0].bv_page; 21 | 22 | bio_put(bio); 23 | 24 | + if (page) 25 | + mempool_free(page, &drbd_md_io_page_pool); 26 | + 27 | if (atomic_dec_and_test(&ctx->in_flight)) { 28 | ctx->done = 1; 29 | wake_up(&device->misc_wait); 30 | -- 31 | 2.17.0 32 | 33 | -------------------------------------------------------------------------------- /transform.d/555-Do-not-use-__reserved-as-identifier.patch: -------------------------------------------------------------------------------- 1 | From f95e45340d70af0888e60ad9bbc45d264fccb74a Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Tue, 16 Oct 2018 17:27:27 +0200 4 | Subject: [PATCH 1/4] Do not use __reserved as identifier. 5 | 6 | It is used for something else. 7 | --- 8 | drbd-headers/drbd_meta_data.h | 2 +- 9 | 1 file changed, 1 insertion(+), 1 deletion(-) 10 | 11 | diff --git a/drbd-headers/drbd_meta_data.h b/drbd-headers/drbd_meta_data.h 12 | index 35452ae..8b4eb27 100644 13 | --- a/drbd-headers/drbd_meta_data.h 14 | +++ b/drbd-headers/drbd_meta_data.h 15 | @@ -91,7 +91,7 @@ struct __packed al_transaction_on_disk { 16 | /* Some reserved bytes. Expected usage is a 64bit counter of 17 | * sectors-written since device creation, and other data generation tag 18 | * supporting usage */ 19 | - be_u32 __reserved[4]; 20 | + be_u32 __reserved_win[4]; 21 | 22 | /* --- 36 byte used --- */ 23 | 24 | -- 25 | 2.17.0 26 | 27 | -------------------------------------------------------------------------------- /transform.d/577-drbd_transport_tcp-forward-buffer-sizes-to-wsk-layer.patch: -------------------------------------------------------------------------------- 1 | From 42fbd5fb57c1110a19c83285dccdda782e5c4865 Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Sat, 9 Feb 2019 21:52:24 +0100 4 | Subject: [PATCH 07/16] drbd_transport_tcp: forward buffer sizes to wsk layer. 5 | 6 | Since struct sock is just a shadow copy, we need to adjust 7 | send/receive buffer sizes in a special API function (WinDRBD 8 | specific, it does not exist on Linux) 9 | --- 10 | drbd/drbd_transport_tcp.c | 1 + 11 | 1 file changed, 1 insertion(+) 12 | 13 | diff --git a/drbd/drbd_transport_tcp.c b/drbd/drbd_transport_tcp.c 14 | index 3aedc17..b620033 100644 15 | --- a/drbd/drbd_transport_tcp.c 16 | +++ b/drbd/drbd_transport_tcp.c 17 | @@ -420,6 +420,7 @@ static void dtt_setbufsize(struct socket *socket, unsigned int snd, 18 | socket->sk->sk_rcvbuf = rcv; 19 | socket->sk->sk_userlocks |= SOCK_RCVBUF_LOCK; 20 | } 21 | + windrbd_update_socket_buffer_sizes(socket); 22 | } 23 | 24 | static bool dtt_path_cmp_addr(struct dtt_path *path) 25 | -- 26 | 2.17.0 27 | 28 | -------------------------------------------------------------------------------- /transform.d/584-drbd_transport_tcp-hint-NOSPACE-does-not-exist-on-Wi.patch: -------------------------------------------------------------------------------- 1 | From 4ff0423085f207ada891c30ed9870a1934acd5d2 Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Sat, 9 Feb 2019 22:14:06 +0100 4 | Subject: [PATCH 14/16] drbd_transport_tcp: hint NOSPACE does not exist on 5 | Windows. 6 | 7 | In fact, most of the hints don't exist but are ignored silently. 8 | --- 9 | drbd/drbd_transport_tcp.c | 2 ++ 10 | 1 file changed, 2 insertions(+) 11 | 12 | diff --git a/drbd/drbd_transport_tcp.c b/drbd/drbd_transport_tcp.c 13 | index 1384799..58076dd 100644 14 | --- a/drbd/drbd_transport_tcp.c 15 | +++ b/drbd/drbd_transport_tcp.c 16 | @@ -1299,8 +1299,10 @@ static bool dtt_hint(struct drbd_transport *transport, enum drbd_stream stream, 17 | dtt_nodelay(socket); 18 | break; 19 | case NOSPACE: 20 | +#if 0 21 | if (socket->sk->sk_socket) 22 | set_bit(SOCK_NOSPACE, &socket->sk->sk_socket->flags); 23 | +#endif 24 | break; 25 | case QUICKACK: 26 | dtt_quickack(socket); 27 | -- 28 | 2.17.0 29 | 30 | -------------------------------------------------------------------------------- /transform.d/605-Rescan-Windows-PnP-bus-at-the-end-of-device-creation.patch: -------------------------------------------------------------------------------- 1 | From b5d92253dc1262f48a3d3502d05bb3fedf6da12c Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Wed, 19 Jun 2019 17:31:14 +0200 4 | Subject: [PATCH] Rescan Windows PnP bus at the end of device creation. 5 | 6 | We cannot do this within bdget() because bdget is called at the 7 | beginning where the drbd_device isn't set up yet. We need the 8 | drbd_device to find the corresponding windows devices. 9 | --- 10 | drbd/drbd_main.c | 3 +++ 11 | 1 file changed, 3 insertions(+) 12 | 13 | diff --git a/drbd/drbd_main.c b/drbd/drbd_main.c 14 | index 790b6f9..4cad14e 100644 15 | --- a/drbd/drbd_main.c 16 | +++ b/drbd/drbd_main.c 17 | @@ -3841,6 +3841,9 @@ enum drbd_ret_code drbd_create_device(struct drbd_config_context *adm_ctx, unsig 18 | */ 19 | device->this_bdev->drbd_device = device; 20 | 21 | + /* Tell the PnP manager that we are there ... */ 22 | + windrbd_rescan_bus(); 23 | + 24 | return NO_ERROR; 25 | 26 | out_remove_peer_device: 27 | -- 28 | 2.17.0 29 | 30 | -------------------------------------------------------------------------------- /transform.d/607-drbd_req-Use-new-prepare_to_wait-implementation.patch: -------------------------------------------------------------------------------- 1 | From 185be1ef02de3a8fa3f02997d92d42a7eaf13429 Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Tue, 30 Jul 2019 18:16:05 +0200 4 | Subject: [PATCH 2/4] drbd_req: Use new prepare_to_wait implementation. 5 | 6 | For now, the schedule function is called new_schedule since we 7 | didn't yet backport the wait_event_XXX macros and still need the 8 | old schedule implementation. 9 | --- 10 | drbd/drbd_req.c | 4 ++-- 11 | 1 file changed, 2 insertions(+), 2 deletions(-) 12 | 13 | diff --git a/drbd/drbd_req.c b/drbd/drbd_req.c 14 | index 90dd959..56c5431 100644 15 | --- a/drbd/drbd_req.c 16 | +++ b/drbd/drbd_req.c 17 | @@ -1285,7 +1285,7 @@ static void complete_conflicting_writes(struct drbd_request *req) 18 | prepare_to_wait(&device->misc_wait, &wait, TASK_UNINTERRUPTIBLE); 19 | i->waiting = true; 20 | spin_unlock_irq(&device->resource->req_lock); 21 | - schedule(&device->misc_wait, MAX_SCHEDULE_TIMEOUT, __FUNCTION__, __LINE__); 22 | + new_schedule(); 23 | 24 | spin_lock_irq(&device->resource->req_lock); 25 | } 26 | -- 27 | 2.17.0 28 | 29 | -------------------------------------------------------------------------------- /transform.d/609-drbd_sender-Use-new-prepare_to_wait-implementation.patch: -------------------------------------------------------------------------------- 1 | From fb33d8980b5064b4a476d0758fe9948c73aa20f8 Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Tue, 30 Jul 2019 18:16:33 +0200 4 | Subject: [PATCH 4/4] drbd_sender: Use new prepare_to_wait implementation. 5 | 6 | For now, the schedule function is called new_schedule since we 7 | didn't yet backport the wait_event_XXX macros and still need the 8 | old schedule implementation. 9 | --- 10 | drbd/drbd_sender.c | 2 +- 11 | 1 file changed, 1 insertion(+), 1 deletion(-) 12 | 13 | diff --git a/drbd/drbd_sender.c b/drbd/drbd_sender.c 14 | index fb28cc6..0940610 100644 15 | --- a/drbd/drbd_sender.c 16 | +++ b/drbd/drbd_sender.c 17 | @@ -2667,7 +2667,7 @@ static void wait_for_sender_todo(struct drbd_connection *connection) 18 | if (get_t_state(&connection->sender) != RUNNING) 19 | break; 20 | 21 | - schedule(&connection->sender_work.q_wait, SENDER_SCHEDULE_TIMEOUT, __FUNCTION__, __LINE__); 22 | + new_schedule(); 23 | /* may be woken up for other things but new work, too, 24 | * e.g. if the current epoch got closed. 25 | * In which case we send the barrier above. */ 26 | -- 27 | 2.17.0 28 | 29 | -------------------------------------------------------------------------------- /transform.d/611-drbd_main.c-Print-from-where-schedule-is-called.patch: -------------------------------------------------------------------------------- 1 | From e54333c6acdbcd15b281b8205608fcf61ea0c8a0 Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Mon, 5 Aug 2019 16:33:28 +0200 4 | Subject: [PATCH 1/4] drbd_main.c: Print from where schedule is called. 5 | 6 | This is good for debugging purposes. 7 | --- 8 | drbd/drbd_main.c | 2 +- 9 | 1 file changed, 1 insertion(+), 1 deletion(-) 10 | 11 | diff --git a/drbd/drbd_main.c b/drbd/drbd_main.c 12 | index 70acc2f..ffd1832 100644 13 | --- a/drbd/drbd_main.c 14 | +++ b/drbd/drbd_main.c 15 | @@ -5427,7 +5427,7 @@ int drbd_wait_misc(struct drbd_device *device, struct drbd_peer_device *peer_dev 16 | i->waiting = true; 17 | prepare_to_wait(&device->misc_wait, &wait, TASK_INTERRUPTIBLE); 18 | spin_unlock_irq(&device->resource->req_lock); 19 | - timeout = new_schedule_timeout(timeout); 20 | + timeout = new_schedule_timeout(timeout, __FILE__, __LINE__, __func__); 21 | finish_wait(&device->misc_wait, &wait); 22 | spin_lock_irq(&device->resource->req_lock); 23 | if (!timeout || (peer_device && peer_device->repl_state[NOW] < L_ESTABLISHED)) 24 | -- 25 | 2.17.0 26 | 27 | -------------------------------------------------------------------------------- /transform.d/613-drbd_sender.c-Print-from-where-schedule-is-called.patch: -------------------------------------------------------------------------------- 1 | From 16d39289ca4034c0f79d39f0039ffcdcc19406fc Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Mon, 5 Aug 2019 16:34:53 +0200 4 | Subject: [PATCH 3/4] drbd_sender.c: Print from where schedule is called. 5 | 6 | This is good for debugging purposes. 7 | --- 8 | drbd/drbd_sender.c | 2 +- 9 | 1 file changed, 1 insertion(+), 1 deletion(-) 10 | 11 | diff --git a/drbd/drbd_sender.c b/drbd/drbd_sender.c 12 | index 0940610..2b1a9c0 100644 13 | --- a/drbd/drbd_sender.c 14 | +++ b/drbd/drbd_sender.c 15 | @@ -2667,7 +2667,7 @@ static void wait_for_sender_todo(struct drbd_connection *connection) 16 | if (get_t_state(&connection->sender) != RUNNING) 17 | break; 18 | 19 | - new_schedule(); 20 | + new_schedule(__FILE__, __LINE__, __func__); 21 | /* may be woken up for other things but new work, too, 22 | * e.g. if the current epoch got closed. 23 | * In which case we send the barrier above. */ 24 | -- 25 | 2.17.0 26 | 27 | -------------------------------------------------------------------------------- /transform.d/614-drbd_req.c-Print-from-where-schedule-is-called.patch: -------------------------------------------------------------------------------- 1 | From 496543ee6e21fe94f1364df7764160e21a8787e1 Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Mon, 5 Aug 2019 16:35:17 +0200 4 | Subject: [PATCH 4/4] drbd_req.c: Print from where schedule is called. 5 | 6 | This is good for debugging purposes. 7 | --- 8 | drbd/drbd_req.c | 4 ++-- 9 | 1 file changed, 2 insertions(+), 2 deletions(-) 10 | 11 | diff --git a/drbd/drbd_req.c b/drbd/drbd_req.c 12 | index 56c5431..32a0226 100644 13 | --- a/drbd/drbd_req.c 14 | +++ b/drbd/drbd_req.c 15 | @@ -1285,7 +1285,7 @@ static void complete_conflicting_writes(struct drbd_request *req) 16 | prepare_to_wait(&device->misc_wait, &wait, TASK_UNINTERRUPTIBLE); 17 | i->waiting = true; 18 | spin_unlock_irq(&device->resource->req_lock); 19 | - new_schedule(); 20 | + new_schedule(__FILE__, __LINE__, __func__); 21 | 22 | spin_lock_irq(&device->resource->req_lock); 23 | } 24 | -- 25 | 2.17.0 26 | 27 | -------------------------------------------------------------------------------- /transform.d/615-stable-state-change-return.cocci: -------------------------------------------------------------------------------- 1 | @@ 2 | identifier func; 3 | expression list E; 4 | @@ 5 | func(...) { 6 | + int __ret; 7 | <+... 8 | ( 9 | - return stable_state_change(E); 10 | + stable_state_change(__ret, E); 11 | + return __ret; 12 | ) 13 | ...+> 14 | } 15 | 16 | @@ 17 | identifier t; 18 | expression list E; 19 | @@ 20 | - t = stable_state_change(E) 21 | + stable_state_change(t, E) 22 | -------------------------------------------------------------------------------- /transform.d/621-CP-transport-dtt_wait_for_connect-always-return-EAG.patch: -------------------------------------------------------------------------------- 1 | From e170b7eace85536cfb0cebcdc73278ba63639572 Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Wed, 7 Aug 2019 18:18:51 +0200 4 | Subject: [PATCH] TCP transport dtt_wait_for_connect: always return -EAGAIN on 5 | error 6 | 7 | This is how original DRBD does it. It should be like that. 8 | --- 9 | drbd/drbd_transport_tcp.c | 4 +--- 10 | 1 file changed, 1 insertion(+), 3 deletions(-) 11 | 12 | diff --git a/drbd/drbd_transport_tcp.c b/drbd/drbd_transport_tcp.c 13 | index 9a986b3..24a0805 100644 14 | --- a/drbd/drbd_transport_tcp.c 15 | +++ b/drbd/drbd_transport_tcp.c 16 | @@ -656,9 +656,7 @@ retry: 17 | wait_event_interruptible_timeout(timeo_ret, listener->wait, 18 | (path = dtt_wait_connect_cond(transport)), 19 | timeo); 20 | - if (timeo_ret == -EINTR) 21 | - return -EINTR; 22 | - if (timeo_ret == -ETIMEDOUT) 23 | + if (timeo_ret <= 0) 24 | return -EAGAIN; 25 | 26 | spin_lock_bh(&listener->listener.waiters_lock); 27 | -- 28 | 2.17.0 29 | 30 | -------------------------------------------------------------------------------- /transform.d/622-drbd_main-restored-original-schedule-interface.patch: -------------------------------------------------------------------------------- 1 | From 7f2434b244bd5abb003e0049c5b84fded7d02619 Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Tue, 27 Aug 2019 16:27:09 +0200 4 | Subject: [PATCH 1/4] drbd_main: restored original schedule interface 5 | 6 | --- 7 | drbd/drbd_main.c | 2 +- 8 | 1 file changed, 1 insertion(+), 1 deletion(-) 9 | 10 | diff --git a/drbd/drbd_main.c b/drbd/drbd_main.c 11 | index ffd1832..4cad14e 100644 12 | --- a/drbd/drbd_main.c 13 | +++ b/drbd/drbd_main.c 14 | @@ -5427,7 +5427,7 @@ int drbd_wait_misc(struct drbd_device *device, struct drbd_peer_device *peer_dev 15 | i->waiting = true; 16 | prepare_to_wait(&device->misc_wait, &wait, TASK_INTERRUPTIBLE); 17 | spin_unlock_irq(&device->resource->req_lock); 18 | - timeout = new_schedule_timeout(timeout, __FILE__, __LINE__, __func__); 19 | + timeout = schedule_timeout(timeout); 20 | finish_wait(&device->misc_wait, &wait); 21 | spin_lock_irq(&device->resource->req_lock); 22 | if (!timeout || (peer_device && peer_device->repl_state[NOW] < L_ESTABLISHED)) 23 | -- 24 | 2.17.0 25 | 26 | -------------------------------------------------------------------------------- /transform.d/624-drbd_req-restored-original-schedule-interface.patch: -------------------------------------------------------------------------------- 1 | From 06189c5a285ed8a0a03f8a7dd6055fb7ef87f1ba Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Tue, 27 Aug 2019 16:28:10 +0200 4 | Subject: [PATCH 3/4] drbd_req: restored original schedule interface 5 | 6 | --- 7 | drbd/drbd_req.c | 14 +++++++++++--- 8 | 1 file changed, 11 insertions(+), 3 deletions(-) 9 | 10 | diff --git a/drbd/drbd_req.c b/drbd/drbd_req.c 11 | index 32a0226..831b7ac 100644 12 | --- a/drbd/drbd_req.c 13 | +++ b/drbd/drbd_req.c 14 | @@ -1285,7 +1285,7 @@ static void complete_conflicting_writes(struct drbd_request *req) 15 | prepare_to_wait(&device->misc_wait, &wait, TASK_UNINTERRUPTIBLE); 16 | i->waiting = true; 17 | spin_unlock_irq(&device->resource->req_lock); 18 | - new_schedule(__FILE__, __LINE__, __func__); 19 | + schedule(); 20 | 21 | spin_lock_irq(&device->resource->req_lock); 22 | } 23 | -- 24 | 2.17.0 25 | 26 | -------------------------------------------------------------------------------- /transform.d/625-drbd_sender-restored-original-schedule-interface.patch: -------------------------------------------------------------------------------- 1 | From ed5a4d8f9fa2ccaa343988b2df0f0169a2a58693 Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Tue, 27 Aug 2019 16:28:28 +0200 4 | Subject: [PATCH 4/4] drbd_sender: restored original schedule interface 5 | 6 | --- 7 | drbd/drbd_sender.c | 4 +++- 8 | 1 file changed, 3 insertions(+), 1 deletion(-) 9 | 10 | diff --git a/drbd/drbd_sender.c b/drbd/drbd_sender.c 11 | index 2b1a9c0..edf47de 100644 12 | --- a/drbd/drbd_sender.c 13 | +++ b/drbd/drbd_sender.c 14 | @@ -2667,7 +2669,7 @@ static void wait_for_sender_todo(struct drbd_connection *connection) 15 | if (get_t_state(&connection->sender) != RUNNING) 16 | break; 17 | 18 | - new_schedule(__FILE__, __LINE__, __func__); 19 | + schedule(); 20 | /* may be woken up for other things but new work, too, 21 | * e.g. if the current epoch got closed. 22 | * In which case we send the barrier above. */ 23 | -- 24 | 2.17.0 25 | 26 | -------------------------------------------------------------------------------- /transform.d/626-Check-for-device-NULL-in-tl_mark_for_resend_by_conne.patch: -------------------------------------------------------------------------------- 1 | From b0f951a6a0de5c503f68e414cdffbbb480584d65 Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Fri, 20 Dec 2019 18:47:13 +0100 4 | Subject: [PATCH] Check for device == NULL in 5 | tl_mark_for_resend_by_connection() 6 | 7 | This happens when running drop-dont-drop loop on peer while 8 | being primary and doing I/O and there are lots of printk's 9 | (unrelated) in the drbd_receiver (which change the timings). 10 | --- 11 | drbd/drbd_sender.c | 3 +++ 12 | 1 file changed, 3 insertions(+) 13 | 14 | diff --git a/drbd/drbd_sender.c b/drbd/drbd_sender.c 15 | index 30a3803..04b7591 100644 16 | --- a/drbd/drbd_sender.c 17 | +++ b/drbd/drbd_sender.c 18 | @@ -2494,6 +2494,9 @@ restart: 19 | list_for_each_entry_continue(struct drbd_request, req, &connection->resource->transfer_log, tl_requests) { 20 | /* potentially needed in complete_master_bio below */ 21 | device = req->device; 22 | + if (device == NULL) 23 | + continue; 24 | + 25 | peer_device = conn_peer_device(connection, device->vnr); 26 | s = drbd_req_state_by_peer_device(req, peer_device); 27 | 28 | -- 29 | 2.17.0 30 | 31 | -------------------------------------------------------------------------------- /transform.d/628-drbd_int-include-kconfig.h.patch: -------------------------------------------------------------------------------- 1 | From f8764ed1f83018c8c99717a2969c872d42bb9d08 Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Mon, 9 Mar 2020 18:24:28 +0100 4 | Subject: [PATCH] drbd_int: include kconfig.h 5 | 6 | Needed for IS_DEFINED macro test. 7 | --- 8 | drbd/drbd_int.h | 1 + 9 | 1 file changed, 1 insertion(+) 10 | 11 | diff --git a/drbd/drbd_int.h b/drbd/drbd_int.h 12 | index f9f676f..05eeb0d 100644 13 | --- a/drbd/drbd_int.h 14 | +++ b/drbd/drbd_int.h 15 | @@ -35,6 +35,7 @@ 16 | #include 17 | #include 18 | #include 19 | +#include 20 | 21 | #include "drbd_wrappers.h" 22 | #include "drbd_strings.h" 23 | -- 24 | 2.17.0 25 | 26 | -------------------------------------------------------------------------------- /transform.d/630-drbd_sender-include-type-in-from_timer-macro.patch: -------------------------------------------------------------------------------- 1 | From 46fcb8f1c8ef3c2c593316b0a90fff1898c4834d Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Wed, 18 Mar 2020 10:38:32 +0100 4 | Subject: [PATCH] drbd_sender: include type in from_timer macro 5 | 6 | Because we don't have typeof we need to explicitly specify 7 | the type. 8 | --- 9 | drbd/drbd_sender.c | 2 +- 10 | 1 file changed, 1 insertion(+), 1 deletion(-) 11 | 12 | diff --git a/drbd/drbd_sender.c b/drbd/drbd_sender.c 13 | index 621f6c0..fefd72f 100644 14 | --- a/drbd/drbd_sender.c 15 | +++ b/drbd/drbd_sender.c 16 | @@ -489,7 +489,7 @@ int w_send_uuids(struct drbd_work *w, int cancel) 17 | 18 | void resync_timer_fn(struct timer_list *t) 19 | { 20 | - struct drbd_peer_device *peer_device = from_timer(peer_device, t, resync_timer); 21 | + struct drbd_peer_device *peer_device = from_timer(peer_device, t, resync_timer, struct drbd_peer_device); 22 | 23 | if (test_bit(SYNC_TARGET_TO_BEHIND, &peer_device->flags)) 24 | return; 25 | -- 26 | 2.17.0 27 | 28 | -------------------------------------------------------------------------------- /transform.d/633-drbd_receiver-initalize-iter.patch: -------------------------------------------------------------------------------- 1 | From c2718d3567aecb6e266706093b8166e8014d9a6a Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Wed, 18 Mar 2020 16:05:37 +0100 4 | Subject: [PATCH] drbd_receiver: initalize iter 5 | 6 | Probably a false positive of the MS compiler: it complains 7 | about iter being uninitialized. 8 | --- 9 | drbd/drbd_receiver.c | 1 + 10 | 1 file changed, 1 insertion(+) 11 | 12 | diff --git a/drbd/drbd_receiver.c b/drbd/drbd_receiver.c 13 | index 115eb7c..748364e 100644 14 | --- a/drbd/drbd_receiver.c 15 | +++ b/drbd/drbd_receiver.c 16 | @@ -2051,6 +2051,7 @@ static int recv_dless_read(struct drbd_peer_device *peer_device, struct drbd_req 17 | bio = req->master_bio; 18 | D_ASSERT(peer_device->device, sector == bio->bi_iter.bi_sector); 19 | 20 | + iter = bio->bi_iter; 21 | bio_for_each_segment(bvec, bio, iter) { 22 | void *mapped = ((u8*)kmap(bvec.bv_page)) + bvec.bv_offset; 23 | expect = min_t(int, data_size, bvec.bv_len); 24 | -- 25 | 2.17.0 26 | 27 | -------------------------------------------------------------------------------- /transform.d/634-drbd_req-type-for-from_timer.patch: -------------------------------------------------------------------------------- 1 | From 625899a9366c973138f0c87222430e0e7f8ffbae Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Wed, 18 Mar 2020 17:27:49 +0100 4 | Subject: [PATCH] drbd_req: type for from_timer 5 | 6 | --- 7 | drbd/drbd_req.c | 3 +-- 8 | 1 file changed, 1 insertion(+), 2 deletions(-) 9 | 10 | diff --git a/drbd/drbd_req.c b/drbd/drbd_req.c 11 | index 4e78a6e..8dfcaf4 100644 12 | --- a/drbd/drbd_req.c 13 | +++ b/drbd/drbd_req.c 14 | @@ -2326,7 +2325,7 @@ void request_timer_fn(struct timer_list *t) 15 | { 16 | KIRQL rcu_flags; 17 | KIRQL flags; 18 | - struct drbd_device *device = from_timer(device, t, request_timer); 19 | + struct drbd_device *device = from_timer(device, t, request_timer, struct drbd_device); 20 | struct drbd_connection *connection; 21 | struct drbd_request *req_read, *req_write; 22 | ULONG_PTR oldest_submit_jif; 23 | -- 24 | 2.17.0 25 | 26 | -------------------------------------------------------------------------------- /transform.d/635-drbd_main-removed-a-const-qualifier.patch: -------------------------------------------------------------------------------- 1 | From b89a4aa45814fb1203eb2aff528e330c00d4b030 Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Wed, 18 Mar 2020 18:22:22 +0100 4 | Subject: [PATCH] drbd_main: removed a const qualifier. 5 | 6 | MS C complains (while GNU C does not) 7 | --- 8 | drbd/drbd_main.c | 2 +- 9 | 1 file changed, 1 insertion(+), 1 deletion(-) 10 | 11 | diff --git a/drbd/drbd_main.c b/drbd/drbd_main.c 12 | index 2a88368..8f87873 100644 13 | --- a/drbd/drbd_main.c 14 | +++ b/drbd/drbd_main.c 15 | @@ -1542,7 +1542,7 @@ void drbd_gen_and_send_sync_uuid(struct drbd_peer_device *peer_device) 16 | } 17 | 18 | /* All callers hold resource->conf_update */ 19 | -int drbd_attach_peer_device(struct drbd_peer_device *const peer_device) 20 | +int drbd_attach_peer_device(struct drbd_peer_device *peer_device) 21 | { 22 | struct lru_cache *resync_lru = NULL; 23 | int err = -ENOMEM; 24 | -- 25 | 2.17.0 26 | 27 | -------------------------------------------------------------------------------- /transform.d/637-drbd_main-initialize-iter.patch: -------------------------------------------------------------------------------- 1 | From 77148bd288a8499508e629e250eb71c09dea8cc8 Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Wed, 18 Mar 2020 20:58:20 +0100 4 | Subject: [PATCH] drbd_main: initialize iter. 5 | 6 | This fixes a false positive error (complain about uninitialized 7 | variable) 8 | --- 9 | drbd/drbd_main.c | 1 + 10 | 1 file changed, 1 insertion(+) 11 | 12 | diff --git a/drbd/drbd_main.c b/drbd/drbd_main.c 13 | index c3bf7a8..5ac916d 100644 14 | --- a/drbd/drbd_main.c 15 | +++ b/drbd/drbd_main.c 16 | @@ -2157,6 +2157,7 @@ static int _drbd_send_bio(struct drbd_peer_device *peer_device, struct bio *bio) 17 | connection->send_buffer[DATA_STREAM].allocated_size = 0; 18 | 19 | /* hint all but last page with MSG_MORE */ 20 | + iter = bio->bi_iter; 21 | bio_for_each_segment(bvec, bio, iter) { 22 | int err; 23 | 24 | -- 25 | 2.17.0 26 | 27 | -------------------------------------------------------------------------------- /transform.d/638-TCP-transport-initialize-iter.patch: -------------------------------------------------------------------------------- 1 | From a88e0a0383f929a0cf53f5226bb7df678d898e20 Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Thu, 19 Mar 2020 11:28:44 +0100 4 | Subject: [PATCH] TCP transport: initialize iter. 5 | 6 | Probably a weird compiler bug (false positive). 7 | --- 8 | drbd/drbd_transport_tcp.c | 1 + 9 | 1 file changed, 1 insertion(+) 10 | 11 | diff --git a/drbd/drbd_transport_tcp.c b/drbd/drbd_transport_tcp.c 12 | index 4689333..eef9231 100644 13 | --- a/drbd/drbd_transport_tcp.c 14 | +++ b/drbd/drbd_transport_tcp.c 15 | @@ -1229,6 +1229,7 @@ static int dtt_send_zc_bio(struct drbd_transport *transport, struct bio *bio) 16 | struct bio_vec bvec; 17 | struct bvec_iter iter; 18 | 19 | + iter = bio->bi_iter; 20 | bio_for_each_segment(bvec, bio, iter) { 21 | int err; 22 | 23 | -- 24 | 2.17.0 25 | 26 | -------------------------------------------------------------------------------- /transform.d/642-Run-ack-receiver-with-real-time-priority.patch: -------------------------------------------------------------------------------- 1 | From 099e209ce7e5d6e1e038cb5036bb9534860ffcdd Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Mon, 6 Apr 2020 22:59:12 +0200 4 | Subject: [PATCH] Run ack-receiver with real time priority. 5 | 6 | This should solve crash and system hangs with testing with 7 | Jens Axboe's fio tester (with iodepth=1000 and direct=1) 8 | --- 9 | drbd/drbd_receiver.c | 1 + 10 | 1 file changed, 1 insertion(+) 11 | 12 | diff --git a/drbd/drbd_receiver.c b/drbd/drbd_receiver.c 13 | index df67f00..9651d0a 100644 14 | --- a/drbd/drbd_receiver.c 15 | +++ b/drbd/drbd_receiver.c 16 | @@ -893,6 +893,7 @@ start: 17 | have_mutex = false; 18 | 19 | drbd_thread_start(&connection->ack_receiver); 20 | + windrbd_set_realtime_priority(connection->ack_receiver.task); 21 | connection->ack_sender = 22 | alloc_ordered_workqueue("drbd_as_%s", WQ_MEM_RECLAIM, connection->resource->name); 23 | if (!connection->ack_sender) { 24 | -- 25 | 2.17.0 26 | 27 | -------------------------------------------------------------------------------- /transform.d/645-spin_lock_irqrestore.cocci: -------------------------------------------------------------------------------- 1 | @@ 2 | identifier func; 3 | expression lock; 4 | @@ 5 | func(...) { 6 | + KIRQL spin_lock_irq_flags; 7 | <+... 8 | - spin_lock_irq(lock); 9 | + spin_lock_irqsave(lock, spin_lock_irq_flags); 10 | ... 11 | - spin_unlock_irq(lock); 12 | + spin_unlock_irqrestore(lock, spin_lock_irq_flags); 13 | ...+> 14 | } 15 | @@ 16 | identifier func; 17 | expression lock; 18 | @@ 19 | func(...) { 20 | + KIRQL spin_lock_flags; 21 | <+... 22 | - spin_lock(lock); 23 | + spin_lock_irqsave(lock, spin_lock_flags); 24 | ... 25 | - spin_unlock(lock); 26 | + spin_unlock_irqrestore(lock, spin_lock_flags); 27 | ...+> 28 | } 29 | -------------------------------------------------------------------------------- /transform.d/646-init_transport-function.patch: -------------------------------------------------------------------------------- 1 | From ca6821f3c472224e5941f6fcd94c175aa7e7c944 Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Mon, 27 Apr 2020 20:15:14 +0200 4 | Subject: [PATCH] init_transport function. 5 | 6 | We cannot initialize a KSEMAPHORE using a static initializer, 7 | therefore init_rwsem() has to be called early (before initializing 8 | TCP/IP transport). 9 | --- 10 | drbd/drbd_transport.c | 5 +++++ 11 | 1 file changed, 5 insertions(+) 12 | 13 | diff --git a/drbd/drbd_transport.c b/drbd/drbd_transport.c 14 | index 627a21a..e600803 100644 15 | --- a/drbd/drbd_transport.c 16 | +++ b/drbd/drbd_transport.c 17 | @@ -331,6 +331,11 @@ void drbd_path_event(struct drbd_transport *transport, struct drbd_path *path) 18 | notify_path(connection, path, NOTIFY_CHANGE); 19 | } 20 | 21 | +void init_transport(void) 22 | +{ 23 | + init_rwsem(&transport_classes_lock); 24 | +} 25 | + 26 | /* Network transport abstractions */ 27 | EXPORT_SYMBOL_GPL(drbd_register_transport_class); 28 | EXPORT_SYMBOL_GPL(drbd_unregister_transport_class); 29 | -- 30 | 2.17.0 31 | 32 | -------------------------------------------------------------------------------- /transform.d/666-drbd_req-Always-use-KIRQL-as-datatype-for-IRQ-flags.patch: -------------------------------------------------------------------------------- 1 | From 04497739ed3a250a5f10ad77c9ca5bf52c8204f5 Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Fri, 8 May 2020 16:40:58 +0200 4 | Subject: [PATCH 12/12] drbd_req: Always use KIRQL as datatype for IRQ flags. 5 | 6 | --- 7 | drbd/drbd_req.c | 6 +++--- 8 | 1 file changed, 3 insertions(+), 3 deletions(-) 9 | 10 | diff --git a/drbd/drbd_req.c b/drbd/drbd_req.c 11 | index 155ce86..3e984e9 100644 12 | --- a/drbd/drbd_req.c 13 | +++ b/drbd/drbd_req.c 14 | @@ -164,7 +164,7 @@ void drbd_req_destroy(struct kref *kref) 15 | 16 | #ifdef CONFIG_DRBD_TIMING_STATS 17 | if (s & RQ_WRITE) { 18 | - ULONG_PTR flags; 19 | + KIRQL flags; 20 | 21 | spin_lock_irqsave(&device->timing_lock, flags); 22 | device->reqs++; 23 | @@ -1705,7 +1705,7 @@ static void drbd_send_and_submit(struct drbd_device *device, struct drbd_request 24 | struct bio_and_error m = { NULL, }; 25 | bool no_remote = false; 26 | bool submit_private_bio = false; 27 | - int flags; 28 | + KIRQL flags; 29 | 30 | spin_lock_irqsave(&resource->req_lock, flags); 31 | if (rw == WRITE) { 32 | -- 33 | 2.17.0 34 | 35 | -------------------------------------------------------------------------------- /transform.d/667-Do-not-use-struct_size-macro.patch: -------------------------------------------------------------------------------- 1 | From 1ea0c39f6f333d8ea004bfeec4066cbf15d20953 Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Mon, 12 Oct 2020 13:41:14 +0200 4 | Subject: [PATCH 1/6] Do not use struct_size macro 5 | 6 | It uses typeof() and several other Linux specific macros. 7 | --- 8 | drbd/drbd_sender.c | 2 +- 9 | 1 file changed, 1 insertion(+), 1 deletion(-) 10 | 11 | diff --git a/drbd/drbd_sender.c b/drbd/drbd_sender.c 12 | index 55087b7..ac3cdb0 100644 13 | --- a/drbd/drbd_sender.c 14 | +++ b/drbd/drbd_sender.c 15 | @@ -533,7 +533,7 @@ struct fifo_buffer *fifo_alloc(unsigned int fifo_size) 16 | { 17 | struct fifo_buffer *fb; 18 | 19 | - fb = kzalloc(struct_size(fb, values, fifo_size), GFP_NOIO); 20 | + fb = kzalloc(sizeof(struct fifo_buffer) + sizeof(int) * fifo_size, GFP_NOIO, '00WD'); 21 | if (!fb) 22 | return NULL; 23 | 24 | -- 25 | 2.17.0 26 | 27 | -------------------------------------------------------------------------------- /transform.d/671-Pass-KIRQL-flags-argument-to-abort.-function.patch: -------------------------------------------------------------------------------- 1 | From 86a8b7140100400cf22a4ab2314c694be56c00c6 Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Mon, 12 Oct 2020 14:30:49 +0200 4 | Subject: [PATCH 5/6] Pass KIRQL flags argument to abort..() function. 5 | 6 | It uses this flag for resetting the current IRQL when releasing 7 | the req lock. 8 | --- 9 | drbd/drbd_receiver.c | 2 +- 10 | 1 file changed, 1 insertion(+), 1 deletion(-) 11 | 12 | diff --git a/drbd/drbd_receiver.c b/drbd/drbd_receiver.c 13 | index c7f1448..eabc1e3 100644 14 | --- a/drbd/drbd_receiver.c 15 | +++ b/drbd/drbd_receiver.c 16 | @@ -8142,7 +8142,7 @@ static void cleanup_remote_state_change(struct drbd_connection *connection) 17 | if (remote) { 18 | __clear_remote_state_change(resource); 19 | } else { 20 | - enum alt_rv alt_rv = abort_local_transaction(resource, 0); 21 | + enum alt_rv alt_rv = abort_local_transaction(resource, 0, &spin_lock_irq_flags); 22 | if (alt_rv != ALT_LOCKED) 23 | return; 24 | } 25 | -- 26 | 2.17.0 27 | 28 | -------------------------------------------------------------------------------- /transform.d/672-Reverted-to-old-blk_alloc_queue-interface.patch: -------------------------------------------------------------------------------- 1 | From 019eabda9313a4c20090d807b5dedff0c18c2885 Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Mon, 12 Oct 2020 15:56:33 +0200 4 | Subject: [PATCH 6/6] Reverted to old blk_alloc_queue interface. 5 | 6 | Now everything builds with 9.0.25 7 | --- 8 | drbd/drbd_main.c | 2 +- 9 | 1 file changed, 1 insertion(+), 1 deletion(-) 10 | 11 | diff --git a/drbd/drbd_main.c b/drbd/drbd_main.c 12 | index 2b5c22a..0cbf9e2 100644 13 | --- a/drbd/drbd_main.c 14 | +++ b/drbd/drbd_main.c 15 | -- 16 | 2.17.0 17 | 18 | -------------------------------------------------------------------------------- /transform.d/675-drbd_int.h-Eliminate-spin_lock_irq-from-drbd_wait_mi.patch: -------------------------------------------------------------------------------- 1 | From 5cfc9e8c3ee1fd003b66ef8975346659370b5029 Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Fri, 30 Oct 2020 13:36:34 +0100 4 | Subject: [PATCH 3/6] drbd_int.h: Eliminate spin_lock_irq from 5 | drbd_wait_misc(). 6 | 7 | We should only use the spin_lock_irqsave/spin_unlock_irqrestore 8 | macros. 9 | --- 10 | drbd/drbd_int.h | 2 +- 11 | 1 file changed, 1 insertion(+), 1 deletion(-) 12 | 13 | diff --git a/drbd/drbd_int.h b/drbd/drbd_int.h 14 | index e601d21..2c95ea9 100644 15 | --- a/drbd/drbd_int.h 16 | +++ b/drbd/drbd_int.h 17 | @@ -227,7 +227,7 @@ enum drbd_stream; 18 | 19 | #include "drbd_interval.h" 20 | 21 | -extern int drbd_wait_misc(struct drbd_device *, struct drbd_peer_device *, struct drbd_interval *); 22 | +extern int drbd_wait_misc(struct drbd_device *, struct drbd_peer_device *, struct drbd_interval *, KIRQL *); 23 | 24 | extern void lock_all_resources(void); 25 | extern void unlock_all_resources(void); 26 | -- 27 | 2.17.0 28 | 29 | -------------------------------------------------------------------------------- /transform.d/686-gendisk-now-has-a-reference-to-block_device.patch: -------------------------------------------------------------------------------- 1 | From 11f3a3e2b7a42630c96b7e7dbe92c0ae241e5304 Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Wed, 24 Mar 2021 13:30:05 +0100 4 | Subject: [PATCH 1/4] gendisk now has a reference to block_device. 5 | 6 | So we can find the capacity of the gendisk. 7 | --- 8 | drbd/drbd_main.c | 1 + 9 | 1 file changed, 1 insertion(+) 10 | 11 | diff --git a/drbd/drbd_main.c b/drbd/drbd_main.c 12 | index b71c1fb..7553ca7 100644 13 | --- a/drbd/drbd_main.c 14 | +++ b/drbd/drbd_main.c 15 | @@ -3749,6 +3749,7 @@ enum drbd_ret_code drbd_create_device(struct drbd_config_context *adm_ctx, unsig 16 | disk->fops = &drbd_ops; 17 | sprintf(disk->disk_name, "drbd%d", minor); 18 | disk->private_data = device; 19 | + disk->bdev = block_device; 20 | 21 | device->this_bdev = block_device; 22 | /* TODO: leaks existing disk */ 23 | -- 24 | 2.17.0 25 | 26 | -------------------------------------------------------------------------------- /transform.d/687-Added-this_bdev-member-to-drbd_device-struct.patch: -------------------------------------------------------------------------------- 1 | From 5504464412bb18b4bce7e1f77fa87bd8f030cfe6 Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Wed, 24 Mar 2021 13:48:06 +0100 4 | Subject: [PATCH 2/4] Added this_bdev member to drbd_device struct. 5 | 6 | This is needed for many purposes. 7 | --- 8 | drbd/drbd_int.h | 2 ++ 9 | 1 file changed, 2 insertions(+) 10 | 11 | diff --git a/drbd/drbd_int.h b/drbd/drbd_int.h 12 | index 933738f..f461086 100644 13 | --- a/drbd/drbd_int.h 14 | +++ b/drbd/drbd_int.h 15 | @@ -1374,6 +1374,8 @@ struct drbd_device { 16 | 17 | struct rcu_head rcu; 18 | struct work_struct finalize_work; 19 | + 20 | + struct block_device *this_bdev; 21 | }; 22 | 23 | #include "drbd_polymorph_printk.h" 24 | -- 25 | 2.17.0 26 | 27 | -------------------------------------------------------------------------------- /transform.d/688-Use-pp_-fields-from-resource.patch: -------------------------------------------------------------------------------- 1 | From 16bee27a02fdc9e1a56d123e3d746aac4da0e283 Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Wed, 24 Mar 2021 13:57:32 +0100 4 | Subject: [PATCH 3/4] Use pp_ fields from resource. 5 | 6 | This is inside an already patched source so maybe better if we 7 | fix the patch instead of creating a new one. 8 | --- 9 | drbd/drbd_receiver.c | 4 ++-- 10 | 1 file changed, 2 insertions(+), 2 deletions(-) 11 | 12 | diff --git a/drbd/drbd_receiver.c b/drbd/drbd_receiver.c 13 | index b037196..0cb1c74 100644 14 | --- a/drbd/drbd_receiver.c 15 | +++ b/drbd/drbd_receiver.c 16 | @@ -301,9 +301,9 @@ static struct page *__drbd_alloc_pages(struct drbd_resource *resource, unsigned 17 | spin_lock_irqsave(&resource->pp_lock, spin_lock_flags); 18 | page = page_chain_del(&resource->pp_pool, number); 19 | if (page) { 20 | - drbd_pp_vacant -= number; 21 | + resource->pp_vacant -= number; 22 | if (page->size > PAGE_SIZE) { 23 | - spin_unlock_irqrestore(&drbd_pp_lock, spin_lock_flags); 24 | + spin_unlock_irqrestore(&resource->pp_lock, spin_lock_flags); 25 | continue; 26 | } 27 | } 28 | -- 29 | 2.17.0 30 | 31 | -------------------------------------------------------------------------------- /transform.d/692-drbd_transport_tcp-patched-in-one-variable-again.patch: -------------------------------------------------------------------------------- 1 | From 595c125365952c23f73f1b03c415037db0737858 Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Thu, 25 Mar 2021 13:12:59 +0100 4 | Subject: [PATCH] drbd_transport_tcp: patched in "one" variable again. 5 | 6 | --- 7 | drbd/drbd_transport_tcp.c | 1 + 8 | 1 file changed, 1 insertion(+) 9 | 10 | diff --git a/drbd/drbd_transport_tcp.c b/drbd/drbd_transport_tcp.c 11 | index 4adeb91..9dd691d 100644 12 | --- a/drbd/drbd_transport_tcp.c 13 | +++ b/drbd/drbd_transport_tcp.c 14 | @@ -925,6 +925,7 @@ static int dtt_connect(struct drbd_transport *transport) 15 | struct socket *dsocket, *csocket; 16 | struct net_conf *nc; 17 | int timeout, err; 18 | + int one = 1; 19 | bool ok; 20 | 21 | dsocket = NULL; 22 | -- 23 | 2.17.0 24 | 25 | -------------------------------------------------------------------------------- /transform.d/694-set_my_capacity-set-block-device-size-directly.patch: -------------------------------------------------------------------------------- 1 | From e43f039483cf77177bfa20424b39181c08f7d917 Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Mon, 17 May 2021 19:19:19 +0200 4 | Subject: [PATCH 1/2] set_my_capacity: set block device size directly. 5 | 6 | --- 7 | drbd/drbd_nl.c | 4 +++- 8 | 1 file changed, 3 insertions(+), 1 deletion(-) 9 | 10 | diff --git a/drbd/drbd_nl.c b/drbd/drbd_nl.c 11 | index 84c7835..f13426f 100644 12 | --- a/drbd/drbd_nl.c 13 | +++ b/drbd/drbd_nl.c 14 | @@ -1612,7 +1612,9 @@ void drbd_set_my_capacity(struct drbd_device *device, sector_t size) 15 | { 16 | char ppb[10]; 17 | 18 | - set_capacity_and_notify(device->vdisk, size); 19 | +/* set_capacity_and_notify(device->vdisk, size); */ 20 | + 21 | + device->this_bdev->d_size = size << 9; 22 | 23 | drbd_info(device, "size = %s (%llu KB)\n", 24 | ppsize(ppb, size>>1), (unsigned long long)size>>1); 25 | -- 26 | 2.17.0 27 | 28 | -------------------------------------------------------------------------------- /transform.d/699-Added-type-to-list-iterator.patch: -------------------------------------------------------------------------------- 1 | From 2181e776e2d6d0145b53ec5e7b78b7927a128319 Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Mon, 17 May 2021 19:56:19 +0200 4 | Subject: [PATCH] Added type to list iterator. 5 | 6 | --- 7 | drbd/drbd_main.c | 2 +- 8 | 1 file changed, 1 insertion(+), 1 deletion(-) 9 | 10 | diff --git a/drbd/drbd_main.c b/drbd/drbd_main.c 11 | index 1046923..bb57ca5 100644 12 | --- a/drbd/drbd_main.c 13 | +++ b/drbd/drbd_main.c 14 | @@ -2632,7 +2632,7 @@ static void __prune_or_free_openers(struct drbd_device *device, pid_t pid) 15 | { 16 | struct opener *pos, *tmp; 17 | 18 | - list_for_each_entry_safe(pos, tmp, &device->openers, list) { 19 | + list_for_each_entry_safe(struct opener, pos, tmp, &device->openers, list) { 20 | // if pid == 0, i.e., counts were 0, delete all entries, else the matching one 21 | if (pid == 0 || pid == pos->pid) { 22 | dynamic_drbd_dbg(device, "%sopeners del: %s(%d)\n", pid == 0 ? "" : "all ", 23 | -- 24 | 2.17.0 25 | 26 | -------------------------------------------------------------------------------- /transform.d/700-struct-opener-as-list-iterator-type.patch: -------------------------------------------------------------------------------- 1 | From 5a6b527c746134aec1b24a8e932249193c10a95c Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Mon, 17 May 2021 20:33:25 +0200 4 | Subject: [PATCH] struct opener as list iterator type. 5 | 6 | --- 7 | drbd/drbd_main.c | 2 +- 8 | 1 file changed, 1 insertion(+), 1 deletion(-) 9 | 10 | diff --git a/drbd/drbd_main.c b/drbd/drbd_main.c 11 | index bb57ca5..5327d3a 100644 12 | --- a/drbd/drbd_main.c 13 | +++ b/drbd/drbd_main.c 14 | @@ -2675,7 +2675,7 @@ static void add_opener(struct drbd_device *device) 15 | opener->opened = ktime_get_real(); 16 | 17 | spin_lock_irqsave(&device->openers_lock, spin_lock_flags); 18 | - list_for_each_entry(struct drbd_request, tmp, &device->openers, list) 19 | + list_for_each_entry(struct opener, tmp, &device->openers, list) 20 | if (++len > 100) { /* 100 ought to be enough for everybody */ 21 | dynamic_drbd_dbg(device, "openers: list full, do not add new opener\n"); 22 | kfree(opener); 23 | -- 24 | 2.17.0 25 | 26 | -------------------------------------------------------------------------------- /transform.d/701-Fixed-wait_event-macro-call.patch: -------------------------------------------------------------------------------- 1 | From f31dc454ca059a81ddbf8ac1cf22abcdbd3dbe45 Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Mon, 17 May 2021 20:43:01 +0200 4 | Subject: [PATCH] Fixed wait_event macro call. 5 | 6 | Cannot return a value from a macro containing a block statement. 7 | --- 8 | drbd/drbd_state.c | 3 ++- 9 | 1 file changed, 2 insertions(+), 1 deletion(-) 10 | 11 | diff --git a/drbd/drbd_state.c b/drbd/drbd_state.c 12 | index e838b8b..300de35 100644 13 | --- a/drbd/drbd_state.c 14 | +++ b/drbd/drbd_state.c 15 | @@ -4928,7 +4928,8 @@ enum drbd_state_rv change_role(struct drbd_resource *resource, 16 | role_context.context.flags |= CS_ALREADY_SERIALIZED; 17 | } 18 | idr_for_each_entry(&resource->devices, device, vnr) { 19 | - LONG_PTR t = wait_event_interruptible_timeout(device->misc_wait, 20 | + LONG_PTR t; 21 | + wait_event_interruptible_timeout(t, device->misc_wait, 22 | !atomic_read(&device->ap_bio_cnt[WRITE]), 23 | twopc_timeout(resource)); 24 | if (t <= 0) { 25 | -- 26 | 2.17.0 27 | 28 | -------------------------------------------------------------------------------- /transform.d/702-Commented-out-fsync_bdev-code.patch: -------------------------------------------------------------------------------- 1 | From eacaf906f4a93e07f29bd6f7779121f324d79df0 Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Mon, 17 May 2021 20:54:54 +0200 4 | Subject: [PATCH] Commented out fsync_bdev code. 5 | 6 | We need to implement it soon .. there should be no data loss on 7 | drbdadm secondary. 8 | --- 9 | drbd/drbd_nl.c | 3 +++ 10 | 1 file changed, 3 insertions(+) 11 | 12 | diff --git a/drbd/drbd_nl.c b/drbd/drbd_nl.c 13 | index 81eeae5..85ea7f4 100644 14 | --- a/drbd/drbd_nl.c 15 | +++ b/drbd/drbd_nl.c 16 | @@ -1110,6 +1110,8 @@ retry: 17 | down(&resource->state_sem); 18 | } else /* (role == R_SECONDARY) */ { 19 | down(&resource->state_sem); 20 | + /* TODO: WinDRBD: implement fsync_bdev somehow. */ 21 | +#if 0 22 | idr_for_each_entry(&resource->devices, device, vnr) { 23 | bdev = bdgrab(device->vdisk->part0); 24 | if (bdev) 25 | @@ -1117,6 +1119,7 @@ retry: 26 | bdput(bdev); 27 | flush_workqueue(device->submit.wq); 28 | } 29 | +#endif 30 | 31 | if (start_new_tl_epoch(resource)) { 32 | struct drbd_connection *connection; 33 | -- 34 | 2.17.0 35 | 36 | -------------------------------------------------------------------------------- /transform.d/703-Silence-an-unintialized-variable-warning.patch: -------------------------------------------------------------------------------- 1 | From 5bf57d760001899d33684b9acb4d5c10dc984462 Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Mon, 17 May 2021 21:12:15 +0200 4 | Subject: [PATCH] Silence an unintialized variable warning. 5 | 6 | Maybe the compiler is right ... 7 | --- 8 | drbd/drbd_nl.c | 1 + 9 | 1 file changed, 1 insertion(+) 10 | 11 | diff --git a/drbd/drbd_nl.c b/drbd/drbd_nl.c 12 | index 85ea7f4..803e6a4 100644 13 | --- a/drbd/drbd_nl.c 14 | +++ b/drbd/drbd_nl.c 15 | @@ -5764,6 +5764,7 @@ int drbd_adm_dump_devices(struct sk_buff *skb, struct netlink_callback *cb) 16 | struct device_statistics device_statistics; 17 | struct idr *idr_to_search; 18 | 19 | + minor = -1; /* make MS VC compiler happy */ 20 | resource = (struct drbd_resource *)cb->args[0]; 21 | 22 | rcu_flags = rcu_read_lock(); 23 | -- 24 | 2.17.0 25 | 26 | -------------------------------------------------------------------------------- /transform.d/705-drbd_main-Do-not-use-__free_pages-use-put_page-to-ho.patch: -------------------------------------------------------------------------------- 1 | From b5bd73369216e552c2c50a57779b6af34a333a71 Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Fri, 9 Jul 2021 17:14:51 +0200 4 | Subject: [PATCH 1/3] drbd_main: Do not use __free_pages: use put_page() to 5 | honor reference count. 6 | 7 | --- 8 | drbd/drbd_main.c | 6 +++--- 9 | 1 file changed, 3 insertions(+), 3 deletions(-) 10 | 11 | diff --git a/drbd/drbd_main.c b/drbd/drbd_main.c 12 | index 5327d3a..5af21c2 100644 13 | --- a/drbd/drbd_main.c 14 | +++ b/drbd/drbd_main.c 15 | @@ -3027,7 +3027,7 @@ static void free_page_pool(struct drbd_resource *resource) 16 | while (resource->pp_pool) { 17 | page = resource->pp_pool; 18 | resource->pp_pool = page_chain_next(page); 19 | - __free_page(page); 20 | + put_page(page); 21 | resource->pp_vacant--; 22 | } 23 | } 24 | @@ -3942,7 +3942,7 @@ out_no_peer_device: 25 | 26 | drbd_bm_free(device->bitmap); 27 | out_no_bitmap: 28 | - __free_page(device->md_io.page); 29 | + put_page(device->md_io.page); 30 | out_no_io_page: 31 | put_disk(disk); 32 | out_no_disk: 33 | -- 34 | 2.17.0 35 | 36 | -------------------------------------------------------------------------------- /transform.d/708-Use-windrbd_ioctl-from-drbd-headers.patch: -------------------------------------------------------------------------------- 1 | From 06c29b4604cbe110f39ffa5293462b534fd313c1 Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Wed, 4 Aug 2021 17:00:09 +0200 4 | Subject: [PATCH] Use windrbd_ioctl from drbd-headers. 5 | 6 | windrbd_ioctl header finally moved to drbd-headers. There is 7 | no windrbd_ioctl.h in the windrbd repo any more. 8 | --- 9 | drbd/drbd_nl.c | 2 +- 10 | 1 file changed, 1 insertion(+), 1 deletion(-) 11 | 12 | diff --git a/drbd/drbd_nl.c b/drbd/drbd_nl.c 13 | index 803e6a4..0a032cd 100644 14 | --- a/drbd/drbd_nl.c 15 | +++ b/drbd/drbd_nl.c 16 | @@ -103,7 +103,7 @@ inline static int genl_unregister_family(const struct genl_family *f) 17 | #include "drbd_nla.h" 18 | #include 19 | 20 | -#include "windrbd_ioctl.h" 21 | +#include "windrbd/windrbd_ioctl.h" 22 | 23 | /* Those two functions taken from netlink.c_inc, originally they 24 | * are probably generated. 25 | -- 26 | 2.17.0 27 | 28 | -------------------------------------------------------------------------------- /transform.d/710-drbd_sender-Use-KIRQL-for-IRQ-flags-also-in-new-code.patch: -------------------------------------------------------------------------------- 1 | From b42562f80ed7e3e8df53215aa32b395aae67a871 Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Mon, 4 Oct 2021 16:37:16 +0200 4 | Subject: [PATCH] drbd_sender: Use KIRQL for IRQ flags also in new code. 5 | 6 | --- 7 | drbd/drbd_sender.c | 2 +- 8 | 1 file changed, 1 insertion(+), 1 deletion(-) 9 | 10 | diff --git a/drbd/drbd_sender.c b/drbd/drbd_sender.c 11 | index 13e5f3c..8732ff6 100644 12 | --- a/drbd/drbd_sender.c 13 | +++ b/drbd/drbd_sender.c 14 | @@ -467,7 +467,7 @@ int w_resync_timer(struct drbd_work *w, int cancel) 15 | default: 16 | if (atomic_read(&peer_device->rs_sect_in) >= peer_device->rs_in_flight) { 17 | struct drbd_resource *resource = peer_device->device->resource; 18 | - ULONG_PTR irq_flags; 19 | + KIRQL irq_flags; 20 | begin_state_change(resource, &irq_flags, 0); 21 | peer_device->resync_active[NEW] = false; 22 | end_state_change(resource, &irq_flags); 23 | -- 24 | 2.17.0 25 | 26 | -------------------------------------------------------------------------------- /transform.d/712-drbd_main.c-use-req_lock_flags-for-unlocking-req_loc.patch: -------------------------------------------------------------------------------- 1 | From fd12378ef6925988548c315eba1cab96b6b89cab Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Mon, 4 Oct 2021 16:56:37 +0200 4 | Subject: [PATCH 2/2] drbd_main.c: use req_lock_flags for unlocking req_lock 5 | 6 | --- 7 | drbd/drbd_main.c | 2 +- 8 | 1 file changed, 1 insertion(+), 1 deletion(-) 9 | 10 | diff --git a/drbd/drbd_main.c b/drbd/drbd_main.c 11 | index b73d35d..7407825 100644 12 | --- a/drbd/drbd_main.c 13 | +++ b/drbd/drbd_main.c 14 | @@ -3936,7 +3936,7 @@ out_idr_remove_minor: 15 | kref_debug_put(&device->kref_debug, 1); 16 | out_no_minor_idr: 17 | if (locked) 18 | - spin_unlock_irqrestore(&resource->req_lock, spin_lock_irq_flags); 19 | + spin_unlock_irqrestore(&resource->req_lock, req_lock_flags); 20 | synchronize_rcu(); 21 | 22 | out_no_peer_device: 23 | -- 24 | 2.17.0 25 | 26 | -------------------------------------------------------------------------------- /transform.d/714-drbd_main.c-initialize-notification-mutex.patch: -------------------------------------------------------------------------------- 1 | From f0b8b233dbc85bc498887a3c678f5807c1214cca Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Mon, 4 Oct 2021 17:43:28 +0200 4 | Subject: [PATCH 1/2] drbd_main.c: initialize notification mutex 5 | 6 | --- 7 | drbd/drbd_main.c | 1 + 8 | 1 file changed, 1 insertion(+) 9 | 10 | diff --git a/drbd/drbd_main.c b/drbd/drbd_main.c 11 | index 99e18ff..c1a126c 100644 12 | --- a/drbd/drbd_main.c 13 | +++ b/drbd/drbd_main.c 14 | @@ -4142,6 +4142,7 @@ int __init drbd_init(void) 15 | 16 | spin_lock_init(&drbd_devices_lock); 17 | mutex_init(&resources_mutex); 18 | + mutex_init(¬ification_mutex); /* defined in drbd_nl.c */ 19 | #if 0 20 | drbd_debugfs_init(); 21 | #endif 22 | -- 23 | 2.17.0 24 | 25 | -------------------------------------------------------------------------------- /transform.d/715-drbd_nl.c-define-notification-mutex.patch: -------------------------------------------------------------------------------- 1 | From 40b9b102dcc7e30a1d083fcd47fb47ad672ae964 Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Mon, 4 Oct 2021 17:43:48 +0200 4 | Subject: [PATCH 2/2] drbd_nl.c: define notification mutex 5 | 6 | DEFINE_MUTEX does not exist and looks like a function prototype 7 | to Windows C compiler. 8 | --- 9 | drbd/drbd_nl.c | 2 +- 10 | 1 file changed, 1 insertion(+), 1 deletion(-) 11 | 12 | diff --git a/drbd/drbd_nl.c b/drbd/drbd_nl.c 13 | index 46a9c3b..46ab36c 100644 14 | --- a/drbd/drbd_nl.c 15 | +++ b/drbd/drbd_nl.c 16 | @@ -144,7 +144,7 @@ const char *windrbd_genl_cmd_to_str(u8 cmd) 17 | 18 | atomic_t drbd_genl_seq = ATOMIC_INIT(2); /* two. */ 19 | 20 | -DEFINE_MUTEX(notification_mutex); 21 | +struct mutex notification_mutex; 22 | 23 | /* used blkdev_get_by_path, to claim our meta data device(s) */ 24 | static char *drbd_m_holder = "Hands off! this is DRBD's meta data device."; 25 | -- 26 | 2.17.0 27 | 28 | -------------------------------------------------------------------------------- /transform.d/718-drbd_actlog-unsigned-long-ULONG_PTR.patch: -------------------------------------------------------------------------------- 1 | From d2122016887c0645cc84626f5d6a7d3607671604 Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Fri, 12 Nov 2021 18:52:18 +0100 4 | Subject: [PATCH 1/6] drbd_actlog: unsigned long -> ULONG_PTR 5 | 6 | unsigned long is 32 bit on Windows (also on 64 bit systems) 7 | and should not be used at all. 8 | --- 9 | drbd/drbd_actlog.c | 2 +- 10 | 1 file changed, 1 insertion(+), 1 deletion(-) 11 | 12 | diff --git a/drbd/drbd_actlog.c b/drbd/drbd_actlog.c 13 | index f08cf42..7fb105a 100644 14 | --- a/drbd/drbd_actlog.c 15 | +++ b/drbd/drbd_actlog.c 16 | @@ -338,7 +338,7 @@ bool drbd_al_begin_io_fastpath(struct drbd_device *device, struct drbd_interval 17 | # error FIXME 18 | #endif 19 | 20 | -static unsigned long al_extent_to_bm_bit(unsigned int al_enr) 21 | +static ULONG_PTR al_extent_to_bm_bit(unsigned int al_enr) 22 | { 23 | return (ULONG_PTR)al_enr << (AL_EXTENT_SHIFT - BM_BLOCK_SHIFT); 24 | } 25 | -- 26 | 2.17.0 27 | 28 | -------------------------------------------------------------------------------- /transform.d/721-drbd_req-unsigned-long-ULONG_PTR.patch: -------------------------------------------------------------------------------- 1 | From 02891c66b644638f8a34f32fcfd2e95be69e884c Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Fri, 12 Nov 2021 18:54:11 +0100 4 | Subject: [PATCH 4/6] drbd_req: unsigned long -> ULONG_PTR 5 | 6 | unsigned long is 32 bit on Windows (also on 64 bit systems) 7 | and should not be used at all. 8 | --- 9 | drbd/drbd_req.c | 2 +- 10 | 1 file changed, 1 insertion(+), 1 deletion(-) 11 | 12 | diff --git a/drbd/drbd_req.c b/drbd/drbd_req.c 13 | index 1df20c9..92c73eb 100644 14 | --- a/drbd/drbd_req.c 15 | +++ b/drbd/drbd_req.c 16 | @@ -2247,7 +2247,7 @@ blk_qc_t drbd_submit_bio(struct bio *bio) 17 | return BLK_QC_T_NONE; 18 | } 19 | 20 | -static unsigned long time_min_in_future(ULONG_PTR now, 21 | +static ULONG_PTR time_min_in_future(ULONG_PTR now, 22 | ULONG_PTR t1, ULONG_PTR t2) 23 | { 24 | bool t1_in_future = time_after(t1, now); 25 | -- 26 | 2.17.0 27 | 28 | -------------------------------------------------------------------------------- /transform.d/730-drbd_main-use-put_page-instead-of-__free_page.patch: -------------------------------------------------------------------------------- 1 | From 33e2c4e13ca952fdcd5c086566b7e6983b152b88 Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Fri, 21 Jan 2022 17:50:58 +0100 4 | Subject: [PATCH] drbd_main: use put_page instead of __free_page 5 | 6 | --- 7 | drbd/drbd_main.c | 2 +- 8 | 1 file changed, 1 insertion(+), 1 deletion(-) 9 | 10 | diff --git a/drbd/drbd_main.c b/drbd/drbd_main.c 11 | index dd6256a..b30dc4e 100644 12 | --- a/drbd/drbd_main.c 13 | +++ b/drbd/drbd_main.c 14 | @@ -3005,7 +3005,7 @@ void drbd_destroy_device(struct kref *kref) 15 | free_peer_device(peer_device); 16 | } 17 | 18 | - __free_page(device->md_io.page); 19 | + put_page(device->md_io.page); 20 | kref_debug_destroy(&device->kref_debug); 21 | 22 | INIT_WORK(&device->finalize_work, drbd_device_finalize_work_fn); 23 | -- 24 | 2.17.0 25 | 26 | -------------------------------------------------------------------------------- /transform.d/731-drbd_actlog-pass-code-analysis-and-codeql-tests.patch: -------------------------------------------------------------------------------- 1 | From e734ace515bbdd7fc61b8cafe5a92431ad44bb2c Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Mon, 28 Mar 2022 11:56:53 -0700 4 | Subject: [PATCH 01/12] drbd_actlog: pass code analysis and codeql tests. 5 | 6 | --- 7 | drbd/drbd_actlog.c | 3 +++ 8 | 1 file changed, 3 insertions(+) 9 | 10 | diff --git a/drbd/drbd_actlog.c b/drbd/drbd_actlog.c 11 | index 7fb105a..11d08de 100644 12 | --- a/drbd/drbd_actlog.c 13 | +++ b/drbd/drbd_actlog.c 14 | @@ -10,6 +10,9 @@ 15 | 16 | */ 17 | 18 | + /* Enable all warnings throws lots of those warnings: */ 19 | +#pragma warning(disable: 4061 4062 4255 4388 4668 4820 5032 4711 5045) 20 | + 21 | #include 22 | #include 23 | #include 24 | -- 25 | 2.35.1 26 | 27 | -------------------------------------------------------------------------------- /transform.d/733-pass-code-analysis-and-codeql-tests.patch: -------------------------------------------------------------------------------- 1 | From d2bd8042ea229a1fc16a76a16ba5600521f17fa3 Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Mon, 28 Mar 2022 11:58:21 -0700 4 | Subject: [PATCH 03/12] pass code analysis and codeql tests. 5 | 6 | Check if drbd-utils compile. 7 | --- 8 | drbd/drbd-headers/windrbd/windrbd_ioctl.h | 4 ++-- 9 | 1 file changed, 2 insertions(+), 2 deletions(-) 10 | 11 | diff --git a/drbd/drbd-headers/windrbd/windrbd_ioctl.h b/drbd/drbd-headers/windrbd/windrbd_ioctl.h 12 | index 916df0b..9165afc 100644 13 | --- a/drbd/drbd-headers/windrbd/windrbd_ioctl.h 14 | +++ b/drbd/drbd-headers/windrbd/windrbd_ioctl.h 15 | @@ -34,8 +34,8 @@ 16 | * a non-Administrator user. 17 | */ 18 | 19 | -#define WINDRBD_ROOT_DEVICE_NAME "windrbd_control" 20 | -#define WINDRBD_USER_DEVICE_NAME "windrbd_control_user" 21 | +#define WINDRBD_ROOT_DEVICE_NAME L"windrbd_control" 22 | +#define WINDRBD_USER_DEVICE_NAME L"windrbd_control_user" 23 | 24 | /* TODO: are these used by someone else? Doc states that <= 0x8000 25 | * is reserved by Microsoft, but it does not state how to obtain 26 | -- 27 | 2.35.1 28 | 29 | -------------------------------------------------------------------------------- /transform.d/737-drbd-interval-pass-code-analysis-and-codeql-tests.patch: -------------------------------------------------------------------------------- 1 | From 02ea24f3aa82ba12bcdc7d4ab605f2c727e81f42 Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Mon, 28 Mar 2022 12:00:12 -0700 4 | Subject: [PATCH 07/12] drbd-interval: pass code analysis and codeql tests. 5 | 6 | --- 7 | drbd/drbd_interval.h | 3 +++ 8 | 1 file changed, 3 insertions(+) 9 | 10 | diff --git a/drbd/drbd_interval.h b/drbd/drbd_interval.h 11 | index 23c5a94..1c0048b 100644 12 | --- a/drbd/drbd_interval.h 13 | +++ b/drbd/drbd_interval.h 14 | @@ -1,6 +1,9 @@ 15 | #ifndef __DRBD_INTERVAL_H 16 | #define __DRBD_INTERVAL_H 17 | 18 | +/* Enable all warnings throws lots of those warnings: */ 19 | +#pragma warning(disable: 4061 4062 4255 4388 4668 4820 5032 4711 5045) 20 | + 21 | #include 22 | #include 23 | 24 | -- 25 | 2.35.1 26 | 27 | -------------------------------------------------------------------------------- /transform.d/738-drbd_nl-pass-code-analysis-and-codeql-tests.patch: -------------------------------------------------------------------------------- 1 | From cb4b0c8e74ab560e0651882a22f1e364cb2afbd6 Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Mon, 28 Mar 2022 12:00:34 -0700 4 | Subject: [PATCH 08/12] drbd_nl: pass code analysis and codeql tests. 5 | 6 | --- 7 | drbd/drbd_nl.c | 2 +- 8 | 1 file changed, 1 insertion(+), 1 deletion(-) 9 | 10 | diff --git a/drbd/drbd_nl.c b/drbd/drbd_nl.c 11 | index 395b347..d453e14 100644 12 | --- a/drbd/drbd_nl.c 13 | +++ b/drbd/drbd_nl.c 14 | @@ -6098,7 +6098,7 @@ int drbd_adm_dump_peer_devices(struct sk_buff *skb, struct netlink_callback *cb) 15 | struct drbd_resource *resource; 16 | struct drbd_device *device = NULL; 17 | struct drbd_peer_device *peer_device = NULL; 18 | - int minor, err, retcode; 19 | + int minor = -1, err, retcode; 20 | struct drbd_genlmsghdr *dh; 21 | struct idr *idr_to_search; 22 | 23 | -- 24 | 2.35.1 25 | 26 | -------------------------------------------------------------------------------- /transform.d/739-drbd_req-pass-code-analysis-and-codeql-tests.patch: -------------------------------------------------------------------------------- 1 | From 331a070cc768209db94e2b0aff4e5dd8d6b866fd Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Mon, 28 Mar 2022 12:00:53 -0700 4 | Subject: [PATCH 09/12] drbd_req: pass code analysis and codeql tests. 5 | 6 | --- 7 | drbd/drbd_req.c | 2 +- 8 | 1 file changed, 1 insertion(+), 1 deletion(-) 9 | 10 | diff --git a/drbd/drbd_req.c b/drbd/drbd_req.c 11 | index 92c73eb..99fcb94 100644 12 | --- a/drbd/drbd_req.c 13 | +++ b/drbd/drbd_req.c 14 | @@ -2406,7 +2406,7 @@ void request_timer_fn(struct timer_list *t) 15 | if (connection->cstate[NOW] == C_CONNECTED) { 16 | ko_count = nc->ko_count; 17 | timeout = nc->timeout; 18 | - ent = timeout * HZ/10 * ko_count; 19 | + ent = ((ULONG_PTR)timeout) * HZ/10 * ko_count; 20 | } 21 | } 22 | rcu_read_unlock(rcu_flags); 23 | -- 24 | 2.35.1 25 | 26 | -------------------------------------------------------------------------------- /transform.d/741-drbd_transport_tcp-pass-code-analysis-and-codeql-tes.patch: -------------------------------------------------------------------------------- 1 | From c47803c4fa7261459c5c69f72c3ceb118053df33 Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Mon, 28 Mar 2022 12:01:37 -0700 4 | Subject: [PATCH 11/12] drbd_transport_tcp: pass code analysis and codeql 5 | tests. 6 | 7 | --- 8 | drbd/drbd_transport_tcp.c | 3 ++- 9 | 1 file changed, 2 insertions(+), 1 deletion(-) 10 | 11 | diff --git a/drbd/drbd_transport_tcp.c b/drbd/drbd_transport_tcp.c 12 | index 76578ab..1a24d71 100644 13 | --- a/drbd/drbd_transport_tcp.c 14 | +++ b/drbd/drbd_transport_tcp.c 15 | @@ -234,7 +234,8 @@ static int _dtt_send(struct drbd_tcp_transport *tcp_transport, struct socket *so 16 | { 17 | struct kvec iov; 18 | struct msghdr msg; 19 | - int rv, sent = 0; 20 | + int rv; 21 | + size_t sent = 0; 22 | 23 | /* THINK if (signal_pending) return ... ? */ 24 | 25 | -- 26 | 2.35.1 27 | 28 | -------------------------------------------------------------------------------- /transform.d/742-lru_cache-pass-code-analysis-and-codeql-tests.patch: -------------------------------------------------------------------------------- 1 | From 00fa12a10baef96c10b13248a61090dfea28430c Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Mon, 28 Mar 2022 12:01:59 -0700 4 | Subject: [PATCH 12/12] lru_cache: pass code analysis and codeql tests. 5 | 6 | --- 7 | drbd/lru_cache.c | 3 +++ 8 | 1 file changed, 3 insertions(+) 9 | 10 | diff --git a/drbd/lru_cache.c b/drbd/lru_cache.c 11 | index b7a1069..c5bef14 100644 12 | --- a/drbd/lru_cache.c 13 | +++ b/drbd/lru_cache.c 14 | @@ -6,6 +6,9 @@ 15 | 16 | */ 17 | 18 | + /* Enable all warnings throws lots of those warnings: */ 19 | +#pragma warning(disable: 4061 4062 4255 4388 4668 4820 5032 5045 4711) 20 | + 21 | #include 22 | #include 23 | #include 24 | -- 25 | 2.35.1 26 | 27 | -------------------------------------------------------------------------------- /transform.d/748-drbd_main-fill-out-part0-field-of-struct-gendisk.patch: -------------------------------------------------------------------------------- 1 | From 9e0077fc4c876164ef35cf53816e2fc8db80808d Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Wed, 7 Sep 2022 19:40:52 +0200 4 | Subject: [PATCH] drbd_main: fill out part0 field of struct gendisk. 5 | 6 | We need it for device statistics. 7 | --- 8 | drbd/drbd_main.c | 1 + 9 | 1 file changed, 1 insertion(+) 10 | 11 | diff --git a/drbd/drbd_main.c b/drbd/drbd_main.c 12 | index 6b26ae5..24265e9 100644 13 | --- a/drbd/drbd_main.c 14 | +++ b/drbd/drbd_main.c 15 | @@ -3804,6 +3804,7 @@ enum drbd_ret_code drbd_create_device(struct drbd_config_context *adm_ctx, unsig 16 | disk->fops = &drbd_ops; 17 | sprintf(disk->disk_name, "drbd%d", minor); 18 | disk->private_data = device; 19 | + disk->part0 = block_device; 20 | disk->bdev = block_device; 21 | 22 | blk_queue_flag_set(QUEUE_FLAG_STABLE_WRITES, disk->queue); 23 | -- 24 | 2.17.0 25 | 26 | -------------------------------------------------------------------------------- /transform.d/749-drbd-headers-set-shutdown-flag-ioctl.patch: -------------------------------------------------------------------------------- 1 | Submodule drbd/drbd-headers contains modified content 2 | diff --git a/drbd/drbd-headers/windrbd/windrbd_ioctl.h b/drbd/drbd-headers/windrbd/windrbd_ioctl.h 3 | index 916df0b..9ea9be9 100644 4 | --- a/drbd/drbd-headers/windrbd/windrbd_ioctl.h 5 | +++ b/drbd/drbd-headers/windrbd/windrbd_ioctl.h 6 | @@ -307,4 +307,15 @@ struct windrbd_minor_mount_point { 7 | 8 | #define IOCTL_WINDRBD_ROOT_GET_LOCK_DOWN_STATE CTL_CODE(WINDRBD_ROOT_DEVICE_TYPE, 17, METHOD_BUFFERED, FILE_ANY_ACCESS) 9 | 10 | +/* Set WinDRBD shutdown flag. 11 | + * Input: 1 - signal WinDRBD that it will be unloaded soon 12 | + * 0 - cancel the above 13 | + * Output: none 14 | + * 15 | + * Set WinDRBD shutdown flag. Will cause drbdsetup events2 to terminate. 16 | + * Also all further drbdadm commands will fail. 17 | + */ 18 | + 19 | +#define IOCTL_WINDRBD_ROOT_SET_SHUTDOWN_FLAG CTL_CODE(WINDRBD_ROOT_DEVICE_TYPE, 18, METHOD_BUFFERED, FILE_ANY_ACCESS) 20 | + 21 | #endif 22 | -------------------------------------------------------------------------------- /transform.d/752-drbd_sender-use-wake_up_all-for-state_wait.patch: -------------------------------------------------------------------------------- 1 | From 45ea479c38d461bb8e83fad9e4da2330ce368abf Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Mon, 17 Oct 2022 13:51:50 +0200 4 | Subject: [PATCH 2/3] drbd_sender: use wake_up_all for state_wait 5 | 6 | --- 7 | drbd/drbd_sender.c | 2 +- 8 | 1 file changed, 1 insertion(+), 1 deletion(-) 9 | 10 | diff --git a/drbd/drbd_sender.c b/drbd/drbd_sender.c 11 | index 014755e..fb2802c 100644 12 | --- a/drbd/drbd_sender.c 13 | +++ b/drbd/drbd_sender.c 14 | @@ -2374,7 +2374,7 @@ void drbd_check_peers(struct drbd_resource *resource) 15 | wait_event(resource->state_wait, all_peers_responded(resource)); 16 | 17 | clear_bit(CHECKING_PEERS, &resource->flags); 18 | - wake_up(&resource->state_wait); 19 | + wake_up_all(&resource->state_wait); 20 | } 21 | 22 | void drbd_check_peers_new_current_uuid(struct drbd_device *device) 23 | -- 24 | 2.17.0 25 | 26 | -------------------------------------------------------------------------------- /transform.d/753-drbd_state-use-wake_up_all-for-state_wait.patch: -------------------------------------------------------------------------------- 1 | From dba3641b3824b85141347d1e98d10a36a190d9f6 Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Mon, 17 Oct 2022 13:53:21 +0200 4 | Subject: [PATCH 3/3] drbd_state: use wake_up_all for state_wait 5 | 6 | --- 7 | drbd/drbd_state.c | 2 +- 8 | 1 file changed, 1 insertion(+), 1 deletion(-) 9 | 10 | diff --git a/drbd/drbd_state.c b/drbd/drbd_state.c 11 | index cfb5de3..8148c24 100644 12 | --- a/drbd/drbd_state.c 13 | +++ b/drbd/drbd_state.c 14 | @@ -803,7 +803,7 @@ static enum drbd_state_rv ___end_state_change(struct drbd_resource *resource, st 15 | wake_up(&device->misc_wait); 16 | } 17 | 18 | - wake_up(&resource->state_wait); 19 | + wake_up_all(&resource->state_wait); 20 | out: 21 | rcu_read_unlock(resource->wrcu_flags); 22 | 23 | -- 24 | 2.17.0 25 | 26 | -------------------------------------------------------------------------------- /transform.d/754-Call-hook-on-size-change.patch: -------------------------------------------------------------------------------- 1 | From 0ef80c91ecc7b80a92e85d24aad768d1ce1eb7d4 Mon Sep 17 00:00:00 2001 2 | From: Johannes Thoma 3 | Date: Mon, 21 Nov 2022 19:58:31 +0100 4 | Subject: [PATCH] Call hook on size change. 5 | 6 | --- 7 | drbd/drbd_nl.c | 8 +------- 8 | 1 file changed, 1 insertion(+), 7 deletions(-) 9 | 10 | diff --git a/drbd/drbd_nl.c b/drbd/drbd_nl.c 11 | index d453e14..387d23b 100644 12 | --- a/drbd/drbd_nl.c 13 | +++ b/drbd/drbd_nl.c 14 | @@ -1625,13 +1625,7 @@ void drbd_set_my_capacity(struct drbd_device *device, sector_t size) 15 | drbd_info(device, "size = %s (%llu KB)\n", 16 | ppsize(ppb, size>>1), (unsigned long long)size>>1); 17 | 18 | - if (size > 0) { 19 | - printk("got a valid size, unblocking SCSI capacity requests.\n"); 20 | - KeSetEvent(&device->this_bdev->capacity_event, 0, FALSE); 21 | - } else { 22 | - printk("Size set to 0, am I Diskless/Unconnected?\n"); 23 | - KeClearEvent(&device->this_bdev->capacity_event); 24 | - } 25 | + windrbd_device_size_change(device->this_bdev); 26 | } 27 | 28 | /* 29 | -- 30 | 2.17.0 31 | 32 | -------------------------------------------------------------------------------- /transform.d/cocci-cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | -------------------------------------------------------------------------------- /visual-studio-2019-files/.gitignore: -------------------------------------------------------------------------------- 1 | x64 2 | sdv 3 | -------------------------------------------------------------------------------- /visual-studio-2019-files/WinDRBD/WinDRBD/WinDRBD.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /visual-studio-2019-files/WinDRBD/WinDRBD/run-msbuild.cmd: -------------------------------------------------------------------------------- 1 | @call %EWDK_BASE%\BuildEnv\SetupBuildEnv.cmd amd64 2 | @msbuild.exe %* 3 | -------------------------------------------------------------------------------- /visual-studio-files/.gitignore: -------------------------------------------------------------------------------- 1 | x64 2 | -------------------------------------------------------------------------------- /visual-studio-files/WinDRBD/WinDRBD.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /windrbd-test/.gitignore: -------------------------------------------------------------------------------- 1 | windrbd-test.exe 2 | *.o 3 | .*.sw? 4 | ntfs.* 5 | verify-content 6 | -------------------------------------------------------------------------------- /windrbd-test/1megloop.sh: -------------------------------------------------------------------------------- 1 | # Note: for this to work there must be no filesystem on backing device. 2 | while true 3 | do 4 | windrbd-test.exe --drive=K: --gtest_filter=windrbd.do_write_read_whole_disk_by_1meg_requests --force 5 | done 6 | -------------------------------------------------------------------------------- /windrbd-test/Makefile: -------------------------------------------------------------------------------- 1 | OBJS=main.o drbd-device.o 2 | PROG=windrbd-test.exe 3 | CPPFLAGS=-Wall 4 | # DRIVE ?= H: 5 | DRIVE ?= F: 6 | # SIZE ?= 52387328 7 | SIZE ?= 52428800 8 | # SIZE ?= 52387840 9 | # FORCE ?= "" 10 | FORCE ?= --force 11 | 12 | all: $(PROG) 13 | 14 | $(PROG): $(OBJS) 15 | g++ $(OBJS) -o $(PROG) -L/usr/local/lib -lgtest 16 | 17 | test: all 18 | ./windrbd-test.exe --drive $(DRIVE) --expected-size $(SIZE) $(FORCE) 19 | 20 | install: all 21 | cp $(PROG) /usr/local/bin 22 | cp *.sh /usr/local/bin 23 | 24 | clean: 25 | rm -f $(PROG) $(OBJS) 26 | 27 | # Expected to be run on a linux box where drbd device is synced to 28 | # to check data integrity of sync process. 29 | 30 | verify-content: verify-content.c 31 | gcc verify-content.c -o verify-content 32 | 33 | main.o: main.cpp drbd-device.hpp 34 | drbd-device.o: drbd-device.cpp drbd-device.hpp 35 | -------------------------------------------------------------------------------- /windrbd-test/README.md: -------------------------------------------------------------------------------- 1 | Test suite for WinDRBD 2 | ====================== 3 | 4 | This is a google test based test suite that calls various 5 | WIN32 API calls to test the functionality and stability 6 | of WinDRBD. 7 | 8 | This is tested only for CygWin under Windows 7. 9 | 10 | You need to have google test installed (expected in 11 | /usr/local/lib, but you can also edit the Makefile to 12 | change that). To do so go 13 | 14 | git clone git@github.com:google/googletest.git 15 | cd googletest 16 | cmake 17 | make 18 | 19 | (make install does not work for me, copy libs and headers 20 | manually or edit Makefile) 21 | 22 | To run the test do a 23 | 24 | make test DRIVE=H: 25 | 26 | Where H: is the DRBD drive (only exists in Linbit's WinDRBD 27 | version, not in ManTech's) 28 | 29 | -------------------------------------------------------------------------------- /windrbd-test/busy-write-one-block.sh: -------------------------------------------------------------------------------- 1 | # secondary: 2 | drbdadm disconnect busy-resync-test 3 | drbdadm invalidate busy-resync-test 4 | # primary 5 | # ./fio-3.27-x64/fio --name=r:\\fio-test --size=1000m --rw=write --direct=1 --thread --runtime=600 6 | # (done my invalidate now) 7 | # primary 8 | ./fio-3.27-x64/fio --name=r:\\fio-test --size=4k --rw=write --direct=1 --bs=4k --iodepth=32 --thread --runtime=600 --time_based --numjobs=32 9 | # secondary: 10 | drbdadm connect busy-resync-test 11 | # secondary: 12 | drbdsetup events2 13 | -------------------------------------------------------------------------------- /windrbd-test/connect-test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | i=0 4 | while true 5 | do 6 | i=$[ $i+1 ] 7 | echo Up $i 8 | drbdadm up vamp-4nodes 9 | echo Wait-connect $i 10 | drbdadm wait-connect vamp-4nodes 11 | echo Connected $i 12 | drbdadm status 13 | echo Down $i 14 | drbdadm down vamp-4nodes 15 | done 16 | -------------------------------------------------------------------------------- /windrbd-test/connection-loss-while-syncing.sh: -------------------------------------------------------------------------------- 1 | i=0 2 | while true 3 | do 4 | i=$[ $i+1 ] 5 | echo "Connection loss while syncing $i" 6 | sudo drbdadm up w0 7 | sleep 10 8 | sudo drbdadm invalidate w0 9 | sleep 2 10 | sudo drbdadm down w0 11 | done 12 | -------------------------------------------------------------------------------- /windrbd-test/data-coherence-test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -x 2 | # Run this test on Windows side. 3 | # must have ssh key installed on Linux side 4 | # must have sudo passwordless set (edit /etc/sudoers: 5 | # %sudo ALL=(ALL) NOPASSWD:ALL 6 | # 7 | LINUX=johannes@192.168.56.102 8 | RES=w0 9 | j=0 10 | 11 | while true 12 | do 13 | j=$[ $j+1 ] 14 | echo Data coherence test $j 15 | 16 | for i in 1 2 3 4 17 | do 18 | ssh $LINUX sudo drbdadm primary $RES 19 | ssh $LINUX sudo kpartx /dev/drbd26 -a 20 | sleep 1 21 | ssh $LINUX sudo mount /dev/dm-0 ~/Linbit/tmp/mnt 22 | 23 | ssh $LINUX rm ~/Linbit/tmp/mnt/random-30megs* 24 | ssh $LINUX cp ~/Linbit/tmp/random-30megs-$i ~/Linbit/tmp/mnt 25 | 26 | ssh $LINUX sudo umount ~/Linbit/tmp/mnt 27 | ssh $LINUX sudo kpartx /dev/drbd26 -d 28 | ssh $LINUX sudo drbdadm secondary $RES 29 | 30 | drbdadm primary $RES 31 | sleep 3 32 | diff /cygdrive/y/tmp/random-30megs-$i /cygdrive/p/random-30megs-$i 33 | if [ $? -ne 0 ] ; then 34 | echo "Data not coherent." 35 | exit 1 36 | fi 37 | drbdadm secondary $RES 38 | done 39 | done 40 | -------------------------------------------------------------------------------- /windrbd-test/detach-attach-loop.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | RES=${RES:-w0} 4 | i=0 5 | while true 6 | do 7 | i=$[ $i+1 ] 8 | echo Detach $i 9 | drbdadm detach $RES 10 | sleep 5 11 | echo Attach $i 12 | drbdadm attach $RES 13 | sleep 5 14 | done 15 | -------------------------------------------------------------------------------- /windrbd-test/detatch-attach-wait-sync-loop.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | RES=${RES:-vamp-2nodes} 4 | i=0 5 | while true 6 | do 7 | i=$[ $i+1 ] 8 | echo Detach $i 9 | drbdadm detach $RES 10 | sleep 5 11 | echo Attach $i 12 | drbdadm attach $RES 13 | echo Waitsync $i 14 | drbdadm wait-sync $RES 15 | echo Synced $i 16 | sleep 1 17 | done 18 | -------------------------------------------------------------------------------- /windrbd-test/disconnect-connect-loop-bsod.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -x 2 | 3 | RES=${RES:-w0} 4 | i=0 5 | while true 6 | do 7 | i=$[ $i+1 ] 8 | date 9 | echo Disconnect $RES $i 10 | drbdadm disconnect $RES 11 | drbdadm status 12 | sleep 3 13 | drbdadm status 14 | # TODO: not needed any more? 15 | drbdadm attach $RES 16 | drbdadm status 17 | echo Connect $RES $i 18 | drbdadm connect $RES 19 | drbdadm status 20 | drbdadm wait-connect $RES 21 | drbdadm status 22 | sleep 3 23 | drbdadm status 24 | done 25 | -------------------------------------------------------------------------------- /windrbd-test/disconnect-connect-loop.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | RES=w0 4 | i=0 5 | while true 6 | do 7 | i=$[ $i+1 ] 8 | echo Disconnect $i 9 | drbdadm disconnect $RES 10 | sleep 10 11 | echo Connect $i 12 | drbdadm connect $RES 13 | sleep 10 14 | done 15 | -------------------------------------------------------------------------------- /windrbd-test/disconnect-connect-up-down-wait-connect.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | RES=w0 4 | j=0 5 | 6 | while true 7 | do 8 | j=$[ $j+1 ] 9 | 10 | echo Up $j 11 | drbdadm up $RES 12 | i=0 13 | while [ $i -lt 20 ] 14 | do 15 | i=$[ $i+1 ] 16 | echo Disconnect $i 17 | drbdadm disconnect $RES 18 | sleep 5 19 | echo Connect $i 20 | drbdadm connect $RES 21 | drbdadm wait-connect $RES 22 | echo Connected $i 23 | sleep 1 24 | done 25 | 26 | echo Down $j 27 | drbdadm down $RES 28 | done 29 | -------------------------------------------------------------------------------- /windrbd-test/disconnect-connect-wait-connected-loop-check-if-disconnect-succeeded-and-attach.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | RES=w0 4 | i=0 5 | while true 6 | do 7 | i=$[ $i+1 ] 8 | # echo Attach $i 9 | # drbdadm attach $RES 10 | echo Disconnect $i 11 | drbdadm disconnect $RES 12 | # drbdadm status 13 | sleep 10 14 | # drbdadm status 15 | # echo Disconnect \#2 $i 16 | # drbdadm disconnect $RES 17 | # drbdadm status 18 | # sleep 10 19 | echo Connect $i 20 | until drbdadm connect $RES 21 | do 22 | echo Disconnecting again $i 23 | drbdadm disconnect $RES 24 | # drbdadm status 25 | sleep 10 26 | done 27 | 28 | # drbdadm status 29 | drbdadm wait-connect $RES 30 | # drbdadm status 31 | echo Connected $i 32 | echo Attach $i 33 | drbdadm attach $RES 34 | sleep 3 35 | drbdadm status 36 | done 37 | -------------------------------------------------------------------------------- /windrbd-test/disconnect-connect-wait-connected-loop-check-if-disconnect-succeeded.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | RES=w0 4 | i=0 5 | while true 6 | do 7 | i=$[ $i+1 ] 8 | # echo Attach $i 9 | # drbdadm attach $RES 10 | echo Disconnect $i 11 | drbdadm disconnect $RES 12 | # drbdadm status 13 | sleep 10 14 | # drbdadm status 15 | # echo Disconnect \#2 $i 16 | # drbdadm disconnect $RES 17 | # drbdadm status 18 | # sleep 10 19 | echo Connect $i 20 | until drbdadm connect $RES 21 | do 22 | echo Disconnecting again $i 23 | drbdadm disconnect $RES 24 | # drbdadm status 25 | sleep 10 26 | done 27 | 28 | # drbdadm status 29 | drbdadm wait-connect $RES 30 | # drbdadm status 31 | echo Connected $i 32 | sleep 5 33 | # drbdadm status 34 | done 35 | -------------------------------------------------------------------------------- /windrbd-test/disconnect-connect-wait-connected-loop-no-bsod.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | RES=w0 4 | i=0 5 | while true 6 | do 7 | i=$[ $i+1 ] 8 | echo Disconnect $i 9 | drbdadm disconnect $RES 10 | drbdadm status 11 | sleep 10 12 | drbdadm status 13 | echo Disconnect \#2 $i 14 | drbdadm disconnect $RES 15 | drbdadm status 16 | sleep 10 17 | echo Connect $i 18 | drbdadm connect $RES 19 | drbdadm status 20 | drbdadm wait-connect $RES 21 | drbdadm status 22 | echo Connected $i 23 | sleep 3 24 | drbdadm status 25 | done 26 | -------------------------------------------------------------------------------- /windrbd-test/disconnect-connect-wait-connected-loop.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | RES=w0 4 | i=0 5 | while true 6 | do 7 | i=$[ $i+1 ] 8 | echo Disconnect $i 9 | drbdadm disconnect $RES 10 | drbdadm status $RES 11 | sleep 10 12 | drbdadm status $RES 13 | # echo Disconnect \#2 $i 14 | # drbdadm disconnect $RES 15 | # drbdadm status 16 | # sleep 10 17 | echo Connect $i 18 | drbdadm connect $RES 19 | drbdadm status $RES 20 | drbdadm wait-connect $RES 21 | drbdadm status $RES 22 | echo Connected $i 23 | sleep 2 24 | drbdadm status $RES 25 | done 26 | -------------------------------------------------------------------------------- /windrbd-test/disconnect-connect-wait-sync-loop.h: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | RES=w0 4 | i=0 5 | while true 6 | do 7 | i=$[ $i+1 ] 8 | echo Disconnect $i 9 | drbdadm disconnect $RES 10 | drbdadm status 11 | sleep 20 12 | echo Connect $i 13 | drbdadm connect $RES 14 | echo Connected $i 15 | drbdadm status 16 | drbdadm wait-sync $RES 17 | echo Synced $i 18 | drbdadm status 19 | sleep 1 20 | done 21 | -------------------------------------------------------------------------------- /windrbd-test/disk-timeout-loop2023.sh: -------------------------------------------------------------------------------- 1 | MINOR=2 2 | RES=test-16tb 3 | FIO=/home/Administrator/fio-3.27-x64/fio 4 | 5 | i=0 6 | while true 7 | do 8 | i=$[ $i+1 ] 9 | echo "Disk timeout $i ..." 10 | 11 | drbdsetup disk-options $MINOR --set-defaults --disk-timeout=1 12 | $FIO --name=i:test-123 --size=1000m --rw=randrw --direct=1 --bs=4k --numjobs=1 --iodepth=100 13 | if [ $? -ne 0 ] ; then 14 | echo "I/O failed" 15 | drbdadm status $RES 16 | fi 17 | drbdadm secondary $RES 18 | # failed? with I/O error on meta data access 19 | drbdadm adjust $RES 20 | # drbdadm down $RES 21 | # drbdadm up $RES 22 | 23 | # drbdsetup disk-options $MINOR --set-defaults --disk-timeout=0 24 | 25 | drbdadm secondary $RES 26 | drbdadm primary $RES --force 27 | done 28 | -------------------------------------------------------------------------------- /windrbd-test/drbd-device.hpp: -------------------------------------------------------------------------------- 1 | enum test_mode { 2 | MODE_ONLY_READ, 3 | MODE_ONLY_WRITE, 4 | MODE_WRITE_AND_READ 5 | }; 6 | 7 | struct params { 8 | const char *drive; 9 | unsigned long long expected_size; 10 | bool force; 11 | const char *dump_file; 12 | unsigned long long request_size; 13 | enum test_mode mode; 14 | int stop_on_error; 15 | const char *root_device; 16 | }; 17 | 18 | extern struct params p; 19 | -------------------------------------------------------------------------------- /windrbd-test/dump-disk.sh: -------------------------------------------------------------------------------- 1 | ./windrbd-test --drive=$1 --dump-file=$2 --gtest_filter=windrbd.copy_disk_to_file --expected-size=$3 2 | -------------------------------------------------------------------------------- /windrbd-test/flush-loop.sh: -------------------------------------------------------------------------------- 1 | i=0 2 | while /bin/true 3 | do 4 | i=$[ $i+1 ] 5 | echo Flush $i 6 | cp /dev/urandom /cygdrive/h/data 7 | ./windrbd-test --gtest_filter=windrbd.flush_disk 8 | done 9 | -------------------------------------------------------------------------------- /windrbd-test/inject-attach-loop.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | RES=w0 4 | i=0 5 | echo "An I/O load should be put on the primary resource for this test to make sense" 6 | while true 7 | do 8 | i=$[ $i+1 ] 9 | echo Inject faults $i 10 | 11 | windrbd inject-faults 50 all-request 12 | drbdadm status 13 | sleep 10 14 | drbdadm status 15 | windrbd inject-faults -1 all-request 16 | 17 | drbdadm attach $RES 18 | drbdadm status 19 | drbdadm wait-sync $RES 20 | drbdadm status 21 | done 22 | -------------------------------------------------------------------------------- /windrbd-test/inject-completion-attach-loop.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | RES=w0 4 | DRIVE=j: 5 | i=0 6 | echo "An I/O load should be put on the primary resource for this test to make sense" 7 | while true 8 | do 9 | i=$[ $i+1 ] 10 | echo Inject faults $i 11 | 12 | # when this is used there is no sync after attach: 13 | # windrbd inject-faults 50 all-request 14 | windrbd inject-faults 50 all-completion 15 | # with this there is a sync after attach: 16 | # windrbd inject-faults 50 backing-request 17 | # windrbd inject-faults 50 backing-request $DRIVE 18 | drbdadm status 19 | sleep 10 20 | drbdadm status 21 | windrbd inject-faults -1 all-completion 22 | # windrbd inject-faults -1 all-request 23 | 24 | drbdadm attach $RES 25 | drbdadm status 26 | sleep 3 27 | drbdadm status 28 | drbdadm wait-sync $RES 29 | drbdadm status 30 | done 31 | -------------------------------------------------------------------------------- /windrbd-test/invalidate-loop.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | RES=w2 4 | i=0 5 | while true 6 | do 7 | i=$[ $i+1 ] 8 | echo Invalidate $i 9 | drbdadm invalidate $RES 10 | drbdsetup --statistics status $RES 11 | sleep 5 12 | drbdsetup --statistics status $RES 13 | # time drbdadm wait-sync $RES 14 | # drbdsetup --statistics status $RES 15 | # sleep 5 16 | # drbdsetup --statistics status $RES 17 | done 18 | -------------------------------------------------------------------------------- /windrbd-test/invalidate-loop2023.sh: -------------------------------------------------------------------------------- 1 | RES=invalidate-test 2 | i=0 3 | 4 | time drbdadm up $RES 5 | while true 6 | do 7 | i=$[ $i+1 ] 8 | echo Invalidate $i 9 | date 10 | time drbdadm invalidate $RES 11 | drbdadm status $RES 12 | time drbdadm wait-sync $RES 13 | sleep 1 14 | done 15 | -------------------------------------------------------------------------------- /windrbd-test/invalidate-remote-loop.sh: -------------------------------------------------------------------------------- 1 | i=0 2 | while true 3 | do 4 | i=$[ $i+1 ] 5 | echo Invalidating remote $i 6 | drbdadm invalidate-remote w0 7 | sleep 5 8 | done 9 | -------------------------------------------------------------------------------- /windrbd-test/invalidate-wait-sync-loop.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | RES=${RES:-vamp-2nodes} 4 | i=0 5 | while true 6 | do 7 | i=$[ $i+1 ] 8 | echo Invalidate $i 9 | drbdadm invalidate $RES 10 | drbdadm status $RES 11 | drbdadm wait-sync $RES 12 | drbdadm status $RES 13 | sleep 1 14 | done 15 | -------------------------------------------------------------------------------- /windrbd-test/io-loop.sh: -------------------------------------------------------------------------------- 1 | i=0 2 | while true 3 | do 4 | i=$[ $i + 1 ] 5 | echo "1 meg I/O $i" 6 | ./windrbd-test.exe --gtest_filter=windrbd.do_write_read_whole_disk_by_1meg_requests --drive=K: --force >/dev/null 2>&1 7 | done 8 | -------------------------------------------------------------------------------- /windrbd-test/io-loop2023.sh: -------------------------------------------------------------------------------- 1 | MINOR=2 2 | RES=test-16tb 3 | FIO=/home/Administrator/fio-3.27-x64/fio 4 | 5 | drbdadm up $RES 6 | i=0 7 | while true 8 | do 9 | i=$[ $i+1 ] 10 | echo "I/O loop $i ..." 11 | 12 | $FIO --name=i:test-123 --size=1000m --rw=randrw --direct=1 --bs=4k --numjobs=1 --iodepth=100 13 | if [ $? -ne 0 ] ; then 14 | echo "I/O failed" 15 | drbdadm status $RES 16 | fi 17 | drbdadm secondary $RES 18 | drbdadm primary $RES --force 19 | done 20 | -------------------------------------------------------------------------------- /windrbd-test/iptables-dont-drop-diskless.sh: -------------------------------------------------------------------------------- 1 | sudo iptables -D INPUT -p tcp --destination-port 7684 -j DROP 2 | sudo iptables -D INPUT -p tcp --source-port 7684 -j DROP 3 | sudo iptables -D OUTPUT -p tcp --destination-port 7684 -j DROP 4 | sudo iptables -D OUTPUT -p tcp --source-port 7684 -j DROP 5 | -------------------------------------------------------------------------------- /windrbd-test/iptables-dont-drop-port.sh: -------------------------------------------------------------------------------- 1 | if [ $# -ne 1 ] ; then 2 | echo "Usage: $0 " 3 | exit 1 4 | fi 5 | 6 | PORT=$1 7 | sudo iptables -D INPUT -p tcp --destination-port $PORT -j DROP 8 | sudo iptables -D INPUT -p tcp --source-port $PORT -j DROP 9 | sudo iptables -D OUTPUT -p tcp --destination-port $PORT -j DROP 10 | sudo iptables -D OUTPUT -p tcp --source-port $PORT -j DROP 11 | -------------------------------------------------------------------------------- /windrbd-test/iptables-dont-drop.sh: -------------------------------------------------------------------------------- 1 | sudo iptables -D INPUT -p tcp --destination-port 7600 -j DROP 2 | sudo iptables -D INPUT -p tcp --source-port 7600 -j DROP 3 | sudo iptables -D OUTPUT -p tcp --destination-port 7600 -j DROP 4 | sudo iptables -D OUTPUT -p tcp --source-port 7600 -j DROP 5 | -------------------------------------------------------------------------------- /windrbd-test/iptables-drop-diskless.sh: -------------------------------------------------------------------------------- 1 | sudo iptables -I INPUT 1 -p tcp --destination-port 7684 -j DROP 2 | sudo iptables -I INPUT 1 -p tcp --source-port 7684 -j DROP 3 | sudo iptables -I OUTPUT 1 -p tcp --destination-port 7684 -j DROP 4 | sudo iptables -I OUTPUT 1 -p tcp --source-port 7684 -j DROP 5 | -------------------------------------------------------------------------------- /windrbd-test/iptables-drop-dont-drop-loop.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # run as root on a Linux host port is hardcoded to 7600 3 | i=0 4 | PORT=7600 5 | RES=w0 6 | # PORT=7695 7 | # RES=windows10-boot 8 | 9 | while true 10 | do 11 | i=$[ $i+1 ] 12 | echo "network failure $i" 13 | echo "about to drop packets" 14 | ./iptables-drop-port.sh $PORT 15 | sleep 30 # ping timeout 16 | drbdadm status 17 | echo "about to not drop packets" 18 | ./iptables-dont-drop-port.sh $PORT 19 | sudo drbdadm wait-sync $RES 20 | drbdadm status 21 | sleep 20 # so we can do something ... 22 | drbdadm status 23 | done 24 | -------------------------------------------------------------------------------- /windrbd-test/iptables-drop-port.sh: -------------------------------------------------------------------------------- 1 | if [ $# -ne 1 ] ; then 2 | echo "Usage: $0 " 3 | exit 1 4 | fi 5 | 6 | PORT=$1 7 | sudo iptables -I INPUT 1 -p tcp --destination-port $PORT -j DROP 8 | sudo iptables -I INPUT 1 -p tcp --source-port $PORT -j DROP 9 | sudo iptables -I OUTPUT 1 -p tcp --destination-port $PORT -j DROP 10 | sudo iptables -I OUTPUT 1 -p tcp --source-port $PORT -j DROP 11 | -------------------------------------------------------------------------------- /windrbd-test/iptables-drop.sh: -------------------------------------------------------------------------------- 1 | sudo iptables -I INPUT 1 -p tcp --destination-port 7600 -j DROP 2 | sudo iptables -I INPUT 1 -p tcp --source-port 7600 -j DROP 3 | sudo iptables -I OUTPUT 1 -p tcp --destination-port 7600 -j DROP 4 | sudo iptables -I OUTPUT 1 -p tcp --source-port 7600 -j DROP 5 | -------------------------------------------------------------------------------- /windrbd-test/load-unload-test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | RES=${RES:-w0} 4 | i=0 5 | while true 6 | do 7 | i=$[ $i+1 ] 8 | echo "Load/Unload $i" 9 | # Currently BSODs with this: 10 | drbdadm up $RES 11 | 12 | # No BSOD with this (10 minutes test) 13 | # drbdadm status 14 | # Now trying with disk only (no connect) 15 | # drbdsetup new-resource w0 2 16 | # drbdsetup new-minor w0 5 17 17 | # drbdmeta 5 v09 G: flex-external apply-al 18 | # drbdsetup attach 5 F: G: flexible 19 | 20 | drbdadm status 21 | drbdadm wait-connect $RES 22 | drbdadm status 23 | 24 | sleep 2 25 | drbdadm down all 26 | sc stop windrbdumhelper 27 | sc stop windrbdlog 28 | sc stop windrbd 29 | sc query windrbd 30 | done 31 | -------------------------------------------------------------------------------- /windrbd-test/loop.sh: -------------------------------------------------------------------------------- 1 | if [ $# -lt 3 ] 2 | then 3 | echo "Usage: $0 " 4 | exit 1 5 | fi 6 | 7 | msg=$1 8 | shift 9 | 10 | sleep_interval=$1 11 | shift 12 | 13 | loop_cnt=${LOOP_CNT:-1000000} 14 | 15 | i=0 16 | while [ $i -lt $loop_cnt ] 17 | do 18 | i=$[ $i+1 ] 19 | echo $msg $i 20 | $* 21 | sleep $sleep_interval 22 | done 23 | -------------------------------------------------------------------------------- /windrbd-test/primary-secondary-loop.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -x 2 | i=0 3 | while true 4 | do 5 | i=$[ $i+1 ] 6 | echo Primary/Secondary $i 7 | drbdadm primary w0 8 | drbdadm secondary w0 9 | sleep 1 10 | done 11 | -------------------------------------------------------------------------------- /windrbd-test/read_m_test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | i=0 4 | while true 5 | do 6 | i=$[ $i+1 ] 7 | echo "Read 1M $i" 8 | ./windrbd-test --gtest_filter=windrbd.do_write_read_whole_disk_by_1meg_requests --mode=r --drive=M: --force --expected-size=$[ 45*1024*1024 ] 9 | done 10 | 11 | -------------------------------------------------------------------------------- /windrbd-test/resize-test/resize-backing-device.diskpart: -------------------------------------------------------------------------------- 1 | select volume 0 2 | extend size=100 3 | -------------------------------------------------------------------------------- /windrbd-test/resize-test/resize-test.sh: -------------------------------------------------------------------------------- 1 | i=0 2 | 3 | while true 4 | do 5 | i=$[ $i+1 ] 6 | echo "Resize $i ..." 7 | diskpart /s resize-backing-device.diskpart 8 | drbdadm resize reattach2 9 | diskpart /s resize-windrbd-device.diskpart 10 | 11 | df /cygdrive/g 12 | # and check if it still can be mounted: 13 | drbdadm secondary reattach2 14 | drbdadm primary reattach2 15 | 16 | cat /cygdrive/g/data 17 | 18 | sleep 5 19 | done 20 | -------------------------------------------------------------------------------- /windrbd-test/resize-test/resize-windrbd-device.diskpart: -------------------------------------------------------------------------------- 1 | rescan 2 | select volume 9 3 | extend filesystem 4 | -------------------------------------------------------------------------------- /windrbd-test/resync-secs.sh: -------------------------------------------------------------------------------- 1 | grep 'Resync done' /var/log/syslog | sed -e 's/.*total \([0-9][0-9]*\) sec.*/\1/g' | sort -n 2 | -------------------------------------------------------------------------------- /windrbd-test/resync-speed-test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | i=0 4 | while true 5 | do 6 | i=$[ $i+1 ] 7 | echo Resync $i 8 | drbdadm invalidate w0 9 | time drbdadm wait-sync w0 10 | done 11 | -------------------------------------------------------------------------------- /windrbd-test/secondary-and-invalidate-remote-loop.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | i=0 3 | while true 4 | do 5 | i=$[ $i+1 ] 6 | echo Secondary $i 7 | drbdadm secondary w0 8 | drbdadm status 9 | sleep 5 10 | echo Invalidating remote $i 11 | drbdadm invalidate-remote w0 12 | drbdadm status 13 | sleep 3 14 | drbdadm status 15 | drbdadm wait-sync w0 16 | drbdadm status 17 | echo Primary $i 18 | drbdadm primary w0 19 | drbdadm status 20 | sleep 10 21 | done 22 | -------------------------------------------------------------------------------- /windrbd-test/simple-wait-connect-test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Meant to test n>2 nodes connect 3 | i=0 4 | while true 5 | do 6 | i=$[ $i+1 ] 7 | echo Down/Up/Reconnect $i 8 | 9 | echo Down 10 | time drbdadm down w2 11 | echo Up 12 | time drbdadm up w2 13 | date 14 | drbdadm status w2 15 | echo Wait-connect 16 | time drbdadm wait-connect w2 17 | date 18 | drbdadm status w2 19 | done 20 | -------------------------------------------------------------------------------- /windrbd-test/suspend-io-and-invalidate-remote-loop.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | i=0 3 | while true 4 | do 5 | i=$[ $i+1 ] 6 | echo Suspending I/O $i 7 | drbdadm suspend-io w0 8 | drbdadm status 9 | sleep 5 10 | echo Invalidating remote $i 11 | drbdadm invalidate-remote w0 12 | drbdadm status 13 | sleep 3 14 | drbdadm status 15 | drbdadm wait-sync w0 16 | drbdadm status 17 | echo Resuming I/O $i 18 | drbdadm resume-io w0 19 | drbdadm status 20 | sleep 5 21 | done 22 | -------------------------------------------------------------------------------- /windrbd-test/test-case-io-larger-than-1m.sh: -------------------------------------------------------------------------------- 1 | # this should not BSOD 2 | # it is normal that the test shows I/O errors since we fault inject here 3 | 4 | res=${RES:-w0} 5 | export LOOP_CNT=${LOOP_CNT:-3} 6 | megs=${REQ_SIZE:-2} 7 | size=${SIZE:-49} 8 | drive=${DRIVE:-'k:'} 9 | 10 | drbdadm down $res 11 | drbdadm up $res 12 | drbdadm primary $res --force 13 | windrbd inject-faults 100 backing-completion $drive 14 | loop.sh 'rw test' 0 write-disk-one-meg.sh $drive $[ $size*1024*1024 ] $[ $megs*1024*1024 ] rw 15 | drbdadm down $res 16 | # also fault injection disabled here .. it is per backing device which does not exist any more. 17 | -------------------------------------------------------------------------------- /windrbd-test/test-case-write-2m-chunks-no-fault-injection.sh: -------------------------------------------------------------------------------- 1 | # this should not BSOD 2 | # it is normal that the test shows I/O errors since we fault inject here 3 | 4 | res=${RES:-w0} 5 | export LOOP_CNT=${LOOP_CNT:-3} 6 | megs=${REQ_SIZE:-2} 7 | size=${SIZE:-49} 8 | drive=${DRIVE:-'k:'} 9 | 10 | drbdadm down $res 11 | drbdadm up $res 12 | drbdadm primary $res --force 13 | # windrbd inject-faults 100 backing-completion $drive 14 | loop.sh 'rw test' 0 write-disk-one-meg.sh $drive $[ $size*1024*1024 ] $[ $megs*1024*1024 ] rw 15 | drbdadm down $res 16 | # also fault injection disabled here .. it is per backing device which does not exist any more. 17 | -------------------------------------------------------------------------------- /windrbd-test/test-loop.sh: -------------------------------------------------------------------------------- 1 | i=0 2 | while true 3 | do 4 | i=$[ $i+1 ] 5 | echo Test $i 6 | ./test.sh 7 | done 8 | -------------------------------------------------------------------------------- /windrbd-test/test-reading-past-end-of-device.sh: -------------------------------------------------------------------------------- 1 | # Note: this works only when there is no filesytem on the device. 2 | windrbd-test.exe --gtest_filter=windrbd.do_read_past\* --expected-size=52387840 --drive=K: 3 | -------------------------------------------------------------------------------- /windrbd-test/test.cpp: -------------------------------------------------------------------------------- 1 | #include "gtest/gtest.h" 2 | 3 | TEST(example, fail) 4 | { 5 | ASSERT_TRUE(false); 6 | } 7 | 8 | TEST(example, pass) 9 | { 10 | ASSERT_FALSE(false); 11 | } 12 | -------------------------------------------------------------------------------- /windrbd-test/test.sh: -------------------------------------------------------------------------------- 1 | set -x 2 | 3 | RES=w0 4 | DRIVE_LETTER=k 5 | 6 | drbdadm up $RES 7 | drbdadm down $RES 8 | 9 | drbdadm up $RES 10 | drbdadm detach $RES 11 | drbdadm attach $RES 12 | drbdadm down $RES 13 | 14 | drbdadm up $RES 15 | drbdadm primary $RES 16 | drbdadm secondary $RES 17 | drbdadm down $RES 18 | 19 | drbdadm up $RES 20 | drbdadm primary $RES 21 | # format is unstable with CygWin 22 | # echo -e 'j\nj\nj\nj\nj\n' | format.com ${DRIVE_LETTER}: 23 | cp /dev/urandom /cygdrive/${DRIVE_LETTER}/data 24 | sync 25 | drbdadm secondary $RES 26 | drbdadm down $RES 27 | 28 | -------------------------------------------------------------------------------- /windrbd-test/tests-from-4/busy-sync-monitor.ps1: -------------------------------------------------------------------------------- 1 | $res = "rds_resource" 2 | $minor = 1 3 | 4 | $c = [cultureinfo]::GetCultureInfo('en-EN') 5 | 6 | $synced = [decimal]-1 7 | $stalled = 0 8 | 9 | $suspended = $false 10 | 11 | while ($true) { 12 | $s = drbdadm status $res 13 | 14 | $syncing = $False 15 | foreach ($l in $s) { 16 | if ($l -match'replication:SyncSource.*done:([0-9.]*)') { 17 | $syncing = $true 18 | 19 | $d = [decimal]::Parse($matches[1], $c) 20 | if ($d -eq $synced) { 21 | $stalled++ 22 | echo "sync stalled at $d ($stalled) ..." 23 | } else { 24 | $stalled = 0 25 | } 26 | if ($stalled -eq 10) { 27 | echo "sync still stalled, trying to suspend io" 28 | windrbd suspend-io-for-minor $minor 29 | $suspended = $true 30 | } 31 | if ($stalled -eq 20) { 32 | echo "sync still stalled, suspend-io did not work, we should escalate now" 33 | windrbd resume-io-for-minor $minor 34 | $suspended = $false 35 | } 36 | 37 | $synced = $d 38 | } 39 | } 40 | if (!$syncing -and $suspended) { 41 | windrbd resume-io-for-minor $minor 42 | $suspended = $false 43 | } 44 | sleep 1 45 | } 46 | -------------------------------------------------------------------------------- /windrbd-test/tests-from-4/del-all-linbit-drivers.sh: -------------------------------------------------------------------------------- 1 | for i in $( pnputil -e | grep LINBIT -B 5 | grep oem | cut -c 29-36 ) ; do pnputil -d $i ; done 2 | -------------------------------------------------------------------------------- /windrbd-test/tests-from-4/disk-timeout-loop.sh: -------------------------------------------------------------------------------- 1 | MINOR=2 2 | RES=test-16tb 3 | FIO=/home/Administrator/fio-3.27-x64/fio 4 | 5 | drbdadm up $RES 6 | drbdadm primary --force $RES 7 | 8 | i=0 9 | failed=0 10 | while true 11 | do 12 | i=$[ $i+1 ] 13 | echo "Disk timeout $i ($failed failed) ..." 14 | date 15 | 16 | drbdsetup disk-options $MINOR --set-defaults --disk-timeout=1 17 | $FIO --name=i:test-123 --size=1000m --rw=randrw --direct=1 --bs=4k --numjobs=1 --iodepth=1000 18 | if [ $? -ne 0 ] ; then 19 | echo "I/O failed" 20 | drbdadm status $RES 21 | failed=$[ $failed+1 ] 22 | # exit 1 23 | fi 24 | drbdadm secondary $RES 25 | # failed? with I/O error on meta data access 26 | drbdadm adjust $RES 27 | # drbdadm down $RES 28 | # drbdadm up $RES 29 | 30 | # drbdsetup disk-options $MINOR --set-defaults --disk-timeout=0 31 | 32 | # drbdadm secondary $RES 33 | drbdadm primary $RES --force 34 | done 35 | -------------------------------------------------------------------------------- /windrbd-test/tests-from-4/do-debug.sh: -------------------------------------------------------------------------------- 1 | '/cygdrive/h/Program Files/Windows Kits/10/Debuggers/x64/windbg.exe' -z c:\\windows\\memory.dmp -y 'srv*;Y:\windrbd-1.1-branch\windrbd\windrbd\src;Y:\windrbd-1.1-branch\windrbd\converted-sources\drbd' 2 | #'/cygdrive/h/Program Files/Windows Kits/10/Debuggers/x64/kd.exe' -z c:\\windows\\memory.dmp -y 'srv*;Y:\windrbd-1.1-branch\windrbd\windrbd\src;Y:\windrbd-1.1-branch\windrbd\converted-sources\drbd' 3 | -------------------------------------------------------------------------------- /windrbd-test/tests-from-4/install-windrbd-certificates.sh: -------------------------------------------------------------------------------- 1 | curl https://nexus.at.linbit.com/repository/windows/WinDRBD/linbit-trusted-cert.cer > linbit-trusted-cert.cer 2 | certutil -addstore -f root linbit-trusted-cert.cer 3 | certutil -addstore "TrustedPublisher" linbit-trusted-cert.cer 4 | curl https://nexus.at.linbit.com/repository/windows/WinDRBD/linbit-self-signed-cert.cer > linbit-self-signed-cert.cer 5 | certutil -addstore -f root linbit-self-signed-cert.cer 6 | certutil -addstore "TrustedPublisher" linbit-self-signed-cert.cer 7 | -------------------------------------------------------------------------------- /windrbd-test/tests-from-4/io-loop.sh: -------------------------------------------------------------------------------- 1 | MINOR=2 2 | RES=test-16tb 3 | FIO=/home/Administrator/fio-3.27-x64/fio 4 | 5 | drbdadm up $RES 6 | i=0 7 | while true 8 | do 9 | i=$[ $i+1 ] 10 | echo "I/O loop $i ..." 11 | 12 | $FIO --name=i:test-123 --size=1000m --rw=randrw --direct=1 --bs=4k --numjobs=1 --iodepth=100 13 | if [ $? -ne 0 ] ; then 14 | echo "I/O failed" 15 | drbdadm status $RES 16 | fi 17 | drbdadm secondary $RES 18 | drbdadm primary $RES --force 19 | done 20 | -------------------------------------------------------------------------------- /windrbd-test/tests-from-4/start-rds-resource.sh: -------------------------------------------------------------------------------- 1 | i=0 2 | 3 | while true 4 | do 5 | i=$[ $i+1 ] 6 | echo starting rds resource $i ... 7 | date 8 | drbdadm -d up rds_resource 9 | drbdadm up rds_resource 10 | sleep 60 11 | done 12 | -------------------------------------------------------------------------------- /windrbd-test/updown-loop-disconnect-while-still-syncing.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | i=0 3 | RES=vamp-2nodes 4 | 5 | # When not letting sync finish, Windows Server 2016 freezes 6 | # (after 2200 iterations of write-fs-loop) 7 | 8 | while true 9 | do 10 | i=$[ $i+1 ] 11 | echo "Down $i" 12 | drbdadm down $RES 13 | sleep 10 14 | echo "Up $i" 15 | drbdadm up $RES 16 | echo "Up finished $i" 17 | drbdadm wait-connect $RES 18 | echo "Connected $i" 19 | # drbdadm wait-sync $RES 20 | # echo "Waiting for sync finished $i" 21 | # sleep 5 22 | sleep 3 23 | done 24 | -------------------------------------------------------------------------------- /windrbd-test/updown-loop-wait-connected.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | RES=${RES:-w0} 4 | i=0 5 | 6 | while true 7 | do 8 | i=$[ $i+1 ] 9 | echo Loop $i 10 | drbdadm up $RES 11 | echo Up $i 12 | drbdadm wait-connect $RES 13 | echo Connected $i 14 | sleep 1 15 | drbdadm down $RES 16 | echo Down $i 17 | sleep 1 18 | done 19 | -------------------------------------------------------------------------------- /windrbd-test/updown-loop-wait-until-synced.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | i=0 3 | while true 4 | do 5 | i=$[ $i+1 ] 6 | echo "Down $i" 7 | sudo drbdadm down w0 8 | echo "Up $i" 9 | sudo drbdadm up w0 10 | drbdadm status 11 | echo "Waiting for sync $i" 12 | sudo time drbdadm wait-sync w0 13 | drbdadm status 14 | sleep 1 15 | done 16 | -------------------------------------------------------------------------------- /windrbd-test/updown-loop.sh: -------------------------------------------------------------------------------- 1 | i=0 2 | while true 3 | do 4 | i=$[ $i+1 ] 5 | echo Up/Down $i 6 | drbdadm up w0 7 | drbdadm down w0 8 | sleep 1 9 | done 10 | -------------------------------------------------------------------------------- /windrbd-test/updown-loop2023.sh: -------------------------------------------------------------------------------- 1 | RES=large1 2 | i=0 3 | while true 4 | do 5 | i=$[ $i+1 ] 6 | echo Up/Down $i 7 | date 8 | time drbdadm up $RES 9 | time drbdadm down $RES 10 | sleep 1 11 | done 12 | -------------------------------------------------------------------------------- /windrbd-test/wait-for-connect-test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | i=0 3 | 4 | while true 5 | do 6 | i=$[ $i+1 ] 7 | echo "diconnect / connect / wait-for-connect $i" 8 | drbdadm disconnect w0 9 | drbdadm connect w0 10 | drbdsetup wait-connect-resource w0 11 | c=`drbdadm cstate w0` 12 | if [ $c != Connected ] 13 | then 14 | echo "state is $c" 15 | drbdadm status 16 | # break 17 | fi 18 | done 19 | drbdadm status 20 | 21 | -------------------------------------------------------------------------------- /windrbd-test/write-disk-one-meg.sh: -------------------------------------------------------------------------------- 1 | ./windrbd-test --drive=$1 --gtest_filter=windrbd.do_write_read_whole_disk_by_1meg_requests --expected-size=$2 --request-size=$3 --mode=$4 --force 2 | -------------------------------------------------------------------------------- /windrbd-test/write-disk.sh: -------------------------------------------------------------------------------- 1 | ./windrbd-test --drive=$1 --gtest_filter=windrbd.do_write_read_whole_disk --expected-size=$2 --force 2 | -------------------------------------------------------------------------------- /windrbd-test/write-fs-loop-2021.sh: -------------------------------------------------------------------------------- 1 | # DRIVE=f 2 | DRIVE=k 3 | # DRIVE=h 4 | # DRIVE=c 5 | 6 | i=0 7 | while true 8 | do 9 | i=$[ $i+1 ] 10 | echo Write File $i 11 | date 12 | time ( 13 | dd if=/dev/zero of=/cygdrive/$DRIVE/data bs=4096 count=10000 14 | sync 15 | ) 16 | sleep 1 17 | done 18 | -------------------------------------------------------------------------------- /windrbd-test/write-fs-loop-l.sh: -------------------------------------------------------------------------------- 1 | # DRIVE=f 2 | DRIVE=l 3 | i=0 4 | while true 5 | do 6 | i=$[ $i+1 ] 7 | echo Write File $i 8 | #cp /dev/urandom /cygdrive/k/data 9 | cp /dev/zero /cygdrive/$DRIVE/data 10 | sync 11 | # sleep 1 12 | done 13 | -------------------------------------------------------------------------------- /windrbd-test/write-fs-loop-linux-1m-blocks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | i=0 4 | while true 5 | do 6 | i=$[ $i+1 ] 7 | echo Write File $i 8 | # cp /dev/zero /home/johannes/Linbit/tmp/mnt/data 9 | dd if=/dev/zero of=/home/johannes/Linbit/tmp/mnt/data bs=$[ 1024*1024 ] count=40 10 | sync 11 | date 12 | done 13 | -------------------------------------------------------------------------------- /windrbd-test/write-fs-loop-linux-direct.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | i=0 4 | while true 5 | do 6 | i=$[ $i+1 ] 7 | echo Write File $i 8 | # cp /dev/zero /home/johannes/Linbit/tmp/mnt/data 9 | # dd if=/dev/zero of=/home/johannes/Linbit/tmp/mnt/data bs=$[ 1024*1024 ] count=40 10 | dd if=/dev/zero of=/home/johannes/Linbit/tmp/mnt/data bs=$[ 1024*1024 ] count=40 oflag=sync 11 | #sync 12 | date 13 | done 14 | -------------------------------------------------------------------------------- /windrbd-test/write-fs-loop-linux-raw.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | i=0 4 | while true 5 | do 6 | i=$[ $i+1 ] 7 | echo Write File $i 8 | # cp /dev/zero /home/johannes/Linbit/tmp/mnt/data 9 | dd if=/dev/zero of=/dev/drbd26 bs=$[ 1024*1024 ] count=40 10 | sync 11 | date 12 | done 13 | -------------------------------------------------------------------------------- /windrbd-test/write-fs-loop-linux-w2.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | i=0 4 | while true 5 | do 6 | i=$[ $i+1 ] 7 | echo Write File $i 8 | # cp /dev/zero /home/johannes/Linbit/tmp/mnt/data 9 | time ( 10 | # dd if=/dev/zero of=/home/johannes/Linbit/tmp/mnt/data bs=$[ 1024*1024 ] count=30 11 | dd if=/dev/zero of=/home/johannes/Linbit/tmp/mnt2/data bs=$[ 1024 ] count=$[ 30 * 1024 ] 12 | sync 13 | ) 14 | date 15 | done 16 | -------------------------------------------------------------------------------- /windrbd-test/write-fs-loop-linux.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | i=0 4 | while true 5 | do 6 | i=$[ $i+1 ] 7 | echo Write File $i 8 | # cp /dev/zero /home/johannes/Linbit/tmp/mnt/data 9 | time ( 10 | # dd if=/dev/zero of=/home/johannes/Linbit/tmp/mnt/data bs=$[ 1024*1024 ] count=30 11 | # dd if=/dev/zero of=/home/johannes/Linbit/tmp/mnt/data bs=$[ 1024 ] count=$[ 30 * 1024 ] 12 | dd if=/dev/zero of=/home/johannes/Linbit/mnt/data bs=$[ 1024 ] count=$[ 30 * 1024 ] 13 | sync 14 | ) 15 | date 16 | done 17 | -------------------------------------------------------------------------------- /windrbd-test/write-fs-loop-m-paralell.sh: -------------------------------------------------------------------------------- 1 | # DRIVE=f 2 | DRIVE=m 3 | 4 | do_write() { 5 | i=0 6 | while [ $i -lt 100 ] 7 | do 8 | i=$[ $i+1 ] 9 | echo Write File $i 10 | #cp /dev/urandom /cygdrive/k/data 11 | dd if=/dev/zero of=/cygdrive/$DRIVE/data$1 bs=1024 count=1024 12 | sync 13 | # sleep 1 14 | done 15 | } 16 | 17 | do_read() { 18 | i=0 19 | while [ $i -lt 100 ] 20 | do 21 | i=$[ $i+1 ] 22 | echo Read File $i 23 | #cp /dev/urandom /cygdrive/k/data 24 | dd of=/dev/null if=/cygdrive/$DRIVE/data$1 bs=1024 count=1024 25 | sync 26 | # sleep 1 27 | done 28 | } 29 | 30 | i=0 31 | while [ $i -lt 50 ] 32 | do 33 | i=$[ $i+1 ] 34 | do_write $i & 35 | do_read $i & 36 | done 37 | -------------------------------------------------------------------------------- /windrbd-test/write-fs-loop-m.sh: -------------------------------------------------------------------------------- 1 | # DRIVE=f 2 | DRIVE=m 3 | i=0 4 | while true 5 | do 6 | i=$[ $i+1 ] 7 | echo Write File $i 8 | #cp /dev/urandom /cygdrive/k/data 9 | cp /dev/zero /cygdrive/$DRIVE/data 10 | sync 11 | # sleep 1 12 | done 13 | -------------------------------------------------------------------------------- /windrbd-test/write-fs-loop.sh: -------------------------------------------------------------------------------- 1 | # DRIVE=f 2 | # DRIVE=k 3 | DRIVE=x 4 | i=0 5 | while true 6 | do 7 | i=$[ $i+1 ] 8 | echo Write File $i 9 | #cp /dev/urandom /cygdrive/k/data 10 | cp /dev/zero /cygdrive/$DRIVE/data 11 | sync 12 | # sleep 1 13 | done 14 | -------------------------------------------------------------------------------- /windrbd/include/asm/byteorder.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/windrbd/include/asm/byteorder.h -------------------------------------------------------------------------------- /windrbd/include/asm/kmap_types.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/windrbd/include/asm/kmap_types.h -------------------------------------------------------------------------------- /windrbd/include/asm/types.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/windrbd/include/asm/types.h -------------------------------------------------------------------------------- /windrbd/include/asm/unaligned.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/windrbd/include/asm/unaligned.h -------------------------------------------------------------------------------- /windrbd/include/compat.h: -------------------------------------------------------------------------------- 1 | /* Settings here are WinDRBD specific and maintained by hand. */ 2 | 3 | #ifndef __DRBD_COMPAT_H 4 | #define __DRBD_COMPAT_H 5 | 6 | #define COMPAT_SOCK_OPS_RETURNS_ADDR_LEN 1 7 | // #define COMPAT_HAVE_BLKDEV_GET_BY_PATH 1 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /windrbd/include/linux/backing-dev.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/windrbd/include/linux/backing-dev.h -------------------------------------------------------------------------------- /windrbd/include/linux/bitsperlong.h: -------------------------------------------------------------------------------- 1 | /* THIS IS A BAD NAME. 2 | * A "long" on windows is 32bit, even on 64bit architectures; 3 | * but WDRBD is really using a "ULONG_PTR" in most places, 4 | * which is pointer-sized. 5 | * 6 | * But renaming that to BITS_PER_ULONG_PTR isn't nice either; 7 | * guess we'll just have to live with that. 8 | * 9 | * TODO: review DRBD code for usage of this. 10 | * */ 11 | #ifndef BITS_PER_LONG 12 | #if defined(_WIN64) 13 | # define BITS_PER_LONG 64 14 | #elif defined(_WIN32) 15 | # define BITS_PER_LONG 32 16 | #else 17 | # define BITS_PER_LONG __WORDSIZE 18 | #endif 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /windrbd/include/linux/blkpg.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/windrbd/include/linux/blkpg.h -------------------------------------------------------------------------------- /windrbd/include/linux/compiler.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/windrbd/include/linux/compiler.h -------------------------------------------------------------------------------- /windrbd/include/linux/cpumask.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/windrbd/include/linux/cpumask.h -------------------------------------------------------------------------------- /windrbd/include/linux/crc32c.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/windrbd/include/linux/crc32c.h -------------------------------------------------------------------------------- /windrbd/include/linux/ctype.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /windrbd/include/linux/debugfs.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/windrbd/include/linux/debugfs.h -------------------------------------------------------------------------------- /windrbd/include/linux/device.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/windrbd/include/linux/device.h -------------------------------------------------------------------------------- /windrbd/include/linux/dynamic_debug.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/windrbd/include/linux/dynamic_debug.h -------------------------------------------------------------------------------- /windrbd/include/linux/errno.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/windrbd/include/linux/errno.h -------------------------------------------------------------------------------- /windrbd/include/linux/file.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/windrbd/include/linux/file.h -------------------------------------------------------------------------------- /windrbd/include/linux/fs.h: -------------------------------------------------------------------------------- 1 | #ifndef _FS_H 2 | #define _FS_H 3 | 4 | static inline int bd_link_disk_holder(struct block_device *bdev, 5 | struct gendisk *disk) 6 | { 7 | return 0; 8 | } 9 | static inline void bd_unlink_disk_holder(struct block_device *bdev, 10 | struct gendisk *disk) 11 | { 12 | } 13 | 14 | #endif 15 | 16 | -------------------------------------------------------------------------------- /windrbd/include/linux/genetlink.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/windrbd/include/linux/genetlink.h -------------------------------------------------------------------------------- /windrbd/include/linux/genhd.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/windrbd/include/linux/genhd.h -------------------------------------------------------------------------------- /windrbd/include/linux/highmem.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/windrbd/include/linux/highmem.h -------------------------------------------------------------------------------- /windrbd/include/linux/hweight.h: -------------------------------------------------------------------------------- 1 | #ifndef __HWEIGHT_H__ 2 | #define __HWEIGHT_H__ 3 | #include "linux/types.h" 4 | 5 | extern unsigned int hweight32(unsigned int w); 6 | extern unsigned int hweight16(unsigned int w); 7 | extern unsigned int hweight8(unsigned int w); 8 | #ifdef _WIN32 9 | #ifdef _WIN64 10 | extern unsigned long long hweight64(__u64 w); 11 | #else 12 | extern unsigned long hweight64(__u64 w); 13 | #endif 14 | #else 15 | extern unsigned long hweight64(__u64 w); 16 | #endif 17 | #endif 18 | -------------------------------------------------------------------------------- /windrbd/include/linux/in.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/windrbd/include/linux/in.h -------------------------------------------------------------------------------- /windrbd/include/linux/init.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/windrbd/include/linux/init.h -------------------------------------------------------------------------------- /windrbd/include/linux/jiffies.h: -------------------------------------------------------------------------------- 1 | #ifndef __JIFFIES_H__ 2 | #define __JIFFIES_H__ 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #define HZ 1000 10 | 11 | __inline unsigned int jiffies_to_msecs(const UINT64 j) 12 | { 13 | return (unsigned int)j; 14 | } 15 | 16 | __inline u64 nsecs_to_jiffies(u64 n) 17 | { 18 | return n / (NSEC_PER_SEC / HZ); 19 | } 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /windrbd/include/linux/kconfig.h: -------------------------------------------------------------------------------- 1 | #ifndef KCONFIG_H 2 | #define KCONFIG_H 3 | 4 | #ifndef IS_ENABLED 5 | #define __ARG_PLACEHOLDER_1 0, 6 | #define __take_second_arg(__ignored, val, ...) val 7 | #define __is_defined(x) ___is_defined(x) 8 | #define ___is_defined(val) ____is_defined(__ARG_PLACEHOLDER_##val) 9 | #define ____is_defined(arg1_or_junk) __take_second_arg(arg1_or_junk 1, 0) 10 | #define IS_ENABLED(option) __is_defined(option) 11 | #endif 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /windrbd/include/linux/kernel.h: -------------------------------------------------------------------------------- 1 | #ifndef __KERNEL_H__ 2 | #define __KERNEL_H__ 3 | 4 | #include /* for uint64_t */ 5 | 6 | #ifndef BUILD_BUG_ON 7 | #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) 8 | #endif 9 | 10 | #define ULLONG_MAX (~0ULL) 11 | 12 | /* We have neither typeof() nor blocks in macros. So we define 13 | * this as a function. If you need signed values, you need to 14 | * touch this (DRBD currently does not). 15 | */ 16 | 17 | uint64_t roundup(uint64_t x, uint64_t y); 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /windrbd/include/linux/kref.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/windrbd/include/linux/kref.h -------------------------------------------------------------------------------- /windrbd/include/linux/kthread.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/windrbd/include/linux/kthread.h -------------------------------------------------------------------------------- /windrbd/include/linux/libnvdimm.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/windrbd/include/linux/libnvdimm.h -------------------------------------------------------------------------------- /windrbd/include/linux/major.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/windrbd/include/linux/major.h -------------------------------------------------------------------------------- /windrbd/include/linux/math64.h: -------------------------------------------------------------------------------- 1 | #ifndef _MATH64_H 2 | #define _MATH64_H 3 | 4 | #include 5 | 6 | static inline u64 div_u64_rem(u64 dividend, u32 divisor, u32 *remainder) 7 | { 8 | *remainder = dividend % divisor; 9 | return dividend / divisor; 10 | } 11 | 12 | static inline u64 div_u64(u64 dividend, u32 divisor) 13 | { 14 | u32 remainder; 15 | return div_u64_rem(dividend, divisor, &remainder); 16 | } 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /windrbd/include/linux/memcontrol.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/windrbd/include/linux/memcontrol.h -------------------------------------------------------------------------------- /windrbd/include/linux/mempool.h: -------------------------------------------------------------------------------- 1 | #ifndef MEMPOOL_H 2 | #define MEMPOOL_H 3 | 4 | #include 5 | 6 | #pragma warning (disable: 4201 4820) 7 | struct kmem_cache; 8 | 9 | #define MEMPOOL_KMALLOCED_MAGIC 0x59bd13f4 10 | 11 | typedef struct mempool_s { 12 | enum { 13 | MEMPOOL_PAGE, 14 | MEMPOOL_SLAB 15 | } type; 16 | union { 17 | struct kmem_cache *cache; 18 | struct { 19 | NPAGED_LOOKASIDE_LIST pageLS; 20 | NPAGED_LOOKASIDE_LIST page_addrLS; 21 | }; 22 | }; 23 | int is_kmalloced; 24 | } mempool_t; 25 | 26 | extern mempool_t *mempool_create_page_pool(int min_nr, int order, ULONG tag); 27 | extern mempool_t *mempool_create_slab_pool(int min_nr, struct kmem_cache *kc, ULONG tag); 28 | extern void mempool_destroy(mempool_t *pool); 29 | extern void *mempool_alloc(mempool_t *pool, gfp_t gfp_mask); 30 | extern void mempool_free(void *element, mempool_t *pool); 31 | 32 | static inline void mempool_exit(mempool_t *pool) 33 | { 34 | mempool_destroy(pool); 35 | } 36 | 37 | int mempool_init_page_pool(mempool_t *pool, int min_nr, int order); 38 | int mempool_init_slab_pool(mempool_t *pool, int min_nr, struct kmem_cache *kc); 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /windrbd/include/linux/mm.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/windrbd/include/linux/mm.h -------------------------------------------------------------------------------- /windrbd/include/linux/mm_inline.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/windrbd/include/linux/mm_inline.h -------------------------------------------------------------------------------- /windrbd/include/linux/module.h: -------------------------------------------------------------------------------- 1 | #ifndef LINUX_MODULE_H 2 | #define LINUX_MODULE_H 3 | 4 | #include /* for bool */ 5 | #include "drbd_windows.h" /* for atomic_t */ 6 | 7 | struct module { 8 | const char *version; 9 | atomic_t refcnt; 10 | }; 11 | 12 | extern struct module windrbd_module; 13 | 14 | /* Note: under Windows there is no seperate transport module, 15 | * the module code (sorry, TCP/IP only) is compiled into the 16 | * windrbd driver. 17 | */ 18 | 19 | #define THIS_MODULE (&windrbd_module) 20 | 21 | extern bool try_module_get(struct module *module); 22 | extern void module_put(struct module *module); 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /windrbd/include/linux/moduleparam.h: -------------------------------------------------------------------------------- 1 | #define module_param_named(a,b,c,d) 2 | -------------------------------------------------------------------------------- /windrbd/include/linux/mutex.h: -------------------------------------------------------------------------------- 1 | #ifndef __LINUX_MUTEX_H 2 | #define __LINUX_MUTEX_H 3 | 4 | #include 5 | 6 | struct mutex { 7 | KMUTEX mtx; 8 | }; 9 | 10 | extern void mutex_init(struct mutex *m); 11 | 12 | /* TODO: those should return int. These are Linux functions */ 13 | extern NTSTATUS mutex_lock(struct mutex *m); 14 | extern int mutex_lock_interruptible(struct mutex *m); 15 | extern NTSTATUS mutex_lock_timeout(struct mutex *m, ULONG msTimeout); 16 | extern int mutex_is_locked(struct mutex *m); 17 | extern void mutex_unlock(struct mutex *m); 18 | extern int mutex_trylock(struct mutex *m); 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /windrbd/include/linux/net/sock.h: -------------------------------------------------------------------------------- 1 | #ifndef _LINUX_NET_SOCK_H 2 | #define _LINUX_NET_SOCK_H 3 | 4 | #define SOCK_SNDBUF_LOCK 1 5 | #define SOCK_RCVBUF_LOCK 2 6 | 7 | struct socket; 8 | 9 | struct sock { 10 | int sk_sndtimeo; 11 | int sk_rcvtimeo; 12 | 13 | int sk_state; 14 | 15 | size_t sk_sndbuf; 16 | int sk_wmem_queued; 17 | size_t sk_rcvbuf; 18 | 19 | int sk_userlocks; 20 | 21 | void *sk_user_data; 22 | void (*sk_state_change)(struct sock *sk); 23 | spinlock_t sk_callback_lock; 24 | 25 | struct socket *sk_socket; 26 | }; 27 | 28 | #endif 29 | 30 | -------------------------------------------------------------------------------- /windrbd/include/linux/net_namespace.h: -------------------------------------------------------------------------------- 1 | /* We do not support net namespaces. */ 2 | 3 | struct net { 4 | int dummy; 5 | }; 6 | 7 | extern struct net init_net; 8 | -------------------------------------------------------------------------------- /windrbd/include/linux/netlink.h: -------------------------------------------------------------------------------- 1 | #ifndef _NETLINK_H 2 | #define _NETLINK_H 3 | 4 | struct netlink_skb_parms { 5 | __u32 portid; 6 | }; 7 | 8 | #define NETLINK_CB(skb) (*(struct netlink_skb_parms*)&((skb)->cb)) 9 | 10 | #endif 11 | 12 | -------------------------------------------------------------------------------- /windrbd/include/linux/notifier.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/windrbd/include/linux/notifier.h -------------------------------------------------------------------------------- /windrbd/include/linux/overflow.h: -------------------------------------------------------------------------------- 1 | /* Dummy. Most of overflow macros rely on typeof which does not 2 | * exist in the Windows C compiler. 3 | */ 4 | 5 | -------------------------------------------------------------------------------- /windrbd/include/linux/part_stat.h: -------------------------------------------------------------------------------- 1 | #ifndef PART_STAT_H 2 | #define PART_STAT_H 3 | 4 | enum stat_group { 5 | STAT_READ, 6 | STAT_WRITE, 7 | STAT_DISCARD, 8 | STAT_FLUSH, 9 | 10 | NR_STAT_GROUPS 11 | }; 12 | 13 | 14 | struct disk_stats { 15 | // u64 nsecs[NR_STAT_GROUPS]; 16 | ULONG_PTR sectors[NR_STAT_GROUPS]; 17 | /* 18 | unsigned long ios[NR_STAT_GROUPS]; 19 | unsigned long merges[NR_STAT_GROUPS]; 20 | unsigned long io_ticks; 21 | local_t in_flight[2]; 22 | */ 23 | }; 24 | 25 | #define part_stat_read(part, field) \ 26 | ((part)->bd_stats.field) 27 | 28 | #define part_stat_read_accum(part, field) \ 29 | (part_stat_read(part, field[STAT_READ]) + \ 30 | part_stat_read(part, field[STAT_WRITE]) + \ 31 | part_stat_read(part, field[STAT_DISCARD])) 32 | 33 | 34 | #define part_stat_add(part, field, addnd) do { \ 35 | (part)->bd_stats.field += addnd; \ 36 | } while (0) 37 | 38 | #define part_stat_dec(part, field) \ 39 | part_stat_add(part, field, -1) 40 | #define part_stat_inc(part, field) \ 41 | part_stat_add(part, field, 1) 42 | #define part_stat_sub(part, field, subnd) \ 43 | part_stat_add(part, field, -subnd) 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /windrbd/include/linux/pkt_sched.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/windrbd/include/linux/pkt_sched.h -------------------------------------------------------------------------------- /windrbd/include/linux/prefetch.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/windrbd/include/linux/prefetch.h -------------------------------------------------------------------------------- /windrbd/include/linux/proc_fs.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/windrbd/include/linux/proc_fs.h -------------------------------------------------------------------------------- /windrbd/include/linux/random.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/windrbd/include/linux/random.h -------------------------------------------------------------------------------- /windrbd/include/linux/ratelimit.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/windrbd/include/linux/ratelimit.h -------------------------------------------------------------------------------- /windrbd/include/linux/reboot.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/windrbd/include/linux/reboot.h -------------------------------------------------------------------------------- /windrbd/include/linux/refcount.h: -------------------------------------------------------------------------------- 1 | 2 | /* TODO: move refcount stuff in here */ 3 | -------------------------------------------------------------------------------- /windrbd/include/linux/rwlock.h: -------------------------------------------------------------------------------- 1 | #ifndef __LINUX_RWLOCK_H 2 | #define __LINUX_RWLOCK_H 3 | 4 | #include 5 | 6 | #if 0 7 | 8 | static inline void read_lock(rwlock_t *lock) 9 | { 10 | spin_lock((spinlock_t*) lock); 11 | } 12 | 13 | static inline void read_unlock(rwlock_t *lock) 14 | { 15 | spin_unlock((spinlock_t*) lock); 16 | } 17 | 18 | static inline void write_unlock(rwlock_t *lock) 19 | { 20 | spin_unlock((spinlock_t*) lock); 21 | } 22 | 23 | static inline void write_lock_irq(rwlock_t *lock) 24 | { 25 | spin_lock((spinlock_t*) lock); 26 | } 27 | 28 | #endif 29 | 30 | static inline void write_lock_bh(rwlock_t *lock, KIRQL flags) 31 | { 32 | spin_lock_irqsave((spinlock_t*) lock, flags); 33 | } 34 | 35 | static inline void write_unlock_bh(rwlock_t *lock, KIRQL flags) 36 | { 37 | spin_unlock_irqrestore((spinlock_t*) lock, flags); 38 | } 39 | 40 | #if 0 41 | 42 | static inline void write_unlock_irq(rwlock_t *lock) 43 | { 44 | spin_unlock((spinlock_t*) lock); 45 | } 46 | 47 | #endif 48 | 49 | static inline void rwlock_init(rwlock_t *lock) 50 | { 51 | spin_lock_init((spinlock_t*) lock); 52 | } 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /windrbd/include/linux/rwlock_types.h: -------------------------------------------------------------------------------- 1 | #ifndef __LINUX_RWLOCK_TYPES_H 2 | #define __LINUX_RWLOCK_TYPES_H 3 | 4 | #include 5 | 6 | typedef spinlock_t rwlock_t; 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /windrbd/include/linux/scatterlist.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/windrbd/include/linux/scatterlist.h -------------------------------------------------------------------------------- /windrbd/include/linux/sched.h: -------------------------------------------------------------------------------- 1 | #ifndef __SCHED_H__ 2 | #define __SCHED_H__ 3 | 4 | #include 5 | #include "drbd_windows.h" 6 | 7 | static __inline bool need_resched(void) 8 | { 9 | return false; 10 | } 11 | 12 | struct sched_param { 13 | int sched_priority; 14 | }; 15 | 16 | #define SCHED_RR 42 17 | 18 | static inline int sched_setscheduler(struct task_struct *p, int policy, 19 | const struct sched_param *param) 20 | { 21 | /* TODO: at least test for SCHED_RR here ... */ 22 | (void)policy; 23 | (void)param; 24 | 25 | KeSetPriorityThread(p->windows_thread, LOW_REALTIME_PRIORITY); 26 | return 0; 27 | } 28 | 29 | static inline int sched_set_fifo_low(struct task_struct *p) 30 | { 31 | KeSetPriorityThread(p->windows_thread, LOW_REALTIME_PRIORITY); 32 | 33 | return 0; 34 | } 35 | 36 | 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /windrbd/include/linux/sched/signal.h: -------------------------------------------------------------------------------- 1 | #ifndef _SIGNAL_H 2 | #define _SIGNAL_H 3 | 4 | struct task_struct; 5 | 6 | extern int signal_pending(struct task_struct *p); 7 | extern void force_sig(int sig, struct task_struct *p); 8 | extern void send_sig(int sig, struct task_struct *p, int priv); 9 | extern void flush_signals(struct task_struct *p); 10 | 11 | static inline void allow_kernel_signal(int sig) 12 | { 13 | /* 14 | * Kernel threads handle their own signals. Let the signal code 15 | * know signals sent by the kernel will be handled, so that they 16 | * don't get silently dropped. 17 | */ 18 | /* No action in WinDRBD */ 19 | } 20 | 21 | #endif 22 | 23 | -------------------------------------------------------------------------------- /windrbd/include/linux/security.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/windrbd/include/linux/security.h -------------------------------------------------------------------------------- /windrbd/include/linux/seq_file.h: -------------------------------------------------------------------------------- 1 | #ifndef __SEQ_FILE_H__ 2 | #define __SEQ_FILE_H__ 3 | #include "drbd_windows.h" 4 | struct seq_file 5 | { 6 | char buf[MAX_PROC_BUF]; 7 | void * private; 8 | }; 9 | 10 | 11 | extern int seq_file_idx; 12 | 13 | extern int seq_printf(struct seq_file *m, const char *f, ...); 14 | 15 | extern int seq_putc(struct seq_file *m, char c); 16 | extern int seq_puts(struct seq_file *m, const char *s); 17 | 18 | #endif -------------------------------------------------------------------------------- /windrbd/include/linux/slab.h: -------------------------------------------------------------------------------- 1 | #ifndef SLAB_H 2 | #define SLAB_H 3 | 4 | /* Enable all warnings throws lots of those warnings: */ 5 | #pragma warning(disable: 4061 4062 4255 4388 4668 4820 5032 4711 5045) 6 | 7 | #include 8 | #include "drbd_windows.h" 9 | 10 | struct kmem_cache { 11 | NPAGED_LOOKASIDE_LIST l; 12 | size_t element_size; 13 | }; 14 | 15 | typedef struct kmem_cache kmem_cache_t; 16 | 17 | struct kmem_cache *kmem_cache_create(const char *name, size_t size, size_t align, 18 | unsigned long flags, 19 | void (*ctor)(void *), ULONG tag); 20 | void kmem_cache_destroy(struct kmem_cache *cache); 21 | 22 | 23 | #ifndef KMEM_CACHE_DEBUG 24 | void *kmem_cache_alloc(void *cache, int flag); 25 | void kmem_cache_free(void *cache, void *obj); 26 | #endif 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /windrbd/include/linux/stat.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/windrbd/include/linux/stat.h -------------------------------------------------------------------------------- /windrbd/include/linux/stddef.h: -------------------------------------------------------------------------------- 1 | #ifndef __STDDEF_H 2 | #define __STDDEF_H 3 | 4 | /* 5 | enum { 6 | false = 0, 7 | true = 1 8 | }; 9 | */ 10 | #define offsetof(TYPE, MEMBER) ((size_t)&((TYPE *)0)->MEMBER) 11 | 12 | /** 13 | * offsetofend(TYPE, MEMBER) 14 | * 15 | * @TYPE: The type of the structure 16 | * @MEMBER: The member within the structure to get the end offset of 17 | */ 18 | #define offsetofend(TYPE, MEMBER) \ 19 | (offsetof(TYPE, MEMBER) + sizeof(((TYPE *)0)->MEMBER)) 20 | 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /windrbd/include/linux/string.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/windrbd/include/linux/string.h -------------------------------------------------------------------------------- /windrbd/include/linux/stringify.h: -------------------------------------------------------------------------------- 1 | #ifndef __LINUX_STRINGIFY_H 2 | #define __LINUX_STRINGIFY_H 3 | 4 | /* Indirect stringification. Doing two levels allows the parameter to be a 5 | * macro itself. For example, compile with -DFOO=bar, __stringify(FOO) 6 | * converts to "bar". 7 | */ 8 | 9 | #define __stringify_1(x) #x 10 | #define __stringify(x) __stringify_1(x) 11 | 12 | #endif /* !__LINUX_STRINGIFY_H */ 13 | 14 | -------------------------------------------------------------------------------- /windrbd/include/linux/swab.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/windrbd/include/linux/swab.h -------------------------------------------------------------------------------- /windrbd/include/linux/tcp.h: -------------------------------------------------------------------------------- 1 | #ifndef _UAPI_LINUX_TCP_H 2 | #define _UAPI_LINUX_TCP_H 3 | 4 | #include 5 | 6 | #define TCP_NODELAY 1 /* Turn off Nagle's algorithm. */ 7 | #define TCP_CORK 3 /* Never send partially complete segments */ 8 | #define TCP_QUICKACK 12 /* Block/reenable quick acks */ 9 | 10 | void tcp_sock_set_nodelay(struct sock *sk); 11 | void tcp_sock_set_cork(struct sock *sk, bool on); 12 | void tcp_sock_set_quickack(struct sock *sk, int val); 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /windrbd/include/linux/tcp_states.h: -------------------------------------------------------------------------------- 1 | #ifndef _LINUX_TCP_STATES_H 2 | #define _LINUX_TCP_STATES_H 3 | 4 | enum { 5 | TCP_NO_CONNECTION = 0, 6 | TCP_ESTABLISHED = 1, 7 | #if 0 8 | TCP_SYN_SENT, 9 | TCP_SYN_RECV, 10 | TCP_FIN_WAIT1, 11 | TCP_FIN_WAIT2, 12 | TCP_TIME_WAIT, 13 | TCP_CLOSE, 14 | TCP_CLOSE_WAIT, 15 | TCP_LAST_ACK, 16 | TCP_LISTEN, 17 | TCP_CLOSING, /* Now a valid state */ 18 | TCP_NEW_SYN_RECV, 19 | 20 | TCP_MAX_STATES /* Leave at the end! */ 21 | #endif 22 | }; 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /windrbd/include/linux/time64.h: -------------------------------------------------------------------------------- 1 | #ifndef __TIME64_H__ 2 | #define __TIME64_H__ 3 | 4 | /* Parameters used to convert the timespec values: */ 5 | #define MSEC_PER_SEC 1000L 6 | #define USEC_PER_MSEC 1000L 7 | #define NSEC_PER_USEC 1000L 8 | #define NSEC_PER_MSEC 1000000L 9 | #define USEC_PER_SEC 1000000L 10 | #define NSEC_PER_SEC 1000000000L 11 | #define FSEC_PER_SEC 1000000000000000LL 12 | 13 | /* Located here for timespec[64]_valid_strict */ 14 | #define TIME64_MAX ((s64)~((u64)1 << 63)) 15 | #define KTIME_MAX ((s64)~((u64)1 << 63)) 16 | #define KTIME_SEC_MAX (KTIME_MAX / NSEC_PER_SEC) 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /windrbd/include/linux/timer.h: -------------------------------------------------------------------------------- 1 | #ifndef TIMER_H 2 | #define TIMER_H 3 | 4 | #define from_timer(var, callback_timer, timer_fieldname, type) \ 5 | container_of(callback_timer, type, timer_fieldname) 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /windrbd/include/linux/uaccess.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/windrbd/include/linux/uaccess.h -------------------------------------------------------------------------------- /windrbd/include/linux/uio.h: -------------------------------------------------------------------------------- 1 | #ifndef __LINUX_UIO_H 2 | #define __LINUX_UIO_H 3 | 4 | struct kvec { 5 | void *iov_base; /* and that should *never* hold a userland pointer */ 6 | size_t iov_len; 7 | }; 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /windrbd/include/linux/unistd.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/windrbd/include/linux/unistd.h -------------------------------------------------------------------------------- /windrbd/include/linux/vermagic.h: -------------------------------------------------------------------------------- 1 | /* We are not RedHat */ 2 | 3 | #undef RHEL_RELEASE_CODE 4 | -------------------------------------------------------------------------------- /windrbd/include/linux/version.h: -------------------------------------------------------------------------------- 1 | #ifndef KERNEL_VERSION 2 | #define KERNEL_VERSION(_x, _y, _z) 0 3 | #define LINUX_VERSION_CODE 0 4 | #endif 5 | 6 | -------------------------------------------------------------------------------- /windrbd/include/linux/vmalloc.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/windrbd/include/linux/vmalloc.h -------------------------------------------------------------------------------- /windrbd/include/linux/workqueue.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/windrbd/include/linux/workqueue.h -------------------------------------------------------------------------------- /windrbd/include/net/genetlink.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/windrbd/include/net/genetlink.h -------------------------------------------------------------------------------- /windrbd/include/net/ipv6.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/windrbd/include/net/ipv6.h -------------------------------------------------------------------------------- /windrbd/include/net/netlink.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/windrbd/include/net/netlink.h -------------------------------------------------------------------------------- /windrbd/include/net/sock.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/windrbd/include/net/sock.h -------------------------------------------------------------------------------- /windrbd/include/partition_table_template.h: -------------------------------------------------------------------------------- 1 | // This file was generated by bintoc utility 2 | // Binary data from file "partition-table-ok" 3 | 4 | #include 5 | 6 | extern uint8_t partition_table_template[1536]; 7 | extern int partition_table_template_size; -------------------------------------------------------------------------------- /windrbd/include/stdint.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/windrbd/include/stdint.h -------------------------------------------------------------------------------- /windrbd/include/tiktok.h: -------------------------------------------------------------------------------- 1 | #ifndef _TIKTOK_H 2 | #define _TIKTOK_H 3 | 4 | #define TIKTOK 5 | 6 | #ifdef RELEASE 7 | #ifdef TIKTOK 8 | #undef TIKTOK 9 | #endif 10 | #endif 11 | 12 | #ifndef TIKTOK 13 | 14 | #define tik(n, s) do { } while (0); 15 | #define tok(n) do { } while (0); 16 | 17 | #else 18 | 19 | void tik_debug(int n, const char *desc, const char *file, int line, const char *func); 20 | void tok_debug(int n, const char *file, int line, const char *func); 21 | 22 | #define tik(n, s) do { tik_debug((n), (s), __FILE__, __LINE__, __func__); } while (0); 23 | #define tok(n) do { tok_debug((n), __FILE__, __LINE__, __func__); } while (0); 24 | 25 | #endif 26 | #endif 27 | -------------------------------------------------------------------------------- /windrbd/include/uapi/linux/sched/types.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LINBIT/windrbd/6dac59aa307848fe628bd232e92024717ea46a34/windrbd/include/uapi/linux/sched/types.h -------------------------------------------------------------------------------- /windrbd/include/windrbd_device.h: -------------------------------------------------------------------------------- 1 | /* Enable all warnings throws lots of those warnings: */ 2 | #pragma warning(disable: 4061 4062 4255 4388 4668 4820 5032 4711 5045) 3 | 4 | #include 5 | #include 6 | 7 | void windrbd_set_major_functions(struct _DRIVER_OBJECT *obj); 8 | -------------------------------------------------------------------------------- /windrbd/src/seq_file.c: -------------------------------------------------------------------------------- 1 | #include "linux/seq_file.h" 2 | 3 | int seq_putc(struct seq_file *m, char c) 4 | { 5 | return 0; 6 | } 7 | 8 | int seq_puts(struct seq_file *m, const char *s) 9 | { 10 | return 0; 11 | } 12 | 13 | 14 | int seq_printf(struct seq_file *m, const char *f, ...) 15 | { 16 | int ret; 17 | va_list args; 18 | 19 | /* TODO: buffer overflow */ 20 | va_start(args, f); 21 | ret = vsprintf(m->buf + seq_file_idx, f, args); 22 | va_end(args); 23 | seq_file_idx += ret; 24 | ASSERT(seq_file_idx < MAX_PROC_BUF); 25 | return ret; 26 | } 27 | -------------------------------------------------------------------------------- /windrbd/src/slab.c: -------------------------------------------------------------------------------- 1 | /* Enable all warnings throws lots of those warnings: */ 2 | #pragma warning(disable: 4061 4062 4255 4388 4668 4820 5032 4711 5045) 3 | 4 | #include 5 | #include "drbd_windows.h" 6 | 7 | struct kmem_cache *kmem_cache_create(const char *name, size_t size, size_t align, 8 | unsigned long flags, 9 | void (*ctor)(void *), ULONG tag) 10 | { 11 | struct kmem_cache *cache; 12 | 13 | cache = kmalloc(sizeof(*cache), GFP_KERNEL, tag); 14 | if (!cache) 15 | return NULL; 16 | ExInitializeNPagedLookasideList(&cache->l, NULL, NULL, 0, size, tag, 0); 17 | cache->element_size = size; 18 | 19 | return cache; 20 | } 21 | 22 | void kmem_cache_destroy(struct kmem_cache *cache) 23 | { 24 | ExDeleteNPagedLookasideList(&cache->l); 25 | kfree(cache); 26 | } 27 | 28 | #ifndef KMEM_CACHE_DEBUG 29 | 30 | void *kmem_cache_alloc(struct kmem_cache * cache, int flag) 31 | { 32 | void *p = ExAllocateFromNPagedLookasideList(&cache->l); 33 | if (p != NULL) 34 | RtlZeroMemory(p, cache->element_size); 35 | 36 | return p; 37 | } 38 | 39 | void kmem_cache_free(struct kmem_cache * cache, void *obj) 40 | { 41 | ExFreeToNPagedLookasideList(&cache->l, obj); 42 | } 43 | 44 | #endif 45 | --------------------------------------------------------------------------------