From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id AA237C3DA61 for ; Tue, 30 Jul 2024 01:02:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0B11E6B0085; Mon, 29 Jul 2024 21:02:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 039E16B0088; Mon, 29 Jul 2024 21:02:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DF5A46B0089; Mon, 29 Jul 2024 21:02:29 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id BDC0F6B0085 for ; Mon, 29 Jul 2024 21:02:29 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 5AB998019B for ; Tue, 30 Jul 2024 01:02:29 +0000 (UTC) X-FDA: 82394618418.16.24FE414 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf15.hostedemail.com (Postfix) with ESMTP id 46B6AA0023 for ; Tue, 30 Jul 2024 01:02:24 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=none; spf=pass (imf15.hostedemail.com: domain of yangerkun@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=yangerkun@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1722301293; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bBZRN7lDvtSLRkzTaRxGrK4kSgGU4oWkaeLDL+cyUHk=; b=wSZGxFIDL5hUorBTRc5uV+Lj9Czw8lM6vq+6HVi6Bz6xo7SL9VYjIWep/K2+Wt4h3j1ptL EttSavLs3HmVxnhH0cUTLY8HaA41Lvb13pkHJwa/Qz3369p8cd5WGUqospBnBvb4VBpdWk abBRjrz5YcvIiobSeDOHdYMI/lp+eQM= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1722301293; a=rsa-sha256; cv=none; b=JB6udUjk+9PdA8gqw24bJEQmUvFe2w2/GCm6+QvjX+rMKj8gAbGP1mxgDpWS9+IEfBP1DL b/S4aMzwfS8ssbab7exzJFpuJmzUwE0xVUANKcMsbq156nTjiYFHbZDR8BHy3XWBZDyW6M 2J9gUAGcHK8D9/aVY0teDY6f0OYpUGg= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=none; spf=pass (imf15.hostedemail.com: domain of yangerkun@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=yangerkun@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com Received: from mail.maildlp.com (unknown [172.19.88.194]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4WXxkW4Mg0zncmc; Tue, 30 Jul 2024 09:01:23 +0800 (CST) Received: from kwepemf100006.china.huawei.com (unknown [7.202.181.220]) by mail.maildlp.com (Postfix) with ESMTPS id E3C4C140FA7; Tue, 30 Jul 2024 09:02:20 +0800 (CST) Received: from [10.174.177.210] (10.174.177.210) by kwepemf100006.china.huawei.com (7.202.181.220) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Tue, 30 Jul 2024 09:02:20 +0800 Message-ID: Date: Tue, 30 Jul 2024 09:02:19 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.5.1 Subject: Re: [PATCH] generic/736: don't run it on tmpfs To: Chuck Lever III CC: Filipe Manana , Christoph Hellwig , "zlang@kernel.org" , "fstests@vger.kernel.org" , "linux-mm@kvack.org" , "hughd@google.com" , Andrew Morton , linux-btrfs References: <20240720083538.2999155-1-yangerkun@huawei.com> <4188b7b5-3576-9e5f-6297-794558d7a01e@huawei.com> <9514fd55-4f83-8e43-bdf7-925396ab5e48@huawei.com> <418B7A4D-30D7-44B4-B3F3-5BE97C04BACE@oracle.com> From: yangerkun In-Reply-To: <418B7A4D-30D7-44B4-B3F3-5BE97C04BACE@oracle.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.177.210] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemf100006.china.huawei.com (7.202.181.220) X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 46B6AA0023 X-Stat-Signature: zc8jwfikr6xs8wq6x6shkqf47zh3wb18 X-HE-Tag: 1722301344-607401 X-HE-Meta: U2FsdGVkX19IKoCMsbOhAjexMhoJ31DqQnEoUrUjVNVDGPdNqpQhNKCNxm+798DxJkheX9NfPki8uNNk3bsTcfMf1MoAUKu3+THVVTkQRlnH/8Rt7Asz2tdByFUdWdDY/MxgE+jK0hi1hkWntzYZTcZUwmCQYjDHkWlRnh6p7AODaLgMsWpguZ8Igtk/QT3cqV0OL7VDlqUHV1kngL4c7cFn5V2dRyHsaxpIuFc34wcjIelzO6nJkdPChKuABnPmBfObFZ7Gi472W3S4fg8hX3FlK3I+VhuCVBkjnxcD/U8Af8/meM6Ymv0AoNXyqlrvxP7nXQZZ9zFm7Q1H10cOva7VqGnBknD2pAHdmcvY00J6bh8l8Re1kjmqymI0et8wKJDq2nqZQR9eqlfnTgTiCspweXJwYQgAQAfDuBX6BO3c0UqdSk5V5ACYR7UJ+GzYZv4g9bxJS069n96Vo5lMLcSwPLGx2RfJs+ctZZuiZ+mEUnMKCVAF22rEcv1fRikoMz5ExR2xKmTipY0/0ZjDH72ui0vN9BYu2u+VH3IgzAhlYn6/lqQK756EAy+UEFALrkqs+hET69H++uySCNsv8lrNO6zwGhrFx97dZAU5UK//wUxriEQlfnTs7l5BF4fEFCgQeXG+OS388V6MpfC2uT0ys/Td3etsQ1j1O34YfZ2E/Dwz1WLE8t6Z2hiE31v/ms5+qUQQhbtkMWU8/iyTlNjyRiQymYbHoFSYmKoT44Gk6OhLOeJ/GXtCuLkaXhRj/q8O+B3it0vSLXbzJsA+kJZDDMJlFwgHmRBg5SjilvZtQyA1n1hgFIxnpkq0fFBugRuim3Z+IDqOLVbvEfg/TMeP/tN+ZG2OKXt71PSB4Fi79ZC4gnYrCAWq64IkJzM6f5JtuR5mSvhUMt+dVx051+zewlDpM642BuzgQF0liazt2VaZP5nLXhQu53rQttMxGAGwwWsdBDxxlKQm5c7 hIEwPdg1 +ol57ozD3L/cqnEFpQ+q+49wWE2CxjiA2TK4xtPvHJoO40zZNa8oSZoEHMfFS+8stuVTTZNjX++ukwCpC30frGBpFGg5Vy5RGejvOt1AdSMRoXK6Ab1mR00iyfGCQsGktSPiFhVqDT2IkyT1kPFpIGUwMQmt3mohAi9wONf6tAnRTofxFBEPqxudrUgT2wggOP5QCcmCUzCubnMEPcHq9PT3B3aXGkLQKt8oI9up+a4DoKZ+izVrn/q/k3Vt1JZ82zNevm91TojdOaTJq3CZfRPOttcxBK9+2ZXZDYAlNe5r1ZhrZZk67leP5Bmf2ix0CGmwpP/Nc0to4VM7pVNWWz4ooFw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: 在 2024/7/29 22:29, Chuck Lever III 写道: > > >> On Jul 29, 2024, at 9:53 AM, yangerkun wrote: >> >> Hi, >> >> 在 2024/7/24 21:30, yangerkun 写道: >>> Hi, All, >>> Sorry for the delay relay(something happened, and cannot use pc >>> before...). >>> 在 2024/7/21 1:26, Filipe Manana 写道: >>>> On Sat, Jul 20, 2024 at 9:38 AM Yang Erkun wrote: >>>>> >>>>> We use offset_readdir for tmpfs, and every we call rename, the offset >>>>> for the parent dir will increase by 1. So for tmpfs we will always >>>>> fail since the infinite readdir. >>>> >>>> Having an infinite readdir sounds like a bug, or at least an >>>> inconvenience and surprising for users. >>>> We had that problem in btrfs which affected users/applications, see: >>>> >>>> https://lore.kernel.org/linux-btrfs/2c8c55ec-04c6-e0dc-9c5c-8c7924778c35@landley.net/ >>>> >>>> which was surprising for them since every other filesystem they >>>> used/tested didn't have that problem. >>>> Why not fix tmpfs? >>> Thanks for all your advise, I will give a detail analysis first(maybe >>> until last week I can do it), and after we give a conclusion about does >>> this behavior a bug or something expected to occur, I will choose the >>> next step! >> >> The case generic/736 do something like below: >> >> 1. create 5000 files(1 2 3 ...) under one dir(testdir) >> 2. call readdir(man 3 readdir) once, and get entry >> 3. rename(entry, "TEMPFILE"), then rename("TMPFILE", entry) >> 4. loop 2~3, until readdir return nothing of we loop too many times(15000) >> >> For tmpfs before a2e459555c5f("shmem: stable directory offsets"), every rename called, the new dentry will insert to d_subdirs *head* of parent dentry, and dcache_readdir won't reenter this dentry if we have already enter the dentry, so in step 4 we will break the test since readdir return nothing (I have try to change __d_move the insert to the "tail" of d_sub_dirs, problem can still happend). >> >> But after commit a2e459555c5f("shmem: stable directory offsets"), simple_offset_rename will just add the new dentry to the maple tree of &SHMEM_I(inode)->dir_offsets->mt with the key always inc by 1(since simple_offset_add we will find free entry start with octx->newx_offset, so the entry freed in simple_offset_remove won't be found). And the same case upper will be break since we loop too many times(we can fall into infinite readdir without this break). >> >> I prefer this is really a bug, and for the way to fix it, I think we can just use the same logic what 9b378f6ad48cf("btrfs: fix infinite directory reads") has did, introduce a last_index when we open the dir, and then readdir will not return the entry which index greater than the last index. >> >> Looking forward to your comments! > > Is this the same bug as https://bugzilla.kernel.org/show_bug.cgi?id=219094 ? Yes. > > >> Thanks, >> Erkun. >> >> >> >>> Thanks again for all your advise! >>>> >>>> Thanks. >>>> >>>>> >>>>> Signed-off-by: Yang Erkun >>>>> --- >>>>> tests/generic/736 | 2 +- >>>>> 1 file changed, 1 insertion(+), 1 deletion(-) >>>>> >>>>> diff --git a/tests/generic/736 b/tests/generic/736 >>>>> index d2432a82..9fafa8df 100755 >>>>> --- a/tests/generic/736 >>>>> +++ b/tests/generic/736 >>>>> @@ -18,7 +18,7 @@ _cleanup() >>>>> rm -fr $target_dir >>>>> } >>>>> >>>>> -_supported_fs generic >>>>> +_supported_fs generic ^tmpfs >>>>> _require_test >>>>> _require_test_program readdir-while-renames >>>>> >>>>> -- >>>>> 2.39.2 >>>>> >>>>> > > -- > Chuck Lever > >