Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp781557rwb; Wed, 16 Nov 2022 07:35:46 -0800 (PST) X-Google-Smtp-Source: AA0mqf6jJdbvjfjyYUccKr4Xg/Fom7k67DbhXiuxMG5iMdv/zTMzNjuXn3Ydk9CaE4Z0a0lsPMV0 X-Received: by 2002:a63:a08:0:b0:470:75a1:c6d7 with SMTP id 8-20020a630a08000000b0047075a1c6d7mr20746479pgk.120.1668612946385; Wed, 16 Nov 2022 07:35:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668612946; cv=none; d=google.com; s=arc-20160816; b=BNoeBk8MDLDLnCkpDy4uTfF55/rV4xqp8q8/ai32TCABsEUT/3UawptVk3bI3dMSna 3t0GTWQVJmUFd6jccwZ8IX75KYgXrqcguNQkCbP6ZYGWH871azux1cOhGvU32ANM9PoJ gMAhXDsqvfpw0aWw36Eb8h8meK+BwDoF0O/Fj5QcGOQxe4ikW6B3LfHhkGuQaISy38z9 N5nt2jzKFwYXaW76MBz/S7qzEQbKV8tlVzzN7Ja2tRWhG5obo/f7XvKc6UEH/OrRmeON nQNgcCWohQr458hFHts8EsKKqXemq8nIdapmO3hVRVXBXmPOm+ujb5ZCW+h4gFxeCnX+ 09fA== 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 :message-id:date:subject:to:from:dkim-signature; bh=O1ntjw5lJkZk5tstBNlEfJG7WqcW0ZDZzgQ9XTtE5Jw=; b=o4zJhGXYZYKBuuelC5sr1nMiP/9UkDbh082WOz241N30IF4soSCC+NPWMeUDsmeOpc KFnYqfYvmfpUTQLFL/RA+mJEOq6k0bjDwS223l1y2JqmGESaUb3MXR6ZF7l8ZKb6Mt8t Jw0KQbtEUJ4b6Lk18xkjGeMG4NxWuGM1XD+k+nqpXIydF5z/p47FapbsIadsbA/zYX+M 2tiomNGaLZ+PhxmWpU7kLSEI1ugKbkH+Fe7C8DtLawcv7zIpWLkAUPaJMuRUwpUGEyUF ICyqeMONtDlY3KzYe57Zop4rjDn/ldXIdfyISXcCZRE9komEku65OcJkcmLg60aiWCb3 5VmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Hipnvziu; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s12-20020aa78bcc000000b00562f2ff1579si13966319pfd.60.2022.11.16.07.35.27; Wed, 16 Nov 2022 07:35:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Hipnvziu; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232009AbiKPP3a (ORCPT + 99 others); Wed, 16 Nov 2022 10:29:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234688AbiKPP32 (ORCPT ); Wed, 16 Nov 2022 10:29:28 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2629E15 for ; Wed, 16 Nov 2022 07:28:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1668612513; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=O1ntjw5lJkZk5tstBNlEfJG7WqcW0ZDZzgQ9XTtE5Jw=; b=HipnvziuRm0oLxLpsd5lkS8nd3bHbjsqqmksS/NaYyQ1MBI0TqUlhVLmVl7pWHlREMmbCS ++JgyPLZDkZR5CFakzFx3NJKfzcUy6tVrzWTGvhYgXudpyYkU3qxus0Wmlw2XWuEKQ/obm h7ej/Br6DcemIblrV4rCSnIVyo46Qnc= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-332-glpAAsCmMxKmhFRDzBXWLw-1; Wed, 16 Nov 2022 10:28:32 -0500 X-MC-Unique: glpAAsCmMxKmhFRDzBXWLw-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C97073810794 for ; Wed, 16 Nov 2022 15:28:31 +0000 (UTC) Received: from bfoster.redhat.com (unknown [10.22.16.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id B0D96C1912A for ; Wed, 16 Nov 2022 15:28:31 +0000 (UTC) From: Brian Foster To: linux-nfs@vger.kernel.org Subject: [PATCH] NFSD: pass range end to vfs_fsync_range() instead of count Date: Wed, 16 Nov 2022 10:28:36 -0500 Message-Id: <20221116152836.3071683-1-bfoster@redhat.com> MIME-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org _nfsd_copy_file_range() calls vfs_fsync_range() with an offset and count (bytes written), but the former wants the start and end bytes of the range to sync. Fix it up. Fixes: eac0b17a77fb ("NFSD add vfs_fsync after async copy is done") Signed-off-by: Brian Foster --- Hi all, This is just a quick drive-by patch from scanning through various flush callers for something unrelated. It looked like this instance passes a count instead of the end offset and it was easy enough to throw up a patch. Compile tested only, feel free to toss it if I've just missed something, etc. etc. Brian fs/nfsd/nfs4proc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index 8beb2bc4c328..3c67d4cb1eba 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c @@ -1644,6 +1644,7 @@ static ssize_t _nfsd_copy_file_range(struct nfsd4_copy *copy, u64 src_pos = copy->cp_src_pos; u64 dst_pos = copy->cp_dst_pos; int status; + loff_t end; /* See RFC 7862 p.67: */ if (bytes_total == 0) @@ -1663,8 +1664,8 @@ static ssize_t _nfsd_copy_file_range(struct nfsd4_copy *copy, /* for a non-zero asynchronous copy do a commit of data */ if (nfsd4_copy_is_async(copy) && copy->cp_res.wr_bytes_written > 0) { since = READ_ONCE(dst->f_wb_err); - status = vfs_fsync_range(dst, copy->cp_dst_pos, - copy->cp_res.wr_bytes_written, 0); + end = copy->cp_dst_pos + copy->cp_res.wr_bytes_written - 1; + status = vfs_fsync_range(dst, copy->cp_dst_pos, end, 0); if (!status) status = filemap_check_wb_err(dst->f_mapping, since); if (!status) -- 2.37.3