Re: [PATCH RFC v2] fhandle: expose u64 mount id to name_to_handle_at(2)

From: Trond Myklebust
Date: Mon May 27 2024 - 11:47:51 EST


On Mon, 2024-05-27 at 15:17 +0200, Christian Brauner wrote:
>
> Returning the 64bit mount id makes this race-free because we now have
> statmount():
>
> u64 mnt_id = 0;
> name_to_handle_at(AT_FDCWD, "/path/to/file", &handle, &mnt_id, 0);
> statmount(mnt_id);
>
> Which gets you the device number which one can use to figure out the
> uuid without ever having to open a single file (We could even expose
> the
> UUID of the filesystem through statmount() if we wanted to.).
>

It is not race free. statmount() depends on the filesystem still being
mounted somewhere in your namespace, which is not guaranteed above.

--
Trond Myklebust
Linux NFS client maintainer, Hammerspace
trond.myklebust@xxxxxxxxxxxxxxx