How to fill in the fsid for file systems?
Rick Macklem
rmacklem at uoguelph.ca
Sun Nov 4 23:57:32 UTC 2018
Andriy Gapon wrote:
>On 04/11/2018 17:38, Rick Macklem wrote:
>> That leaves ZFS, which is what I was asking.
>> I don't understand the ZFS code well enough to understand what
>> dmu_objset_fsid_guid() is doing to get the fsid. I also don't know if the value
>> changes for snaphots of the same file system?
>> - If it does ever change, then that is the usage case for this option.
>
>A good ZFS example is this.
>A filesystem is duplicated using zfs send + zfs recv. The content would be
>exactly the same (provided no modification of the source and the target after
>the duplication), but GUIDs of the source and target would be different. The
>latter is required because the source and the target could be in the same pool.
>But even if they are in different pools (and different machines), the GUIDs
>would still be different.
Cool. Assuming the duplicated file system created via zfs send + zfs recv still
has the same fid for any given file (the stuff used by zfs_fid() stays the same
for any given file in the file system), then this would be good use case.
It will need some ZFS magic to make a generic fs mount option work for ZFS.
Maybe you can do that?
The current patch I have for adding a generic "fsid=N" mount option is in
D17839. I've also attached it to this message in case that is easier.
(It currently doesn't allow fsid=N to be used during an update "mount -u".
This made sense to me, since an fsid shouldn't change, but if others think
it should be changeable via "mount -u" the patch can easily be changed.)
rick
ps: I did notice the code is "slightly racy" in that there is a period of time between
when VFS_MOUNT() sets the mnt_stat.f_fsid and when the mount structure is
entered in the mountlist, where another mount could happen using the same
mnt_stat.f_fsid value, but that has been there for a long time and wouldn't be
easy to fix.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: setfsid.patch
Type: application/octet-stream
Size: 2608 bytes
Desc: setfsid.patch
URL: <http://lists.freebsd.org/pipermail/freebsd-fs/attachments/20181104/c4cc0612/attachment.obj>
More information about the freebsd-fs
mailing list