Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2093318pxb; Sun, 18 Apr 2021 18:39:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJySIhzjCrZQdKfz2hzQf/dR0k8IMczUOfmi8FOXxBTSnlTbgCr4rYz8ZZcVWLioeV2Jgxal X-Received: by 2002:a63:e007:: with SMTP id e7mr9881486pgh.260.1618796383973; Sun, 18 Apr 2021 18:39:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618796383; cv=none; d=google.com; s=arc-20160816; b=dlfNSaz4SS1GqBSgANCX4ATqMK6W2JzuKZBRRveBi4Pdl5y4eUet1zEjMV8AxzJdW4 d0kBMtzk1jzr+s5v9CL2ikICQylaINbh51FLxEjponfkSEBz7HAvhDtNDLnQoLZyQuIt wnFkBadAqFsIwmaD1/3GXeLza4tvOA833kWZwhFNGyBTlyZE9J7/JAURkPXhnEXa9uWE bZ07x3ro+tQIIE2rk8hmob5Kf1oxqr9JcFt3ppJH7nYeW8Q7RHJdogPmu5K+1I9QWE4+ 8WR5MNWdfJOidvIskJ74CTCr6LmaPx69NxX+CqPZ16m0g58+F1sKVJ7/gR/Aua0/90at CwUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:references:in-reply-to :subject:cc:date:to:from; bh=EkConqG7nTdozInAuigQaJbxNn0jo8Y3Jil7M5vJ2jk=; b=M7Lo2LGKirGTM2ksPU+y5zBOaVTyFk/5VUmNujuTmty5V3WWFffkvciw+mjA8GOecQ xbBLOHgDSM+JHBNk/F58bcNDQlOe1QrxEeaLXhtRBIurc9XZ+3ai2t8p27EBCB/mT8GS L+hDPznE3bvq/c+eEuYUq1VJcO1c4z6jfJlbuKi58uIajASo79h1Pk0F5oT3xBLNO3ky mbGnhp3+X+9eWNtzzXWEMHm9GXV5gBn8iHI0L3M6WxfuLCH343r2kHljT9qlZtXSHaA8 ewTO6MvqgJPcCcENrCielCpUjKywRjuqCUaW+9sRwsY3T+PmejxVZwEybZoQD7thg6kE 0xew== ARC-Authentication-Results: i=1; mx.google.com; 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 i15si15048873pgj.431.2021.04.18.18.39.29; Sun, 18 Apr 2021 18:39:43 -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; 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 S233146AbhDSBh5 (ORCPT + 99 others); Sun, 18 Apr 2021 21:37:57 -0400 Received: from mx2.suse.de ([195.135.220.15]:56682 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232133AbhDSBh5 (ORCPT ); Sun, 18 Apr 2021 21:37:57 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 50ADFAC87; Mon, 19 Apr 2021 01:37:27 +0000 (UTC) From: NeilBrown To: Fox Chen Date: Mon, 19 Apr 2021 11:37:21 +1000 Cc: Fox Chen , corbet@lwn.net, vegard.nossum@oracle.com, viro@zeniv.linux.org.uk, rdunlap@infradead.org, grandmaster@al2klimov.de, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org Subject: Re: [PATCH v2 08/12] docs: path-lookup: update i_op->put_link and cookie description In-Reply-To: <20210316054727.25655-9-foxhlchen@gmail.com> References: <20210316054727.25655-1-foxhlchen@gmail.com> <20210316054727.25655-9-foxhlchen@gmail.com> Message-ID: <87y2df12cu.fsf@notabene.neil.brown.name> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Tue, Mar 16 2021, Fox Chen wrote: > No inode->put_link operation anymore. We use delayed_call to > deal with link destruction. Cookie has been replaced with > struct delayed_call. > > Related commit: commit fceef393a538 ("switch ->get_link() to > delayed_call, kill ->put_link()") > > Signed-off-by: Fox Chen > --- > Documentation/filesystems/path-lookup.rst | 30 ++++++----------------- > 1 file changed, 8 insertions(+), 22 deletions(-) > > diff --git a/Documentation/filesystems/path-lookup.rst b/Documentation/fi= lesystems/path-lookup.rst > index e6b6c43ff0f6..8ab95dd9046e 100644 > --- a/Documentation/filesystems/path-lookup.rst > +++ b/Documentation/filesystems/path-lookup.rst > @@ -1066,34 +1066,20 @@ method. This is called both in RCU-walk and REF-w= alk. In RCU-walk the > RCU-walk. Much like the ``i_op->permission()`` method we > looked at previously, ``->get_link()`` would need to be careful that > all the data structures it references are safe to be accessed while > -holding no counted reference, only the RCU lock. Though getting a > -reference with ``->follow_link()`` is not yet done in RCU-walk mode, the > -code is ready to release the reference when that does happen. > - > -This need to drop the reference to a symlink adds significant > -complexity. It requires a reference to the inode so that the > -``i_op->put_link()`` inode operation can be called. In REF-walk, that > -reference is kept implicitly through a reference to the dentry, so > -keeping the ``struct path`` of the symlink is easiest. For RCU-walk, > -the pointer to the inode is kept separately. To allow switching from > -RCU-walk back to REF-walk in the middle of processing nested symlinks > -we also need the seq number for the dentry so we can confirm that > -switching back was safe. > - > -Finally, when providing a reference to a symlink, the filesystem also > -provides an opaque "cookie" that must be passed to ``->put_link()`` so t= hat it > -knows what to free. This might be the allocated memory area, or a > -pointer to the ``struct page`` in the page cache, or something else > -completely. Only the filesystem knows what it is. > +holding no counted reference, only the RCU lock. A callback > +``struct delayed_called`` will be passed to get_link, I'd put a ":", not "," at the end of above line. > +file systems can set their own put_link function and argument through > +``set_delayed_call``. Later on, when vfs wants to put link, it will call () after function names please, both above and below. Also: "when VFS want to put the link" With these changes: Reviewed-by: NeilBrown Thanks, NeilBrown > +``do_delayed_call`` to invoke that callback function with the argument. >=20=20 > In order for the reference to each symlink to be dropped when the walk c= ompletes, > whether in RCU-walk or REF-walk, the symlink stack needs to contain, > along with the path remnants: >=20=20 > -- the ``struct path`` to provide a reference to the inode in REF-walk > -- the ``struct inode *`` to provide a reference to the inode in RCU-walk > +- the ``struct path`` to provide a reference to the previous path > +- the ``const char *`` to provide a reference to the to previous name > - the ``seq`` to allow the path to be safely switched from RCU-walk to R= EF-walk > -- the ``cookie`` that tells ``->put_path()`` what to put. > +- the ``struct delayed_call`` for later invocation. >=20=20 > This means that each entry in the symlink stack needs to hold five > pointers and an integer instead of just one pointer (the path > --=20 > 2.30.2 --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJCBAEBCAAsFiEEG8Yp69OQ2HB7X0l6Oeye3VZigbkFAmB83tEOHG5laWxiQHN1 c2UuZGUACgkQOeye3VZigbk79Q//d8vMY2hgQWHNxdc6tN/sWYseNntWofsHCAqo hOSC+X7VQZmttU7OwtR3/xE0L4mS4RA6aE+ji5p+94wLev2REow5s2NjKzdc8/Is btLgFg4W3hX2HqmIXAYmV2AEhnlFfBJgy90W54sN1X3+xRtq0vKINHVGmNsPmjHE otPXrwI7Nwq9bXIceThFl7oPNYzsmy8IA9gnQPFSKFAPJ95gSzqyTbfDA/rdqMG1 wYEsc0akHPgaUZxtB7fuweTqFW4z2QV+pC8+yBtwsNScSgZDNgviUmUbmYrNn5Np jC7K0hZijkzd4CTb6BvK8LVuq6XDJPu3RngBcdLvSlpunEbtHXSgYktIlIlIKrNb 7ywcKbidmDtMw4p89TjRIPs/EZDAavRqU/Nj9JVkuJj9A3nzuCZ8MUAFfmdP71aa pcftycbZGWoO148UkwqrgXK8yMQnLcV+hWs9Quf1w7+DReIdzEBp54nKYKmocg3Z jAwWqqVcMNtw8Mt4IF1Y8RJykZYSkwo+MrcmQGi/F7FuoLWuhcPDzT+k2CQhqzZW 5MLHJZ3QZehp72xGB9iJEQs5Ow5LAK1Ty6popqPbM0TTZB9rkxK94PuleqTrJbzW wFzzsYvyX52eMmhNeAryi6FVbMGNtREAPmxbt9LQdDSbtdg1ghxbIoS88tS7pMly 4jYolRo= =7t34 -----END PGP SIGNATURE----- --=-=-=--