Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp43198rdb; Mon, 4 Dec 2023 19:46:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IHQeBGk2PRMZTx8IKeuhfGTu/EM1ajsHLVKUdSIimrSGoxJMo6ovpQEaH9zcrealZrBtFut X-Received: by 2002:a05:6a00:1a87:b0:6ce:2732:1e0a with SMTP id e7-20020a056a001a8700b006ce27321e0amr624990pfv.68.1701747987692; Mon, 04 Dec 2023 19:46:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701747987; cv=none; d=google.com; s=arc-20160816; b=umx3Kb4tRDHiKfg9JLw5lZyCrgWnpDN6APNLlyPH8xvtO9N0FKoN1HBcYNhC79QYcD d3RmloX0o+IwW04qcZs2QUuiDYr8aYEaHjjQh41FfugBmxOM2fykoJM6A+g6MPLFD8Lv PXBC6Fdm7vA0pwR2p1uON9B4+ZHLtu95jPo5WytqVYXoGFUaQFfm/x2HiSu8hjqJgMaA vtNptbDg8Up2NIFdb6pWNQ46jyBlE5p7AiyWqlJH079XxTv+x2cvQCJt5SdHG9IFQReO rGCU7Ofk5mwpLRgbkJMjH8yLf7xUKHHPXcocw2xEpqRhMR8uDYLH50U4kBQor+/o9dnC 6Rdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=Jg6rTNWBMwsjipN+E71IGBGvENV2ioiceBuyhFpWrbw=; fh=m20MDshkels+oIHnSVH7Va0Fufc79C8rdRPTA7Sbuss=; b=mnuyJ+8BIvh60TMqxDW7GUWcy4XJixqc/kxgfpcnX5U8zN4BNxhPOlji0QA267ELRo VsBYnhG2S/KJ0ElSuitbJaSfwvdZoqQAbO3fxhuX2zTWvH1JTznuQ6kbDyCs3moz7r3A DeDLNeO5v3t3r294q0NP3Ea51YjFxAL7rHgIMvxizvJpCCKl6Ovi/LXBnMzoZID41fOs OKJPRmPmwKNBP7A4fWE/UisoWt8QQDgXlXKA3AZTBZhuNz/wjExHfCH9sCfTuzEdqbut oZ4eMK8K2peEyAIsR1xj0JaA/K8Wb/1fgGNTB2aCCeqEo2kf6sSAjxwbJRMoBcA1f7xF CUjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=evvFv7qE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id l10-20020a65680a000000b005c1b316d768si3356760pgt.664.2023.12.04.19.46.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 19:46:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=evvFv7qE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 4125880A1466; Mon, 4 Dec 2023 19:46:21 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231477AbjLEDqG (ORCPT + 99 others); Mon, 4 Dec 2023 22:46:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230128AbjLEDqE (ORCPT ); Mon, 4 Dec 2023 22:46:04 -0500 Received: from mail-qv1-xf30.google.com (mail-qv1-xf30.google.com [IPv6:2607:f8b0:4864:20::f30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96431D5; Mon, 4 Dec 2023 19:46:10 -0800 (PST) Received: by mail-qv1-xf30.google.com with SMTP id 6a1803df08f44-67ac4fc7217so12931826d6.0; Mon, 04 Dec 2023 19:46:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701747969; x=1702352769; darn=vger.kernel.org; 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=Jg6rTNWBMwsjipN+E71IGBGvENV2ioiceBuyhFpWrbw=; b=evvFv7qEeXdLzBU59s6sjBCru4bt4w2p5lOoXr7LVwBzVjcyh/EpUZpXZrDCD+osvl Dt/c0rCn7er9MU99jcgybPFLBkh5F2NXXOK1ETn/Nfi80NP4712BkeNNnZwumwj5xreN I9XG8VU3OYc6NNhB88feDxAaVUFmypXZjw8bzd8emlrGWrHHnfhpWdszRnZiDQQ3AZP9 DUPyJcRa+Y+FeKow7YLlv/TlbbTiAWBaypYygQUBayPKg8i0cwa7m3X3rhDAvA/VWv+2 THfakoTnwkJus5KBzI0HATCbluij7rYzSInZdK8mZ3NEMmUBrMoAC3gpuScNHp7aBZS2 5WlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701747969; x=1702352769; 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=Jg6rTNWBMwsjipN+E71IGBGvENV2ioiceBuyhFpWrbw=; b=YIzzzTRb6HlgaGXtK/o7wj9JpuDUmDtjVfR9PAfXdMRDNOfP4SOdb4PKExfql5WMs4 H9MiX4pNZoSvHzaUCHTMbdtubUJ+7/ZxVYqCl3qE38aiXdbQ4Vilu8jcB8QTPjpFtmca fMsgKxzRjgLjUjcHzT2BjlhsPEeK0EvvrxR7RG98jfSW2IZap+/zyP4cABoCibK/ZDQ5 Il6NO3aBeQzBPaBX9XzUe0urRW4/71yJPQ7eJlZutnpBcBsHFXDZ1FuhKv00XnsxSrGs DHyEpcjU/ifrTijOKHSXFWNWAT13QGHL1bMq+48HTpipQireneDLG41Q/eEpik+7nT2/ 8Yxg== X-Gm-Message-State: AOJu0YwFd27ONooV73fOC7mIjRZ9mOyaL9sRqZG9QDfohWcXAb35ecdy Qd6mEidcDAq/Lq08eC1enUi6nzeLr3Rnk/T92nCoRTNFGvQ= X-Received: by 2002:a0c:f842:0:b0:67a:a89e:41a with SMTP id g2-20020a0cf842000000b0067aa89e041amr768215qvo.76.1701747969573; Mon, 04 Dec 2023 19:46:09 -0800 (PST) MIME-Version: 1.0 References: <20231130141624.3338942-4-amir73il@gmail.com> <20231205001620.4566-1-spasswolf@web.de> In-Reply-To: <20231205001620.4566-1-spasswolf@web.de> From: Amir Goldstein Date: Tue, 5 Dec 2023 05:45:57 +0200 Message-ID: Subject: Re: [PATCH] fs: read_write: make default in vfs_copy_file_range() reachable To: Bert Karwatzki , Christian Brauner Cc: Jan Kara , axboe@kernel.dk, dhowells@redhat.com, hch@lst.de, jlayton@kernel.org, josef@toxicpanda.com, linux-fsdevel@vger.kernel.org, miklos@szeredi.hu, viro@zeniv.linux.org.uk, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Mon, 04 Dec 2023 19:46:21 -0800 (PST) On Tue, Dec 5, 2023 at 2:16=E2=80=AFAM Bert Karwatzki wr= ote: > > If vfs_copy_file_range() is called with (flags & COPY_FILE_SPLICE =3D=3D = 0) > and both file_out->f_op->copy_file_range and file_in->f_op->remap_file_ra= nge > are NULL, too, the default call to do_splice_direct() cannot be reached. > This patch adds an else clause to make the default reachable in all > cases. > > Signed-off-by: Bert Karwatzki Hi Bert, Thank you for testing and reporting this so early!! I would edit the commit message differently, but anyway, I think that the fix should be folded into commit 05ee2d85cd4a ("fs: use do_splice_direct() for nfsd/ksmbd server-side-copy"). Since I end up making a mistake every time I touch this code, I also added a small edit to your patch below, that should make the logic more clear to readers. Hopefully, that will help me avoid making a mistake the next time I touch this code... Would you mind testing my revised fix, so we can add: Tested-by: Bert Karwatzki when folding it into the original patch? Thanks, Amir. > --- > fs/read_write.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/fs/read_write.c b/fs/read_write.c > index e0c2c1b5962b..3599c54bd26d 100644 > --- a/fs/read_write.c > +++ b/fs/read_write.c > @@ -1554,6 +1554,8 @@ ssize_t vfs_copy_file_range(struct file *file_in, l= off_t pos_in, > /* fallback to splice */ > if (ret <=3D 0) > splice =3D true; > + } else { This is logically correct because of the earlier "same sb" check in generic_copy_file_checks(), but we better spell out the logic here as well: + } else if (file_inode(file_in)->i_sb =3D=3D file_inode(file_out)->i_sb) { + /* Fallback to splice for same sb copy for backward compat */ > + splice =3D true; > } > > file_end_write(file_out); > -- > 2.39.2 > > Since linux-next-20231204 I noticed that it was impossible to start the > game Path of Exile (using the steam client). I bisected the error to > commit 05ee2d85cd4ace5cd37dc24132e3fd7f5142ebef. Reverting this commit > in linux-next-20231204 made the game start again and after inserting > printks into vfs_copy_file_range() I found that steam (via python3) > calls this function with (flags & COPY_FILE_SPLICE =3D=3D 0), > file_out->f_op->copy_file_range =3D=3D NULL and > file_in->f_op->remap_file_range =3D=3D NULL so the default is never reach= ed. > This patch adds a catch all else clause so the default is reached in > all cases. This patch fixes the describe issue with steam and Path of > Exile. > > Bert Karwatzki