From: Miklos Szeredi on
On Thu, 08 Jul 2010, Aneesh Kumar K. V wrote:
> How about adding mnt_id to the handle ? Documentation file says it is
> unique
>
> (1) mount ID: unique identifier of the mount (may be reused after umount)
>
> I also updated (/proc/self/mountinfo) to carry the optional uuid field
> With the below patch i get in /proc/self/mountinfo
>
> 13 1 253:0 / / rw,relatime,uuid:9b5af62a-a34a-43f6-a5bb-1cc22d97e862 - ext3 /dev/root rw,errors=continue,barrier=0,data=writeback
>
> And the handle returns the value 13 in mnt_id field. We should able to
> lookup mountinfo with mnt_id and find the corresponding uuid.
>
> diff --git a/fs/namespace.c b/fs/namespace.c
> index 88058de..498bd9a 100644
> --- a/fs/namespace.c
> +++ b/fs/namespace.c
> @@ -871,6 +871,9 @@ static int show_mountinfo(struct seq_file *m, void *v)
> if (IS_MNT_UNBINDABLE(mnt))
> seq_puts(m, " unbindable");
>
> + /* print the uuid */
> + seq_printf(m, ",uuid:%pU", mnt->mnt_sb->s_uuid);
> +

This should be

seq_printf(m, " uuid:%pU", mnt->mnt_sb->s_uuid);

Thanks,
Miklos
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Andreas Dilger on
On 2010-07-08, at 06:21, Neil Brown wrote:
> On Thu, 08 Jul 2010 16:10:09 +0530
> "Aneesh Kumar K. V" <aneesh.kumar(a)linux.vnet.ibm.com> wrote:
>> How about adding mnt_id to the handle ? Documentation file says it is unique
>>
>> (1) mount ID: unique identifier of the mount (may be reused after umount)

But this value is not persistent across a reboot, or even an umount/mount so it is not useful as an identifier.

I suppose one way to resolve this issue is to just allow the underlying filesystem to supply a completely opaque filehandle to userspace. For local filesystems that don't care about persistence or uniqueness between nodes they can use something like mount_id, and for distributed/clustered filesystems they can include a globally-unique identifier.

Cheers, Andreas





--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Aneesh Kumar K. V on
On Fri, 9 Jul 2010 12:42:42 -0600, Andreas Dilger <adilger(a)dilger.ca> wrote:
> On 2010-07-08, at 06:21, Neil Brown wrote:
> > On Thu, 08 Jul 2010 16:10:09 +0530
> > "Aneesh Kumar K. V" <aneesh.kumar(a)linux.vnet.ibm.com> wrote:
> >> How about adding mnt_id to the handle ? Documentation file says it is unique
> >>
> >> (1) mount ID: unique identifier of the mount (may be reused after umount)
>
> But this value is not persistent across a reboot, or even an
> umount/mount so it is not useful as an identifier.


mount id should not be looked at as a persistent identifier. It should
be used to derive a persistent identifier from /proc/self/mountinfo. The
persistent identifier could be the combination of device properties,
file system properties or the uuid which is going to be an optional
tag in /proc/self/mountinfo.

This also implies we need to hold a reference in the mount to make sure
we can safely lookup uuid using mount id.

>
> I suppose one way to resolve this issue is to just allow the
> underlying filesystem to supply a completely opaque filehandle to
> userspace. For local filesystems that don't care about persistence or
> uniqueness between nodes they can use something like mount_id, and for
> distributed/clustered filesystems they can include a globally-unique
> identifier.


We could use mountid to get the persistent id from mountinfo right ? So
file handle request would include

fd = open(name);
file_handle = fd_to_handle(fd);
fs_uuid = get_uuid(file_handle.mnt_id);
close(fd);

So for your usecase the handle send to other nodes include will include
cluster_fs_uuid and file_identifier.

-aneesh


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/