Received: by 2002:a89:2c3:0:b0:1ed:23cc:44d1 with SMTP id d3csp995402lqs; Wed, 6 Mar 2024 03:16:17 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUKLJ5Aj1c5T6lE7UwSIOWQQA96b3+SI83rB0GZMG4ysvSKka3vpqHC5vzdQlr9ex6NSd4OHd5OeLn6Os36w1MnGzEJHHHQVEXJ1e0bMA== X-Google-Smtp-Source: AGHT+IGfR5/t7BxMrzHbrTuLhVjzPXUTZ8SU3abUJSwbEb7FMo2ZOkix7kWs8U1zrvEd07HzjI9e X-Received: by 2002:a17:906:1cd0:b0:a40:a615:a9c4 with SMTP id i16-20020a1709061cd000b00a40a615a9c4mr10318139ejh.65.1709723777726; Wed, 06 Mar 2024 03:16:17 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709723777; cv=pass; d=google.com; s=arc-20160816; b=Z5A1aVPb3wneuaXfD6cGkGMsYQuWM9obVG/qxV+pTb0NPB3un39VHJ8QCsc/Ist/GL ZRqSY8vLsf/7j5rj7lcVTAutmZFJQ1X3dtk3AYQZUqVyM7jCkOCG3/Kx1GkQMXSX0pdS eC7RxP3LLd7TkgUOwKHu78Hg7uwFz2G4T/GCSUBGEYdk2k1lqPWDooMBLEejkz2aRk9a /ojrCUsEixhkkqQNGTNKekjF5zHAJ+72kG6v/HfufuWFVu7FRll5pM7ns/taCShZrbi/ TEN9yNNOzcamJljRvT8tLuZWhf9/2w94F/2XT5y2VdOdvBVih/yPs67D5xdrz7Ue1rG+ Zd/g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:feedback-id :dkim-signature:dkim-signature; bh=euRAQTDYQadFcgoxjxByg2C0UZ4sLTe5P2pud1Ie/DY=; fh=Oijd2gDEFy+7lMYMAuAH1tpb2jYhNCVafa54Ke2dQ3g=; b=PWJBqrEQ/TbtMVhLMnUY1bFytELz7l8MsZDubwsODRkfQ0KseM015wVpIyN7UfPR2J N03eWKj3+xdA2Jv6hMDqzGSIOrUUaNhyE17YuzJtpiQH5TqCeNRUaCnT36qoVPPUphpw Qqv/6jbShC5c96kt2EcGbHqTfLHsaT1a5Na8qSHs5YoahiKvN7j7lRhZ9mLJ3Qa0eoPK ywisoEinuLJ9SdTfPagFxKeiVhmycNGlM3gQfdyZQ43kJDAIqoQ0Tc1zP926pneQdHyY ddSoRAxePQKehz1DktaRFYrDdN3FDrizTzLKXYZKa0yQQMHSDqBz+ehyG0syi70VA7m+ OZKw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@fastmail.fm header.s=fm1 header.b=vOcqFhqR; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=cvPGn+Yb; arc=pass (i=1 spf=pass spfdomain=fastmail.fm dkim=pass dkdomain=fastmail.fm dkim=pass dkdomain=messagingengine.com dmarc=pass fromdomain=fastmail.fm); spf=pass (google.com: domain of linux-kernel+bounces-93842-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-93842-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=fastmail.fm Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id lf13-20020a170907174d00b00a44323561d5si5858514ejc.432.2024.03.06.03.16.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Mar 2024 03:16:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-93842-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@fastmail.fm header.s=fm1 header.b=vOcqFhqR; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=cvPGn+Yb; arc=pass (i=1 spf=pass spfdomain=fastmail.fm dkim=pass dkdomain=fastmail.fm dkim=pass dkdomain=messagingengine.com dmarc=pass fromdomain=fastmail.fm); spf=pass (google.com: domain of linux-kernel+bounces-93842-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-93842-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=fastmail.fm Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 735101F2673C for ; Wed, 6 Mar 2024 11:16:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6DC85779F8; Wed, 6 Mar 2024 11:16:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=fastmail.fm header.i=@fastmail.fm header.b="vOcqFhqR"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="cvPGn+Yb" Received: from wout2-smtp.messagingengine.com (wout2-smtp.messagingengine.com [64.147.123.25]) (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 980AA2907; Wed, 6 Mar 2024 11:16:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=64.147.123.25 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709723768; cv=none; b=jjNiJ1vVPIMBqB6w2J8Glp1B+M/IMmDDgUTdSCNIWRWa7F2evPjq07cOSqsYFnt6WoLmVHMrjfAer4ambqRoNH+V4piumR83RwZi2u8nI9XJT/yA4QQ5boM15lpZyeu9pWxVwS5Y+ylLKrNdUEsOUcTg92c6wuwlDUn2+HpGyJk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709723768; c=relaxed/simple; bh=Lz0bsq08ymHzHXiwDFFXePeWEE/vJs9dusHDjJSFuew=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=cmdA+IzGdQF4koBZt2LQXPWdtWFRJYPHRdoTjLs/vbFBevQCDP0Nn9cNN+TFybA56foeFSCERPua3RBVkw4jq9W7yHgzhJhAKksknFqE5895V1H39K+09ZWwuQy3iIs6Dhx9QRhJT959efjRCnlICi0uksFiQmYeOGTbuFNWp7E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=fastmail.fm; spf=pass smtp.mailfrom=fastmail.fm; dkim=pass (2048-bit key) header.d=fastmail.fm header.i=@fastmail.fm header.b=vOcqFhqR; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=cvPGn+Yb; arc=none smtp.client-ip=64.147.123.25 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=fastmail.fm Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fastmail.fm Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.west.internal (Postfix) with ESMTP id 57B6B320010B; Wed, 6 Mar 2024 06:16:04 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Wed, 06 Mar 2024 06:16:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.fm; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1709723763; x=1709810163; bh=euRAQTDYQadFcgoxjxByg2C0UZ4sLTe5P2pud1Ie/DY=; b= vOcqFhqRoZi6VCBg71kCWd5yXw49z77iXT4BD8RidA4Fy99KfFapYS9kwXH2aWIs i1TlQymqnHcBe+qYSOHtR9fxkRLCqjgJbRnByev/ptB2Hb9tS69I8onIoRRE5eOL R8T+MVH5I4RebPvP5uxVk/NTakk0ClRfQg6DfKxce9w1JuFm67VVV6mbx70NFpSl HAJrnsYEyBQYT3/NB0uHkT0SUO2lfUm/vLhwqjV5gP27VXNN5V/vN/yi0/uDHLvu Unue6QZCyi6bjAbW/gRh8iQRpsd0E61ZTSATSJfiIYQNW20o9njTfKBfUr4N/BOE jY6xTVxatUu3Jc5ur0GoxQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1709723763; x= 1709810163; bh=euRAQTDYQadFcgoxjxByg2C0UZ4sLTe5P2pud1Ie/DY=; b=c vPGn+Yb9/85TeZ1uskigiMUgXxGHTygcN2p0b0pHIPdXvwkATbdQjyvRyFcibRyp wlM6sY1krTlA5Px6kS8MrPy7VavYr/nJG04Z5EbDhjI3Onjjt6ssYd2nPbgFkj66 IoMlgKpTtySS8T+EeICVktwk5eVam49pnG9mIyU9nYe3VuiYCSy2RqPCJNRkkY5X Kh8aLMpnlUWLslW9xKcGVbhJCVYsOmSJghV2jXXWJtvD2tpyAuyI0h2FWsGHbSnZ 25hatWDp+ABgyg1D5UWRKPd0M2Rp6WyxouJ1LSqz8SZESDATLQoR5xrjPcTJQTsd AcM+GOdk6hrdYNUnp9ydw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledriedugddvgecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefkffggfgfuvfevfhfhjggtgfesthejredttddvjeenucfhrhhomhepuegvrhhn ugcuufgthhhusggvrhhtuceosggvrhhnugdrshgthhhusggvrhhtsehfrghsthhmrghilh drfhhmqeenucggtffrrghtthgvrhhnpedtudeggfejfeektdeghfehgedvtdefjeehheeu ueffhfefleefueehteefuddtieenucffohhmrghinhepghhithhhuhgsrdgtohhmnecuve hluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepsggvrhhnugdr shgthhhusggvrhhtsehfrghsthhmrghilhdrfhhm X-ME-Proxy: Feedback-ID: id8a24192:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 6 Mar 2024 06:16:03 -0500 (EST) Message-ID: Date: Wed, 6 Mar 2024 12:16:00 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v1] fs/fuse: Fix missing FOLL_PIN for direct-io To: Miklos Szeredi , Lei Huang Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org References: <1693334193-7733-1-git-send-email-lei.huang@linux.intel.com> Content-Language: en-US, de-DE, fr From: Bernd Schubert In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 3/6/24 11:01, Miklos Szeredi wrote: > On Tue, 29 Aug 2023 at 20:37, Lei Huang wrote: >> >> Our user space filesystem relies on fuse to provide POSIX interface. >> In our test, a known string is written into a file and the content >> is read back later to verify correct data returned. We observed wrong >> data returned in read buffer in rare cases although correct data are >> stored in our filesystem. >> >> Fuse kernel module calls iov_iter_get_pages2() to get the physical >> pages of the user-space read buffer passed in read(). The pages are >> not pinned to avoid page migration. When page migration occurs, the >> consequence are two-folds. >> >> 1) Applications do not receive correct data in read buffer. >> 2) fuse kernel writes data into a wrong place. >> >> Using iov_iter_extract_pages() to pin pages fixes the issue in our >> test. >> >> An auxiliary variable "struct page **pt_pages" is used in the patch >> to prepare the 2nd parameter for iov_iter_extract_pages() since >> iov_iter_get_pages2() uses a different type for the 2nd parameter. >> >> Signed-off-by: Lei Huang > > Applied, with a modification to only unpin if > iov_iter_extract_will_pin() returns true. Hi Miklos, do you have an idea if this needs to be back ported and to which kernel version? I had tried to reproduce data corruption with 4.18 - Lei wrote that he could see issues with older kernels as well, but I never managed to trigger anything on 4.18-RHEL. Typically I use ql-fstest (https://github.com/bsbernd/ql-fstest) and even added random DIO as an option - nothing report with weeks of run time. I could try again with more recent kernels that have folios. Thanks, Bernd