Received: by 2002:ab2:7855:0:b0:1f9:5764:f03e with SMTP id m21csp998680lqp; Thu, 23 May 2024 06:30:06 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXn90dhlHTQ7d2Q/1GZ+G+nA4Wvygqu6il90LfKLHQ4u6BXMG4au+gymAimFxMdu/y2H0xTFQQjb1/TRAakc3E8rWIRHFpHd6OjhuNIWg== X-Google-Smtp-Source: AGHT+IGebzRExwYNY5nBqwq/+XDJxMKLahEHAYTE+qLhUp8VDXp+VTCfRee9hNwwqbLzrJVTkE/i X-Received: by 2002:a17:907:26cb:b0:a59:f30e:fecd with SMTP id a640c23a62f3a-a622807a844mr428849466b.2.1716471005866; Thu, 23 May 2024 06:30:05 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716471005; cv=pass; d=google.com; s=arc-20160816; b=LifcFPdQC5p1LzPMZVNXlqYjECsDt9XlmQi6kwKG7UMFpqj9/oADcHMEdOEIzQmB99 1gYzK3gdndS2lJAZR1tpThUjyaku7T8WdLNKU8lScFkuNv4pk2mRv/YK5iRQQd8KitUY okiSbmoNayqim6U8YiEZ570S65rXYDDGZQ7cNdaRD69YYbnTvTquC73LZhvGA4I4UZvC +ZgWPFJTeorDb1fQKEP4HjUd8uaoiw1QngFhVoGBuzmzuVhv1Bq0zuhZ3Vo+yjXAK6OB DA2h1P4NY0DZAaeTOgpJHPiaULy/+HhOhkY3MRoBs6GuBhEMukfX3dRmJaz/VBoUHUHJ AvQw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=OuCNEgJSsUEnXJbZPKO91r6MB414YH8j6wV6xl5Olk0=; fh=zFJKdPSbgPA0gjZmAh5wTTXKDS06O/BjS5b7kQJAqoU=; b=kqWxpx7c1mPmDFUgIw9P+msNe5SyV0WZqXRgsxf+5v5+5hDiEPL20lO8ZN0ie0SfEO rRgfdsym1YeMjPb/5Rxjb46Eha2BSskJZ9+ev44aS8SUZZXR/n+wKqNOv/EWkSP50OiY JIk0FjjiLZwm9uqeeTBcJsWu8ckX1GXCuWwnykd8SjmT2LV0uBoX0Y0SebE7gly0VI+d JYG4znFuVSQWGY/zEMJGRkLqwQCInn5BPxAIDrBKrG2DRLPD1xMVJJlA0PEcOU67cLZq aj9nhkaf0GvYQ5yv22fPQp2OumNddGN5kNyrL+bccF3Fg2ortqfLr44lG/yHZkb/V6T8 4JVw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=YtEjefmp; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-187576-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-187576-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a5a17b37312si1562806266b.449.2024.05.23.06.30.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 May 2024 06:30:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-187576-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=YtEjefmp; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-187576-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-187576-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 97C891F216EA for ; Thu, 23 May 2024 13:30:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1E19514A604; Thu, 23 May 2024 13:30:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="YtEjefmp" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 464D013A897; Thu, 23 May 2024 13:29:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716470999; cv=none; b=Yejt0hxtLYkjWtQz1VVEx4cGpZrNxjnMzz7YFXq5vf6QK6zCNPZ+eukARB00Sm8QDm+6SU4Q5G3/XKWBNpVLAhyBtb2fQ+eCToJtJfjAOYu4vMrp9anI8duGJ5XEZrFPjNCaJNjiMIzn7+/3yOcg1zj3iadNA4grA9SN7bBMdQ8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716470999; c=relaxed/simple; bh=Rk4yXUP9gRTWbd2b0oejhcUnoZA8VySiJ7FWn7BIDGU=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=qZS3YLhFE7TZ/PUANf9Tl8DxiQgqplVyEfiYOFUbjO9Gh8UmkqzZPkG/wm6oyhSGt/Bd+6pkbCFj2RUaP9papSNVs0SQofzRm8VoTal6MIxHMZ+feKgctr/RlXz7gxGNpCSd+7s7CC6gMACuT0B70hkzG16goGNMYvjX7vGptUE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=YtEjefmp; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 92A8BC3277B; Thu, 23 May 2024 13:29:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1716470999; bh=Rk4yXUP9gRTWbd2b0oejhcUnoZA8VySiJ7FWn7BIDGU=; h=From:To:Cc:Subject:Date:From; b=YtEjefmpxgRonDoRO53ZOxb0h9X1hV1MABIRTkpEcM46Fdu7FjXI2mZZXdX+2m2Nu gzLkYAJe9ws3crPFQqXzYzrX+fgu+oifo1GrCAlJzDQLaNSGmjZA7pkX9Or8UwWcBG HurnlUeJCuT060TU+kxrTlk4md+95Q2HoyWJoc4HWc9gSG14KpFuLMGacmM0/NMRlE 4VDbWSEmQPJ6/YOYQc5AS2XsxBR4yJxpv7Vc4s9nYqjb9uuoB+1+jNP8KAaMuWmgsH HPFE8+7iOd47xNbmfEk/BGIewPeFKzkGzjZMzoLjHZOUAQkYo9/YZzyznnUful6Xwo 8dlJNjnq7+Tbg== From: Chao Yu To: jaegeuk@kernel.org Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, Chao Yu , stable@vger.kernel.org, Barry Song Subject: [PATCH] f2fs: fix to force buffered IO on inline_data inode Date: Thu, 23 May 2024 21:29:48 +0800 Message-Id: <20240523132948.2250254-1-chao@kernel.org> X-Mailer: git-send-email 2.40.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit It will return all zero data when DIO reading from inline_data inode, it is because f2fs_iomap_begin() assign iomap->type w/ IOMAP_HOLE incorrectly for this case. We can let iomap framework handle inline data via assigning iomap->type and iomap->inline_data correctly, however, it will be a little bit complicated when handling race case in between direct IO and buffered IO. So, let's force to use buffered IO to fix this issue. Cc: stable@vger.kernel.org Reported-by: Barry Song Signed-off-by: Chao Yu --- fs/f2fs/file.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index db6236f27852..e038910ad1e5 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -851,6 +851,8 @@ static bool f2fs_force_buffered_io(struct inode *inode, int rw) return true; if (f2fs_compressed_file(inode)) return true; + if (f2fs_has_inline_data(inode)) + return true; /* disallow direct IO if any of devices has unaligned blksize */ if (f2fs_is_multi_device(sbi) && !sbi->aligned_blksize) -- 2.40.1