From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C894C391E55 for ; Thu, 23 Jul 2026 10:33:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784802826; cv=none; b=CUa4vU4K0YuO+nEyHhU9z9jVuSznewBzAC2AaZXXPbHsEC/MTT6Ie1LMn659VM3ieypPVxHIFEybmOeyziXTU5e19v2xeShiGaU2KV3A2zB+xSqchOWmt8VgMgnk0SXVZ1fans29aCKERNIXNcbt5mbaQIepaJMxx5qT89AJFM0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784802826; c=relaxed/simple; bh=yCTiSDuszLX3fF1ioRsl7JX0/AVvin+1ppL+rG0sr48=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=t/m4xrkbbRDIafUunIsxeGOzyRs6KbO39ndBgZbl0v51zZa/srOEr+CApRJRQAdY7NidnghuM0kW/MMS7Ad1CKMTsudQlt+JwAtuLWaX67/pmWXBN0ulAJIVmJUH1pxBj0JMAyG9r6kWCsUE70QFa3HvqCN8APYKKM1p4LeMM5M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=Us36xcyJ; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=BWK68OhK; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Us36xcyJ"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="BWK68OhK" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1784802823; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5WI5zEkKRJ1Ip2LJyTTDzt9st5AsT9mj7pwmV5si8WA=; b=Us36xcyJvYsr9J9wrC3F3xHpmL1KnFQ69DqnBHrcqusB9V8NPuYurr6sBzgRseiIJFaCYZ OjWtMPj2aZU7XY/RjPBMwz9xYWHtwb0l+j74TN13J+DdWW1dJ+HK8OrLSDOQgri88JX1qp Ho/lTuZVk4ORYFt4mEY7vkh3GDpZn7E= Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-37-sEoske5BOZaVd0BSnqDCtQ-1; Thu, 23 Jul 2026 06:33:42 -0400 X-MC-Unique: sEoske5BOZaVd0BSnqDCtQ-1 X-Mimecast-MFC-AGG-ID: sEoske5BOZaVd0BSnqDCtQ_1784802821 Received: by mail-ed1-f71.google.com with SMTP id 4fb4d7f45d1cf-698a99b6140so652744a12.1 for ; Thu, 23 Jul 2026 03:33:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1784802821; x=1785407621; darn=vger.kernel.org; h=mime-version:user-agent:content-transfer-encoding:content-type :references:in-reply-to:date:cc:to:from:subject:message-id:from:to :cc:subject:date:message-id:reply-to:content-type; bh=5WI5zEkKRJ1Ip2LJyTTDzt9st5AsT9mj7pwmV5si8WA=; b=BWK68OhKcTkHWMxx6tOQtshAltBZfRi5quYjJz/f7h3OmNYyGOecjnomThXNowYgcE eWhrxdWFfgj9DeoIgzZO+epwmvFdr/51ZrGT7d8j8JlZvS83AgDS0YXrOEaJNLyH49Nf wzCgcmXA/r2+Ln2gp+tWO4X8F/wrn+CAs7TEePOAhbuGMVz4Vzi88ovzEh/UnUzmUSSD DCCDdeHRb0draNi4o3R3yb1Hfo5kBMu5y6lx7MF86XJiC5v5Svd2Rngk9ZqvQ9dyZYY2 Y6rpRsuBpPXW7PUnQACO7VNEuKfs/bJE8Yd5ILhe09/N1ZMs712mwlF12nW5hDUqYK8N frLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784802821; x=1785407621; h=mime-version:user-agent:content-transfer-encoding:content-type :references:in-reply-to:date:cc:to:from:subject:message-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=5WI5zEkKRJ1Ip2LJyTTDzt9st5AsT9mj7pwmV5si8WA=; b=Vz3GFEHZpZBleg+q7G/r1QTzsVvb62QA4JAsKj7R+qogKYTdZSnYjZsS7Ki3Zpxial E74vX6n3LHZ+Fzd7MeIkQN5VHjosPb1BEQ/KvEdnEEosTCCS06347wCJRYy1rm5slKcQ y1iIBBYUce2JbXnEEssJh0YIkIuAndt4ZlAm6OkRO+l7a+GpFSVSJpz69TVdeYdvMjI8 1aycVJ1oyW5sAXv+a/b5dXo7CkeFT/BSfkXWn0SERl1c7f7zktbKb1sjSmAgDlhmkg1/ tMqS/qBog4rxnoT2q1L1HB0VeY6jcwBkT0Pv+3cTKeJl/XVbjzgGIVb8hOT7xDilBCvJ Xucw== X-Forwarded-Encrypted: i=1; AHgh+RpMQ32e766X9z4tUhuSkYr1pQsqNRx9gXGf5eTKQrQTJCgSbdUgamoMJMMdXVR3wKeZLodEEMQJkDwL3xE=@vger.kernel.org X-Gm-Message-State: AOJu0YwLTQ5z2BSDEDompqzFwdRI8xzyWhSuM57eB7A2R1+xpXfqY1+S kz6T7FjRVCN6sW/CXcG/BR2D9RN5jwnOsR1EJTWK0qjG/nnS9EMYDfbZVIXVIT7Szo0FY7Re50R CpYsHLQmnhYmVHgmy/hkg64HS6b9h+63JthuAm0VQpF4cYy/wgMdmVacmhKBW2Q45tg== X-Gm-Gg: AR+sD13SKabQD44vYrTa2IkwIQFwvMZsqEqzRgety5EU5BWTbj2vEQRguk6yW8zygsR 0XeHcuOXcZ52Abjhibflwl/fLToNHDMOLwmYwfFOs3/TN7ohOjrU2JYKR26hurNrorXSIwhz+HY uXT9IjEbxziAfw1a899a0wpdYRCBA4CL2bIzUJp2c9MZzTq/yMUGxZmR/XfrpoTsCqDpwcxB6lb x52rdsCu0+bOxfx6vHY1rAXfAyDZeCYzKF+HI0XWzDt5QaJXanG5PYhPkFFewby6uYYcr7Gbd0e A2MGS6lNL3p7GtitrZ1yZDn8lR4aPMeWSP711EaIdakvH3MNbT9DnWgc9ZaNSapZ/h7AHPK73kI Z/7gIvbLZ1P/MDmhYxdGtk74zYNm7nS4y9ANInA0I/ek= X-Received: by 2002:a05:6402:4391:b0:698:c11b:b180 with SMTP id 4fb4d7f45d1cf-69f6ccd4294mr903530a12.3.1784802821189; Thu, 23 Jul 2026 03:33:41 -0700 (PDT) X-Received: by 2002:a05:6402:4391:b0:698:c11b:b180 with SMTP id 4fb4d7f45d1cf-69f6ccd4294mr903519a12.3.1784802820693; Thu, 23 Jul 2026 03:33:40 -0700 (PDT) Received: from li-88bb8a88-b016-11ec-80f1-6c24081bc674.ibm.com ([2a10:3781:5edd:0:9f93:40c:17a4:1c7c]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-69f345b1a17sm2028009a12.5.2026.07.23.03.33.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jul 2026 03:33:39 -0700 (PDT) Message-ID: Subject: Re: [PATCH] fuse: skip destination updates for zero-byte copy From: Niels de Vos To: Yichong Chen , Miklos Szeredi Cc: fuse-devel@lists.linux.dev, linux-kernel@vger.kernel.org Date: Thu, 23 Jul 2026 12:33:38 +0200 In-Reply-To: <20260723100743.93881-1-chenyichong@uniontech.com> References: <20260723100743.93881-1-chenyichong@uniontech.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.60.2 (3.60.2-1.fc44) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 On Thu, 2026-07-23 at 18:07 +0800, Yichong Chen wrote: > __fuse_copy_file_range() may receive a successful copy reply with > zero > bytes copied.=C2=A0 This can happen even though the VFS only calls the > file > operation with a non-zero length, for example if the FUSE daemon > reaches > EOF while the kernel has stale source size information. >=20 > In that case no data was written to the destination.=C2=A0 Do not > invalidate > the destination page cache or update the destination timestamps and > cached > size state for a zero-byte copy result. >=20 > Fixes: 88bc7d5097a1 ("fuse: add support for copy_file_range()") > Signed-off-by: Yichong Chen > --- > =C2=A0fs/fuse/file.c | 4 ++++ > =C2=A01 file changed, 4 insertions(+) >=20 > diff --git a/fs/fuse/file.c b/fs/fuse/file.c > index ceada75310b8..75eb97b26912 100644 > --- a/fs/fuse/file.c > +++ b/fs/fuse/file.c > @@ -3040,6 +3040,10 @@ static ssize_t __fuse_copy_file_range(struct > file *file_in, loff_t pos_in, > =C2=A0 err =3D -EIO; > =C2=A0 goto out; > =C2=A0 } > + if (!bytes_copied) { > + err =3D 0; > + goto out; > + } > =C2=A0 > =C2=A0 truncate_inode_pages_range(inode_out->i_mapping, > =C2=A0 =C2=A0=C2=A0 ALIGN_DOWN(pos_out, PAGE_SIZE), Thanks, this looks good to me. My style preference would be to make it an "else if" because bytes_copied i= s used in the if-statement above already too. I don't think it is required to adjust this, the functioning will remain the same. Acked-by: Niels de Vos