Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp1951200rdb; Thu, 7 Dec 2023 13:32:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IGIUCcxd/ndDDuVMgxocVCKR16QiihJ3QgPK0pIwYUFsEc/upIho/7hFq8AIt3ja53YboQz X-Received: by 2002:a92:d341:0:b0:35d:6979:8cb0 with SMTP id a1-20020a92d341000000b0035d69798cb0mr3078203ilh.10.1701984753181; Thu, 07 Dec 2023 13:32:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701984753; cv=none; d=google.com; s=arc-20160816; b=Qu5qnjlDbIxY9wVIwEsIkMX5dkJy3FXprp8evlm9bJN1rrYtvPI56YEd9iTsEoKc/v /HBz7SONbCT7Z5aI5Adt9Oq4gbdSmgud/1FR3cq3yVPK3pNkzAPo7QNdu7r3cYFmHC3q 2hxvYD15YDGvlxSEPhRoTZ8yHl3Qh82dcd+F3cnS2mRkqjYeiyvibu+1KJ+DDN6A7U2W nE6wKhVTOW9UHfRSDDcMSiPLjEJ/41IOpwBHz4HCBi41acujMruAnoSsCJVdi5NeFPIo nuG6uyE0GjcxpeecA0EnlAHFB/XBPAWEaMzmsAnmhpLd/5mlzyBkRVry63nEngqJBSoD fWWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=WWGWFaVybn+Cuwok82Tqy8Z4Nj/F9zUC0bxWKAhhGjQ=; fh=sYq5GRr4z4u7NkcTE0XnshsPQiXi0MpumQuI5P4a1/E=; b=XMX9D8OaYo8bMQeWfZ1JHKYqo2wjOd+ud5bR0CmzDj4TeSCWs95aaF0XbtIGjQ5faq 3vOcSgRQQpxXiyI0S/ZNwwFS2sqr9NISX9qpp511HIMyVEcZOuaFeqIJ9FM79VBJejq/ ZMtdLHqTqivry1tbk30IpBetqZNHYpKGvMc/8TSi4FkIE+58IPqrQJETJyqQiQWFBLpo SyCICMKaru8r+Pwv6rn7sClS4NzqttXryrwtQelLVpLz2Jnxa5hAcaj8ODJIzxPIDTn1 xKsqYCBnaNqw1iTVVNUcyYczVOYpXMQEFr7z95zUNfK0F7Sc1zuIXc1TOtwqpcAv4bB2 eChQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=c2SFJxYK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id v6-20020a634806000000b005c66e609013si326890pga.221.2023.12.07.13.32.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 13:32:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=c2SFJxYK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id F2D588081CFC; Thu, 7 Dec 2023 13:32:29 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233115AbjLGVbU (ORCPT + 99 others); Thu, 7 Dec 2023 16:31:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1444221AbjLGVas (ORCPT ); Thu, 7 Dec 2023 16:30:48 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0AEC635A5 for ; Thu, 7 Dec 2023 13:27:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1701984421; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WWGWFaVybn+Cuwok82Tqy8Z4Nj/F9zUC0bxWKAhhGjQ=; b=c2SFJxYKuotqFnmhjuh34bxE82WZl6tUc6xA4CCF150DdTJ3VIRqGpJQoDRfZbm4d/bNLF l8/LQGzplhdoij2I4FAHMVB1pJg5Ut1ceblQLj088XULVc0j0elgp2WPvbxUOeb0dZroEv GuT6vNGkU2Rl1hWjra1FBA9gCAMj/zU= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-436-VvUqiqovNqOjNjOOBY_-Hw-1; Thu, 07 Dec 2023 16:25:05 -0500 X-MC-Unique: VvUqiqovNqOjNjOOBY_-Hw-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 645AC386A0B0; Thu, 7 Dec 2023 21:25:02 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.161]) by smtp.corp.redhat.com (Postfix) with ESMTP id 78F85111E400; Thu, 7 Dec 2023 21:24:59 +0000 (UTC) From: David Howells To: Jeff Layton , Steve French Cc: David Howells , Matthew Wilcox , Marc Dionne , Paulo Alcantara , Shyam Prasad N , Tom Talpey , Dominique Martinet , Eric Van Hensbergen , Ilya Dryomov , Christian Brauner , linux-cachefs@redhat.com, linux-afs@lists.infradead.org, linux-cifs@vger.kernel.org, linux-nfs@vger.kernel.org, ceph-devel@vger.kernel.org, v9fs@lists.linux.dev, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Steve French , Shyam Prasad N , Rohith Surabattula Subject: [PATCH v3 49/59] cifs: Set zero_point in the copy_file_range() and remap_file_range() Date: Thu, 7 Dec 2023 21:21:56 +0000 Message-ID: <20231207212206.1379128-50-dhowells@redhat.com> In-Reply-To: <20231207212206.1379128-1-dhowells@redhat.com> References: <20231207212206.1379128-1-dhowells@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 pete.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 (pete.vger.email [0.0.0.0]); Thu, 07 Dec 2023 13:32:30 -0800 (PST) Set zero_point in the copy_file_range() and remap_file_range() implementations so that we don't skip reading data modified on a server-side copy. Signed-off-by: David Howells cc: Steve French cc: Shyam Prasad N cc: Rohith Surabattula cc: Jeff Layton cc: linux-cifs@vger.kernel.org cc: linux-cachefs@redhat.com cc: linux-fsdevel@vger.kernel.org cc: linux-mm@kvack.org --- fs/smb/client/cifsfs.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/fs/smb/client/cifsfs.c b/fs/smb/client/cifsfs.c index 078cff36cd2e..ebe04c78a955 100644 --- a/fs/smb/client/cifsfs.c +++ b/fs/smb/client/cifsfs.c @@ -1337,6 +1337,8 @@ static loff_t cifs_remap_file_range(struct file *src_file, loff_t off, rc = cifs_flush_folio(target_inode, destend, &fstart, &fend, false); if (rc) goto unlock; + if (fend > target_cifsi->netfs.zero_point) + target_cifsi->netfs.zero_point = fend + 1; /* Discard all the folios that overlap the destination region. */ cifs_dbg(FYI, "about to discard pages %llx-%llx\n", fstart, fend); @@ -1355,6 +1357,8 @@ static loff_t cifs_remap_file_range(struct file *src_file, loff_t off, fscache_resize_cookie(cifs_inode_cookie(target_inode), new_size); } + if (rc == 0 && new_size > target_cifsi->netfs.zero_point) + target_cifsi->netfs.zero_point = new_size; } /* force revalidate of size and timestamps of target file now @@ -1446,6 +1450,8 @@ ssize_t cifs_file_copychunk_range(unsigned int xid, rc = cifs_flush_folio(target_inode, destend, &fstart, &fend, false); if (rc) goto unlock; + if (fend > target_cifsi->netfs.zero_point) + target_cifsi->netfs.zero_point = fend + 1; /* Discard all the folios that overlap the destination region. */ truncate_inode_pages_range(&target_inode->i_data, fstart, fend);