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 X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA425C4360D for ; Sat, 21 Sep 2019 17:19:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C895F2184C for ; Sat, 21 Sep 2019 17:19:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727243AbfIURTE (ORCPT ); Sat, 21 Sep 2019 13:19:04 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:57240 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726244AbfIURTE (ORCPT ); Sat, 21 Sep 2019 13:19:04 -0400 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92.2 #3 (Red Hat Linux)) id 1iBj2A-0008W4-GE; Sat, 21 Sep 2019 17:18:58 +0000 Date: Sat, 21 Sep 2019 18:18:58 +0100 From: Al Viro To: Linus Torvalds Cc: "zhengbin (A)" , Jan Kara , Andrew Morton , linux-fsdevel , "zhangyi (F)" , renxudong1@huawei.com, Hou Tao Subject: Re: [PATCH] Re: Possible FS race condition between iterate_dir and d_alloc_parallel Message-ID: <20190921171858.GA29065@ZenIV.linux.org.uk> References: <20190914170146.GT1131@ZenIV.linux.org.uk> <20190914200412.GU1131@ZenIV.linux.org.uk> <20190915005046.GV1131@ZenIV.linux.org.uk> <20190915160236.GW1131@ZenIV.linux.org.uk> <20190921140731.GQ1131@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On Sat, Sep 21, 2019 at 09:21:46AM -0700, Linus Torvalds wrote: > On Sat, Sep 21, 2019 at 7:07 AM Al Viro wrote: > > > > FWIW, #next.dcache has the straight conversion to hlist. It definitely > > wants at least nfsd, er... misconception dealt with, though: list_head > > or hlist, this > > Well, yeah. But is there really any downside except for the warning? > > Looks like the code should just do > > if (!simple_positive(dentry)) > continue; > > and just ignore non-positive dentries - whether cursors or negative > ones (which may not happen, but still). FWIW, I really want to do a unified helper for "rm -rf from kernel" kind of thing. We have too many places trying to do that and buggering it up in all kinds of ways. This is one of those places; I agree that the first step is to get rid of that WARN_ONCE, and it's the right thing to do so that two series would be independent, but it will need attention afterwards. > > No "take cursors out of the list" parts yet. > > Looking at the commits, that "take it off the list" one seems very > nice on its own. It actually seems to simplify the logic regardless of > the whole "don't need to add it to the end".. > > Only this: > > if (next) > list_move_tail(&cursor->d_child, &next->d_child); > else > list_del_init(&cursor->d_child); > > is a slight complication, and honestly, I think that should just have > its own helper function there ("dcache_update_cursor(cursor, next)" or > something). I want to see what will fall out of switching cursors to separate type - the set of primitives, calling conventions for those, etc. will become more clear once I have something to tweak. And I would rather use here the calling conventions identical to the final ones... > That helper function would end up meaning one less change in the hlist > conversion too. > > The hlist conversion looks straightforward except for the list_move() > conversions that I didn't then look at more to make sure that they are > identical, but the ones I looked at looked sane. BTW, how much is the cost of smp_store_release() affected by a recent smp_store_release() on the same CPU? IOW, if we have smp_store_release(p, v1); r = *q; // different cacheline smp_store_release(q, v2); how much overhead will the second smp_store_release() give?