• src/sbbs3/nopen.c nopen.h

    From Rob Swindell (on Windows@VERT to Git commit to main/sbbs/m on Fri Jul 24 23:17:00 2026
    https://gitlab.synchro.net/main/sbbs/-/commit/254b876244369ee10695c7d3
    Modified Files:
    src/sbbs3/nopen.c nopen.h
    Log Message:
    backup: copy via a shared (DENYNONE) open rather than CopyFile()

    backup() with ren=false copied through the Win32 CopyFile() API, which
    opens its source GENERIC_READ / FILE_SHARE_READ. That is a deny-write
    share mode: for the duration of the copy no other opener -- on this host
    or, over SMB/CIFS, on any other host sharing the data directory -- can
    open that file for writing.

    Where a data/ directory is shared by several Synchronet hosts, that means
    every daily_maint() user-data backup blocks user-record writes system
    wide until the copy completes: putuserdat() gives up after nopen()'s
    ~10-second retry budget and returns USER_OPEN_ERROR (-102), and the
    record write is discarded rather than queued. A copy that never finishes wedges user-record writes indefinitely, with a log flood as the only
    visible symptom.

    Add fcopy(), opening both source and destination O_DENYNONE via nopen(),
    and call it from backup(). On Windows this restores the behavior that 2b892eae1f (peer-11-drive) replaced: that commit swapped fcopy() for
    CopyFile() to gain throughput (1GB to/from CIFS/SMB: 37s -> 5s), which is
    a real cost, but for a shared data directory a fast backup that locks out writers is the worse trade.

    Also move nopen.h's include guard off the reserved _NOPEN_H form.

    Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Rob Swindell (on Debian L@VERT to Git commit to main/sbbs/m on Mon Jul 27 00:02:00 2026
    https://gitlab.synchro.net/main/sbbs/-/commit/faf0950ba4089e13b3e610af
    Modified Files:
    src/sbbs3/nopen.c nopen.h
    Log Message:
    Rename fcopy() to nfcopy()

    The name said nothing about what distinguishes it from xpdev's
    CopyFile(), which the JavaScript file_copy() and most of the tree use.
    This one opens both files DENYNONE through nopen(), so a copy never
    blocks another node from writing to either file, and it retries a locked
    open rather than failing. The n prefix is how the rest of this file
    spells that already: nopen(), fnopen().

    The distinction is worth making obvious now that both routines preserve
    the source file's permissions (GitLab #1202) and that difference no
    longer tells them apart.

    nfcopy() is exported from libsbbs, so any out-of-tree caller has to
    follow; no compatibility alias is left behind. In-tree there is one
    caller, backup().

    Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Rob Swindell (on Debian L@VERT to Git commit to main/sbbs/m on Mon Oct 26 17:38:00 2026
    https://gitlab.synchro.net/main/sbbs/-/commit/9021d114d289bcf7e191e525
    Modified Files:
    src/sbbs3/nopen.c nopen.h qwkjob.cpp
    Log Message:
    fmutex_close(): retry an unlink another host blocks; read QWK lock text shared

    When two hosts' event threads act on the same QWK pack semaphore (both glob data/pack*.now), the one that finds the user's lock busy opens the lock file briefly: to stat it, to try creating it, and to read the holder's text for
    the log. On Windows those opens don't permit deletion, so the holder's unlink over SMB/CIFS fails with EBUSY if it lands inside one. This happened on 2026-10-26 between VERT and a Linux host: the Linux host's older build (from before 251c99b699 (camera-37-lies, 2026-10-25)) returned from fmutex_close() without closing the lock file, and that user's QWK packets
    stayed blocked on every host until the process was restarted.

    The current fmutex_close() already closes the descriptor when the unlink
    fails, but leaves a lock file nobody holds, so the user waits for it to age
    out (an hour for a QWK user lock).

    - fmutex_close() now retries an unlink that fails with EBUSY, up to
    FMUTEX_UNLINK_RETRIES (10) times, LOCK_RETRY_DELAY (100 ms) apart, and
    treats the file vanishing meanwhile as removed.
    - qwkjob_lock_busy() on Windows reads the holder's text through a handle
    that permits FILE_SHARE_DELETE (the read added by 4365e08932
    (fuel-0-know, 2026-10-25)), so reading the text no longer blocks the
    holder's removal. Its stat and create attempts still can, which the retry
    covers.

    Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net