Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp3973789pxv; Mon, 19 Jul 2021 13:19:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxmecf1RzU1Llh/69bju1SHRtHxem1T1to3K8oqa2fxhKgRBpyE41g2jpOZz2CYIfOdH4kT X-Received: by 2002:aa7:cd03:: with SMTP id b3mr36599288edw.112.1626725975275; Mon, 19 Jul 2021 13:19:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626725975; cv=none; d=google.com; s=arc-20160816; b=FzDP4ai80sAr97iboeytmm1ZQfPkkN6JdQYRiHjdZvii8CXf+p6pBhtrtWaH7B01U5 IgfkD3BVl72hNVEqWknJyjbILiHZn2W31m6yOnhtRXhRuQQltHpon+oCk4Y47CNqYxEj 3hzbREOIvwNtAttoS/KpcTGazhE3CChY2/nvcYnLGHZxrWG/oYP9wpLw/IpKOxPe288Z MXrke73L+Cvm7mM9X9K8K3hU541DrSKNs08f0kD+T9soxEmMjZAEcHktr7xfHqKry57Q DBjkgA8lRz8dZbU+cZLsLSPVOEOxSbt6ch1NIOiWi0rOMyIM3TGHORsHrPt4/zvAHcHY w7cQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature; bh=HpIVR41SNxxmrWQRPZx1Jc8kIHqT4zYLW1S+TZScing=; b=P47jpC5Z9462Ya6sdS+6aGorZsIk5sfaqzolzl6fJsyH7jzlXY8PrJcQJW3TxOJvYj Rq5xUm2DzfmaccUOC691JU4XZZldboT4ZHquJvvQpsoD+7iguqgmDoZgBcXIGtVm0eEv f1dHys/eD3gP1isacc3uD6DXkkVQImNvCuslM8BQ0LhiZO+MzdiKHrUCXlAfGkQBw/Q5 dRgL2qxu+7MehA/3K741dXPTqwEZd7QdeAGgNTDOAOpuAXBGDeYA4qebLm9jq3Kosqkh MyVq4zz5tkCvHEEZ4JsiXpgC7a18tVDJND+Mi0C5lV8qdhQGlnu+/HSNYvN4N73626k+ U4Vg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@dubeyko-com.20150623.gappssmtp.com header.s=20150623 header.b=EKWC7HyD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k22si14560791edx.205.2021.07.19.13.19.10; Mon, 19 Jul 2021 13:19:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@dubeyko-com.20150623.gappssmtp.com header.s=20150623 header.b=EKWC7HyD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1385337AbhGSS5b (ORCPT + 99 others); Mon, 19 Jul 2021 14:57:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1384532AbhGSSbN (ORCPT ); Mon, 19 Jul 2021 14:31:13 -0400 Received: from mail-qk1-x72c.google.com (mail-qk1-x72c.google.com [IPv6:2607:f8b0:4864:20::72c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92688C0613DB for ; Mon, 19 Jul 2021 12:01:46 -0700 (PDT) Received: by mail-qk1-x72c.google.com with SMTP id p202so17759763qka.12 for ; Mon, 19 Jul 2021 12:11:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dubeyko-com.20150623.gappssmtp.com; s=20150623; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=HpIVR41SNxxmrWQRPZx1Jc8kIHqT4zYLW1S+TZScing=; b=EKWC7HyDe1yb7k1ZElLzi1jjJHVyrpHbBo6xL9vTICFcPc5Cg4dtfBYmUOKqTm02zN kzofWlC/brSGeoi00EcZTIsvR8CoekX72V8ssgA8k+vf8OJNlZSF0g0ulOAtPzpZWFPD Z4JPmoSOXBoHUSQCxbdtMYYAXdBBtgBNwSuMS5dcwt+FoNUlgshudIQV1ZtRFGwsTLXj 6XGcmZ4QEMPnSM/QULEiR2YXV36XwRRI7MxKmSZQOwahRkO1Zj5WkRr8ZHpW30gXVIXz CrMV1vM0kDJXrTjuS05ZtAZeyWrB7JbiCHkFS2/XSTC83rxcE8PyY8tWr6LzGmm41jKc QgOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=HpIVR41SNxxmrWQRPZx1Jc8kIHqT4zYLW1S+TZScing=; b=kwb+OLKvDupQwwCFcnq1zdupXw18aJPna5wxTSJCuu0x0U6diUX5PqtQz7q22sVuwx 7vQc8qKvLka/GNwcvwLcuVuIB1eEndpGEgwW1lsjXPF+4FwNGdpgb/EDY1VmacNRNoPq rhtFHMH1kbHuzmxW9zzcr1XQtjsYbkLzDOzqwmYbWpguJOmtznm+NMhR/vmHYBlFxtEQ 7+ItGipb1+Al+2YotwNZkFTm48KWsK4OdEOzi8x9vaV6qQvo64JQ4gzs2xTU8njRG138 JvbG1GG+7AjVQ1KpmiQLP79bF1ySm86KoV8JsLqbIPaMz14ZOPniPrFTTzw54w/apeJL GcEw== X-Gm-Message-State: AOAM530AQLSoGJqj3fwOKMxyVmQt/w0S4WLkPeoH9cX1XS2GguEim7Ej n7sCzcOp1+d16DAqU7ymGosBug== X-Received: by 2002:a37:8e44:: with SMTP id q65mr26070129qkd.372.1626721910686; Mon, 19 Jul 2021 12:11:50 -0700 (PDT) Received: from smtpclient.apple ([2600:1700:42f0:6600:ec90:c991:5957:a3db]) by smtp.gmail.com with ESMTPSA id j2sm6276237qtn.46.2021.07.19.12.11.49 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Jul 2021 12:11:50 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.100.0.2.22\)) Subject: Re: [RESEND PATCH v2] hfsplus: prevent negative dentries when casefolded From: Viacheslav Dubeyko In-Reply-To: Date: Mon, 19 Jul 2021 12:11:47 -0700 Cc: Linux FS Devel , LKML , Al Viro , Andrew Morton , gustavoars@kernel.org, gregkh@linuxfoundation.org, keescook@chromium.org, mszeredi@redhat.com, shepjeng@gmail.com Content-Transfer-Encoding: quoted-printable Message-Id: References: <20210716073635.1613671-1-cccheng@synology.com> <02B9566C-A78E-42FB-924B-A503E4BC6D2F@dubeyko.com> To: Chung-Chiang Cheng X-Mailer: Apple Mail (2.3654.100.0.2.22) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Jul 19, 2021, at 2:03 AM, Chung-Chiang Cheng = wrote: >=20 > This function revalidates dentries without blocking and storing to the > dentry. As the document mentioned [1], I think it's safe in rcu-walk > mode. I also found jfs_ci_revalidate() takes the same approach. >=20 > d_revalidate may be called in rcu-walk mode (flags & = LOOKUP_RCU). > If in rcu-walk mode, the filesystem must revalidate the dentry = without > blocking or storing to the dentry, d_parent and d_inode should = not be > used without care (because they can change and, in d_inode = case, even > become NULL under us >=20 >=20 > [1] https://www.kernel.org/doc/Documentation/filesystems/vfs.txt >=20 I am still not convinced by the explanation. >> This patch takes the same approach to drop negative dentires as vfat = does.=20 You mentioned that you follows by vfat approach. But this code contains = this code, as far as I can see. How could you prove that we will not = introduce some weird bug here? What if code of this function will be = changed in the future? I suppose that missing of this code could be the = way to introduce some bug, anyway. >> touch aaa >> rm aaa >> touch AAA By the way, have you tested other possible combinations? I mean (1) = =E2=80=98aaa=E2=80=99 -> =E2=80=98AAA=E2=80=99, (2) =E2=80=98AAA=E2=80=99 = -> =E2=80=98aaa=E2=80=99, (3) =E2=80=98aaa=E2=80=99 -> =E2=80=98aaa=E2=80=99= , (4) =E2=80=98AAA=E2=80=99 -> =E2=80=98AAA=E2=80=99. Could you please = add in the comment that it was tested? Could we create the file in = case-insensitive mode and, then, try to delete in case-sensitive and = vise versa? Do we define this flag during volume creation? Can we change = the flag by volume tuning? Thanks, Slava. > Thanks, > C.C.Cheng >=20 >>> + >>> +int hfsplus_revalidate_dentry(struct dentry *dentry, unsigned int = flags) >>> +{ >> What=E2=80=99s about this code? >>=20 >> If (flags & LOOKUP_RCU) >> return -ECHILD; >>=20 >> Do we really need to miss it here? >>=20 >> Thanks, >> Slava. >>=20 >>=20 >>> + /* >>> + * dentries are always valid when disabling casefold. >>> + */ >>> + if (!test_bit(HFSPLUS_SB_CASEFOLD, = &HFSPLUS_SB(dentry->d_sb)->flags)) >>> + return 1; >>> + >>> + /* >>> + * Positive dentries are valid when enabling casefold. >>> + * >>> + * Note, rename() to existing directory entry will have = ->d_inode, and >>> + * will use existing name which isn't specified name by user. >>> + * >>> + * We may be able to drop this positive dentry here. But = dropping >>> + * positive dentry isn't good idea. So it's unsupported like >>> + * rename("filename", "FILENAME") for now. >>> + */ >>> + if (d_really_is_positive(dentry)) >>> + return 1; >>> + >>> + /* >>> + * Drop the negative dentry, in order to make sure to use the = case >>> + * sensitive name which is specified by user if this is for = creation. >>> + */ >>> + if (flags & (LOOKUP_CREATE | LOOKUP_RENAME_TARGET)) >>> + return 0; >>> + >>> + return 1; >>> +} >>> --=20 >>> 2.25.1 >>>=20