Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2175163iof; Tue, 7 Jun 2022 22:12:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyA1gQZltBZUoMJQQXbTWIzjrjd5j7sIU5K5f3xJnhXu2ZPGI/fU7yRnZ1IXnXDf3HzONJO X-Received: by 2002:a63:6c44:0:b0:3fa:ec6b:33e7 with SMTP id h65-20020a636c44000000b003faec6b33e7mr27979659pgc.435.1654665170058; Tue, 07 Jun 2022 22:12:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654665170; cv=none; d=google.com; s=arc-20160816; b=IxeIXUTILObD9QcO4Cd3TtIj7KXE2aVCn86nTQw8amLgDvUpjj7DfftAtLjP6ra58E qDyMrBjwXxfWbbEwv7pGAIeiQWh3G5mGrhslDLdgHrsSIvm5d1EaxrkcIAdRMzQuO6Qq FNpY5xdOqYynRlc4fwjAczG1SL3sBZTx0axSEvWPDPHAPxyhxlXa4M+ukxh57N2mf4Qm o+uvi0zW7SknIMPlMy4q/SCgM9PEHGZLhQNcEh0H/1pUt1lj7O+y8ix9rIkDOpBUyltK WHFoarOimkx+5Vn2H2Ty8ee6mQ6g1Q22wrY0WfW2dC49ct0Ei0jZvoe6ZKo9V4OZcvDD io6w== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ZFvNIBUAnC7dghKjLq3cnhx6DUiKYjS7AV2tH385Ndc=; b=b45QURtJ6keZ0iXQh2k9NZLM8JpguKLRH/fQ/0zA/5g1ofOvIrmWeioxaFbTccljvX 9jE2jsURVEbcVt2ylRFk3Q/pEiRqmZ3Fr/xcpIEb8+gGy2Jde4crnW3hy93wQkGEggYs Wqycvpbhq0oFITqo2LXcDdPabETzlcLUjxLp8oElu7IONbbJ62c3ejnFcViDEx2Ld71H Jm8WGJtxDBBUBvyb/jCcSrqGpe7POWb639DY378jjS6DUGcgh5cEYE1vuAcRm9DzujFb 6v/zNAvvfsal3cR7MyIQYaPtzVROz7GzuOAO/ik0h06ZKPsU1kq8Dj0fiaKN7baIX60Y hwpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=oh9xtc1C; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id t14-20020a17090340ce00b00153b7df656asi25825568pld.490.2022.06.07.22.12.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 22:12:50 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=oh9xtc1C; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id EE28140E284; Tue, 7 Jun 2022 21:43:04 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382370AbiFGVzw (ORCPT + 99 others); Tue, 7 Jun 2022 17:55:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379274AbiFGVCS (ORCPT ); Tue, 7 Jun 2022 17:02:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D914F4CD7B; Tue, 7 Jun 2022 11:47:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 744D1612F2; Tue, 7 Jun 2022 18:47:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 840ECC385A2; Tue, 7 Jun 2022 18:47:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627638; bh=uYiciictdrSEQB12gEqhK2G+ukdTSz3fit8pE6wltZY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oh9xtc1CLoAeT0OqYnKlRNZUkE2Us+NDh9hAyz1zTIA4XkV4FAlHNUNRI5jQgUwVI G1oZ8JV/9qQQUzPV5z+xvH4DgF3I3pJoFpIDA1RW5ZlbK095MsSQPJCfBKngc0Slj4 b91jT8l5pmzfdeSESBcBCpMCjqQNqWiEb5Mp4BGo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Konstantin Komarov Subject: [PATCH 5.18 022/879] fs/ntfs3: Update valid size if -EIOCBQUEUED Date: Tue, 7 Jun 2022 18:52:20 +0200 Message-Id: <20220607165003.320075307@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,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 lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Konstantin Komarov commit 52e00ea6b26e45fb8159e3b57cdde8d3f9bdd8e9 upstream. Update valid size if write is still in I/O queue. Fixes xfstest generic/240 Fixes: 82cae269cfa9 ("fs/ntfs3: Add initialization of super block") Signed-off-by: Konstantin Komarov Signed-off-by: Greg Kroah-Hartman --- fs/ntfs3/inode.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- a/fs/ntfs3/inode.c +++ b/fs/ntfs3/inode.c @@ -757,6 +757,7 @@ static ssize_t ntfs_direct_IO(struct kio loff_t vbo = iocb->ki_pos; loff_t end; int wr = iov_iter_rw(iter) & WRITE; + size_t iter_count = iov_iter_count(iter); loff_t valid; ssize_t ret; @@ -770,10 +771,13 @@ static ssize_t ntfs_direct_IO(struct kio wr ? ntfs_get_block_direct_IO_W : ntfs_get_block_direct_IO_R); - if (ret <= 0) + if (ret > 0) + end = vbo + ret; + else if (wr && ret == -EIOCBQUEUED) + end = vbo + iter_count; + else goto out; - end = vbo + ret; valid = ni->i_valid; if (wr) { if (end > valid && !S_ISBLK(inode->i_mode)) {