From nobody Sat Nov 08 23:22:37 2025 X-Original-To: freebsd-current@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4d3sRN0RH1z6FmSZ for ; Sat, 08 Nov 2025 23:22:56 +0000 (UTC) (envelope-from rick.macklem@gmail.com) Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "WR4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4d3sRM10HTz3L9c for ; Sat, 08 Nov 2025 23:22:55 +0000 (UTC) (envelope-from rick.macklem@gmail.com) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20230601 header.b=jdsOo90K; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of rick.macklem@gmail.com designates 2a00:1450:4864:20::535 as permitted sender) smtp.mailfrom=rick.macklem@gmail.com Received: by mail-ed1-x535.google.com with SMTP id 4fb4d7f45d1cf-64175dfc338so533205a12.0 for ; Sat, 08 Nov 2025 15:22:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1762644168; x=1763248968; darn=freebsd.org; h=cc:to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=y8vlKynq7KqS4qytpyjCKyh4Hd3Hj8AImPVP7dv7Dg8=; b=jdsOo90K0rqYeaMDaXFA2kYP8331UxKecbXBUhXnjclv2PYInyHQ6BmET2XaK6OXtY 5fqi3E7NN0AO2tidfb6LM9Xwni1/v9sJfCKvP465nFkPYNchVFGLyUk9r9K+mOjFLXja OAAXEaOr1Jj7VTyTT09CO9V4bCsc0ze+e6TAquBS6XLwRx2eaG3I9vzVMFYtPJgK8new frg3ZgmccPW3XA74FqyH0dsuh6mZcRPXgKSPAj2FfQ8Ujpou0HNyXxVLIqu3PN3KpfwF vcbYJXOUYaFwjBrOGTUNyAs0EOhJYL18W4r+k2VNvBf4+BXfqGFeeMmUtIgRq1xhufKR KaoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762644168; x=1763248968; h=cc:to:subject:message-id:date:from:mime-version:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=y8vlKynq7KqS4qytpyjCKyh4Hd3Hj8AImPVP7dv7Dg8=; b=qS19mXBZywx+hSA+9DJrCzDGwwKNzdNhVbe7I0kG9UWNSkLAsYXJztKrH6E7T5SyrL sDeJVBjZVgHKl6+jmQtJV0yigVaAPwZd4Yeu7iRKSbfmKQooTW/AzJpQbXFdIIPSB/hF 0Z1pEL63npEshAb6DQbZq/S+P6afGeP0an76ZRb8/HcxjbqP5w7/Teh7G4u8ghso1j7q AYnw3tpWwiKMiz03GT2h8tNUfsAVHZ7oQGcn7k4YlAtT9Cy07XTMIOeJqBjlYM6WwBE0 1pFAAyjS4u9mglZaNVyjgQl44hDdvSo0Zd+UVxQSjEd/HUThVpLUHx62fsTVLAsp0+vH GCzw== X-Gm-Message-State: AOJu0YzUes4o8IotZwPJ5T7cHt5yq5stRKnP14ke4kdctbpc6S2hBypC UNG2Xs7MY4BvCVLcQ+mPk2JkMIatR8NBuU1UkbPAJGvduHjaQOtQHnl/Jwo5deYInCzpUwM+ely bGs7CPLoBBTTilhV1i9NRtCbZlx07AJXW8Sc= X-Gm-Gg: ASbGncvPnfvj4DncbbtycHkefzmrhNDpuRnBhKrG6ltQdXa/HhT2rKBcdkryNORQjFJ TXA7gAF1wTI46WTpB2ZB0EP5WWMhstMy/gJtgAKcyMnER9seDNR3+GjdpmhB7gEHl1njWnTGxFX mXNQ+StJDxBj5xVKPU9SPZqiHncGLeFKNbGC0XSVnednU3DtKfBvQQTKJk/f6dVK0isKZOTWm6K KRRKJjbyI5lnuB2vy3jLBH4JTPW9SaSZaDNYP7dy4/qaRDrpaan03MSiqtzHu66Lr1iXlqst8Vd mA8n73RWwxi5+Rzx0rpuy8LG5SDNBk29+c0b0w== X-Google-Smtp-Source: AGHT+IG0GrLukYKTwQM9lRw8asLySNnQqe1/6fKT58UeFdd/pUcJp5LuL6E1nOWtx6eVJmzUNiKfc/oMLsF2dJgI6sc= X-Received: by 2002:a05:6402:440a:b0:640:bb31:cbf4 with SMTP id 4fb4d7f45d1cf-6415dc0dcc6mr2723454a12.11.1762644168056; Sat, 08 Nov 2025 15:22:48 -0800 (PST) List-Id: Discussions about the use of FreeBSD-current List-Archive: https://lists.freebsd.org/archives/freebsd-current List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-current@FreeBSD.org MIME-Version: 1.0 From: Rick Macklem Date: Sat, 8 Nov 2025 15:22:37 -0800 X-Gm-Features: AWmQ_blBPWURBclXdCMfBjHw5J3da57O_CDvJjDcg1uL9Duncm8tiYTGxtWu9Fs Message-ID: Subject: RFC: Should copy_file_range(2) return after a few seconds? To: FreeBSD CURRENT Cc: "Peter 'PMc' Much" Content-Type: text/plain; charset="UTF-8" X-Spamd-Bar: -- X-Spamd-Result: default: False [-3.00 / 15.00]; SUBJECT_ENDS_QUESTION(1.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-1.000]; NEURAL_HAM_LONG(-1.00)[-1.000]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20230601]; MIME_GOOD(-0.10)[text/plain]; RCPT_COUNT_TWO(0.00)[2]; RCVD_TLS_LAST(0.00)[]; TO_DN_ALL(0.00)[]; TAGGED_FROM(0.00)[]; FREEMAIL_FROM(0.00)[gmail.com]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; MISSING_XM_UA(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[freebsd-current@freebsd.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; MLMMJ_DEST(0.00)[freebsd-current@freebsd.org]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; MID_RHS_MATCH_FROMTLD(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; RCVD_COUNT_ONE(0.00)[1]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::535:from] X-Rspamd-Queue-Id: 4d3sRM10HTz3L9c Hi, Peter Much reported a problem on the freebsd-fs@ mailing list on Oct. 21 under the Subject: "Why does rangelock_enqueue() hang for hours?". The problem was that he had a copy_file_range(2) copying between a large NFS file and a local file that was taking 2hrs. While this copy_file_range(2) was in progress, it was holding a rangelock for the entire output file, causing another process trying to read the output file to hang, waiting for the rangelock. Since copy_file_range(2) is not any standard (just trying to emulate the Linux one), there is no definitive answer w.r.t. should it hold rangelocks. However, that is how it is currently coded and I, personally, think it is appropriate to do so. Having a copy_file_range(2) syscall take two hours is definitely an unusual case, but it does seem that it is excessive? Peter tried a quick patch I gave him that limited the copy_file_range(2) to 1sec and it fixed the problem he was observing. Which brings me to the question... Should copy_file_range(2) be time limited? And, if the answer to this is "yes", how long do you think the time limit should be? (1sec, 2-5sec or ??) Note that the longer you allow copy_file_range(2) to continue, the more efficient it will be. Thanks in advance for any comments, rick