|
|
Subscribe / Log in / New account

How is this an API quirk? It's normal and expected behaviour with file-handles in Unix.

How is this an API quirk? It's normal and expected behaviour with file-handles in Unix.

Posted Nov 5, 2025 11:19 UTC (Wed) by paulj (subscriber, #341)
Parent article: Namespace reference counting and listns()

> That is the sort of API quirk that nobody asked for and nobody intended to implement.

Isn't it entirely the expected and long-standing behaviour of filehandles? A user-space programme can acquire a file-handle for something, the object itself can be removed from any indexes that make it visible (e.g., where the file-handle references a file, the programme itself or another can delete the file-name entr{y,ies} from the filesystem), and the programme could if it wishes make the referred to object visible again (adding a file-name in the filesystem again for the file-handle).

This is entirely normal, expected behaviour with file-handles, the referenced object, and whatever generally queryable indices there may be of such objects (e.g. filesystems).

I think, at best, the author means this *normal behaviour* is - for some reason - not desired for namespaces. And the reason why namespaces are special, compared to other objects, should then have been explained.


to post comments

How is this an API quirk? It's normal and expected behaviour with file-handles in Unix.

Posted Nov 5, 2025 13:55 UTC (Wed) by corbet (editor, #1) [Link] (2 responses)

Please, do not confuse file handles with file descriptors. A file handle is best thought of, perhaps, as an alternative name for the file. Just as the possession of a file's name does not cause its persistence, holding a file handle doesn't keep a file around.

How is this an API quirk? It's normal and expected behaviour with file-handles in Unix.

Posted Nov 5, 2025 15:26 UTC (Wed) by paulj (subscriber, #341) [Link] (1 responses)

I stand corrected. So these are a new class of handles, distinct from file descriptors, as per open_by_handle_at, and with a separate struct in the kernel it appears. I didn't realise. Thanks.

How is this an API quirk? It's normal and expected behaviour with file-handles in Unix.

Posted Nov 5, 2025 15:46 UTC (Wed) by corbet (editor, #1) [Link]

They are new with regard to namespaces, but file handles are a fairly old concept; I think they had their origin with NFS many years ago.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds