From nobody Mon Apr 10 19:27:51 2023 X-Original-To: dev-commits-src-main@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 4PwJsb3W8yz44htg; Mon, 10 Apr 2023 19:28:03 +0000 (UTC) (envelope-from rick.macklem@gmail.com) Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) (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 "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PwJsb1wP3z4RPZ; Mon, 10 Apr 2023 19:28:03 +0000 (UTC) (envelope-from rick.macklem@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-pj1-x102f.google.com with SMTP id 98e67ed59e1d1-24677168b7bso193633a91.0; Mon, 10 Apr 2023 12:28:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1681154882; x=1683746882; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=sGbN99AtrQr7bnu7t5bP4zY0q/2JcBgIBxIjy0ksMfE=; b=L51uNxoNZVltQQFxesobCJ4ybTxBuCi2SiGww4yldQfYk10iYZIoCXxXbvzrYWsS9I NcWgMCAufs8kve1wfBmEcQJM7dnhCHujkY9qCqOc3yiy1F/N/7zrYgtoAlAvNqKSPvQw TcJppCf5ZIW/hndGHbv7jUutwqKAV4W1JEwkAN9ZsUF2VIKG12eFKWboxV3+sxyGrhpQ ZdSSllJUVi/+moT9H+23eUeNtw/d5IZIPZnHm2o5oYVzN0gBKExCFD2j+EJKJ5Yltw3S ReXpSfn/mR7SIQUxe8XF/fa7uQ74Ik2wK+CdE1MzUjHHx2ob9EVUwLye7ysmgz9sKu7o 6bxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681154882; x=1683746882; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sGbN99AtrQr7bnu7t5bP4zY0q/2JcBgIBxIjy0ksMfE=; b=VMdDRItjZvIfW61OhpWZxLDFGSTFd/C7I95uovgIQFsbUQxSvFL1yzBoTiKbhQQnv6 DA3ZyBArwvj9ONVUouSi+sieDVhr5hYnEyAPbsB8vc5+1RN3Vog/uQ/EJWtCG8hfOXmf TLcq/lei+8ELyTukS2Ymppw17NOARdk9915OUXLcb8IlpRBD6BciFWixHiZNYEVPd2Ro 5fCaJooa3hwZ8KfvDYI1UA6oQ4//XloHBG/uEYZMB6XuugSxISxLiVjklkzWtrmvE0Ii z7bdCNn/wuBm4NCKZiOZicQM9VPFPLSULrylGR/aBhksUbGfk0ObH1pvxcvxzqA0Liwt n0oA== X-Gm-Message-State: AAQBX9fevHtR7PvDvemT7/PTnkbHPLRYNXI+M7b3tYcbnJeU8ztlBGCY sQRTsIgWyQWRgBMIkilX/Zzgsze/eMtQr0k/+iMq4TdnFQ== X-Google-Smtp-Source: AKy350bhW5pjUXvBltBKZ+GLfpZ0a62pKa9un1avzFouu+WqRqUAH7pnayzUDj8cIIrkCvQQRHZMn/PMZwf5md/LcsI= X-Received: by 2002:a05:6a00:2e1b:b0:62a:56ce:f90b with SMTP id fc27-20020a056a002e1b00b0062a56cef90bmr5734556pfb.2.1681154881914; Mon, 10 Apr 2023 12:28:01 -0700 (PDT) List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 References: <202101030102.10312IAC061762@gitrepo.freebsd.org> In-Reply-To: From: Rick Macklem Date: Mon, 10 Apr 2023 12:27:51 -0700 Message-ID: Subject: Re: git: c98a764c681f - main - cp(1): fix performance issue for large non-sparse file copies To: Alexey Dokuchaev Cc: Rick Macklem , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 4PwJsb1wP3z4RPZ X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; TAGGED_FROM(0.00)[] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-ThisMailContainsUnwantedMimeParts: N On Mon, Apr 10, 2023 at 11:31=E2=80=AFAM Alexey Dokuchaev wrote: > > On Mon, Apr 10, 2023 at 08:31:28AM -0700, Rick Macklem wrote: > > On Mon, Apr 10, 2023 at 12:54???AM Alexey Dokuchaev wrote: > > > On Sun, Jan 03, 2021 at 01:02:18AM +0000, Rick Macklem wrote: > > > > commit c98a764c681f8b70812a9f13a6e61c96aa1a69d2 > > > > > > > > cp(1): fix performance issue for large non-sparse file copies > > > > > > > > @@ -236,7 +235,7 @@ copy_file(const FTSENT *entp, int dne) > > > > do { > > > > if (use_copy_file_range) { > > > > rcount =3D copy_file_range(from_fd, NULL, > > > > - to_fd, NULL, bufsize, 0); > > > > + to_fd, NULL, SSIZE_MAX, 0); > > > > > > Hi Rick, > > > > > > This change unfortunately breaks copying files in resource-limited > > > environments (e.g. many port builders do that to prevent runaway > > > processes): > > > > > > ulimit -f 16384000 > > > cp -p packages/13.0-i386-wip/All/perl5-5.32.1_3.tbz /tmp ; echo $? > > > Filesize limit exceeded > > > 153 > > > > I think zfs_copy_file_range() needs to use vn_rlimit_fsizex() the > > same way that vn_generic_copy_file_range() does. > > > > I have posted the attached patch to D39419. > > > > danfe@. Assuming you were using zfs, could you test this patch? > > (You will need an up to date main kernel and, hopefully, the block > > cloning stuff has not trashed your zpool.) > > We had already discussed with with Rick privately, but for the archives, > looks like my problem had been solved somewhere between 13.1 and 13.2, > and it's not related to ZFS. > > sh -c 'cd /tmp ; truncate -s 20m foo ; limits -f 8386560000 cp foo bar ; > stat -f %z bar' > > =3D=3D> 13.1: > Filesize limit exceeded > 0 Yes. If you think this should be done as an Errata for 13.1, please email asomers@, who committed the fix to main and stable/13 after the 13.1 release. > > =3D=3D> 13.2: > 20971520 > > Allegedly this is due to commit 52360ca, but I'd have to look closer into > it to be sure. Sorry for distracting you guys from that recent ZoL merge > fallout, I should've not be lazy and reported it earlier. :( > I do believe the recent ZoL merge introduced the same bug to ZFS. I have posted a proposed patch to D39419. (Basically call vn_rlimit_fsizex() and not vn_rlimit_fsize().) rick > ./danfe