Linux-api Archive mirror
 help / color / mirror / Atom feed
From: Ian Kent <raven@themaw.net>
To: Ian Kent <ikent@redhat.com>, Miklos Szeredi <miklos@szeredi.hu>,
	Florian Weimer <fweimer@redhat.com>
Cc: libc-alpha@sourceware.org, linux-man <linux-man@vger.kernel.org>,
	Alejandro Colomar <alx@kernel.org>,
	Linux API <linux-api@vger.kernel.org>,
	linux-fsdevel@vger.kernel.org, Karel Zak <kzak@redhat.com>,
	David Howells <dhowells@redhat.com>,
	Christian Brauner <christian@brauner.io>,
	Amir Goldstein <amir73il@gmail.com>,
	Arnd Bergmann <arnd@arndb.de>
Subject: Re: proposed libc interface and man page for statmount(2)
Date: Tue, 21 Nov 2023 09:33:36 +0800	[thread overview]
Message-ID: <bcbc0c84-0937-c47a-982c-446ab52160a2@themaw.net> (raw)
In-Reply-To: <c3209598-c8bc-5cc9-cec5-441f87c2042b@themaw.net>

On 21/11/23 09:12, Ian Kent wrote:
> On 21/11/23 08:58, Ian Kent wrote:
>> On 21/11/23 07:56, Ian Kent wrote:
>>> On 20/11/23 20:34, Miklos Szeredi wrote:
>>>> On Mon, Nov 20, 2023 at 01:16:24PM +0100, Florian Weimer wrote:
>>>>> Is the ID something specific to the VFS layer itself, or does it come
>>>>> from file systems?
>>>> It comes from the VFS.
>>>>
>>>>
>>>>> POSIX has a seekdir/telldir interface like that, I don't think file
>>>>> system authors like it.  Some have added dedicated data structures 
>>>>> for
>>>>> it to implement somewhat predictable behavior in the face of 
>>>>> concurrent
>>>>> directory modification.  Would this interface suffer from similar
>>>>> issues?
>>>> The same issue was solved for /proc/$$/mountinfo using cursors.
>>>
>>> The mounts are now using an rb-tree, I think the the cursor solution 
>>> can
>>>
>>> only work for a linear list, the case is very different.
>>>
>>>
>>>>
>>>> This patchset removes the need for cursors, since the new unique 
>>>> mount ID can be
>>>> used to locate the current position without having to worry about 
>>>> deleted and
>>>> added mounts.
>>>
>>> IIRC the problem with proc mounts traversals was because the lock 
>>> was taken
>>>
>>> and dropped between reads so that mount entries could be deleted 
>>> (not sure
>>>
>>> adding had quite the same problem) from the list in between reads.
>>>
>>>
>>> Sounds like I'll need to look at the code but first though but an 
>>> rb-tree
>>>
>>> can have mounts removed and new mounts inserted if the locks are 
>>> dropped
>>>
>>> if the retrieval is slit between multiple calls.
>>>
>>>
>>> So I'm struggling to see why this isn't the same problem and I don't 
>>> think
>>>
>>> introducing cursors in this case would work (thankfully, lets do 
>>> this again
>>>
>>> please).
>>
>> Mmm ... apologies for the poor description above.
>>
>> That last bit is definitely "lets 'not' do this again please!"
>
> IMHO keeping it simpler is much better.
>
>
> The interface where a buffer is passed and overflow returns an error 
> so that one
>
> can retry is far simpler and the in-kernel simplification of taking 
> the lock over
>
> the whole retrieval is far less problematic.
>
>
> If there's anything that could be useful then it's keeping a count of 
> the mounts
>
> in a given namespace (I think we have such a count in nsproxy struct 
> already) and
>
> adding a way to get that for storage needs estimation.

I've completely lost what we are talking about.


I think it was the introduction of listmount() earlier so my comment does

apply to that but it's getting just mount ids so the allocation isn't huge

even for a large number of mounts so I don't think there's a need for

complexity.


Then statmount() is retrieving the info for a single mount id, that's quite

specific info. and not that hard to estimate the needed allocation so the

error return and retry does seem like the most sensible thing.


The fact is that getting a list of mount ids and then working through them

meant you would be working with an outdated mounts list almost all the time.

That's nothing new for what this is used for and is sufficiently functional.


There are times when you do need a specific mount, such as SIGCHLD 
processing,

but then we are working with a specific mount id so it's not a problem.


>
>
> Ian
>
>

  reply	other threads:[~2023-11-21  1:33 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-15 15:08 proposed libc interface and man page for statmount(2) Miklos Szeredi
2023-11-16 20:12 ` Adhemerval Zanella Netto
2023-11-16 20:36 ` Florian Weimer
2023-11-16 21:01   ` Miklos Szeredi
2023-11-17 14:22     ` Miklos Szeredi
2023-11-17 14:47     ` Florian Weimer
2023-11-17 15:13       ` Miklos Szeredi
2023-11-17 15:50         ` Miklos Szeredi
2023-11-20 11:55           ` Miklos Szeredi
2023-11-20 12:16             ` Florian Weimer
2023-11-20 12:34               ` Miklos Szeredi
2023-11-20 23:56                 ` Ian Kent
2023-11-21  0:58                   ` Ian Kent
2023-11-21  1:12                     ` Ian Kent
2023-11-21  1:33                       ` Ian Kent [this message]
2023-11-21 19:42                         ` Miklos Szeredi
2023-11-21 20:42                           ` Zack Weinberg
2023-11-21 23:28                             ` Ian Kent
2023-11-22 16:18                               ` Zack Weinberg
2023-11-21 23:07                           ` Ian Kent
2023-11-22 10:18                           ` Christian Brauner
2023-11-20 15:38             ` Christian Brauner
2023-11-20 15:30         ` Christian Brauner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bcbc0c84-0937-c47a-982c-446ab52160a2@themaw.net \
    --to=raven@themaw.net \
    --cc=alx@kernel.org \
    --cc=amir73il@gmail.com \
    --cc=arnd@arndb.de \
    --cc=christian@brauner.io \
    --cc=dhowells@redhat.com \
    --cc=fweimer@redhat.com \
    --cc=ikent@redhat.com \
    --cc=kzak@redhat.com \
    --cc=libc-alpha@sourceware.org \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-man@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).