Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 4 Nov 2018 23:57:30 +0000
From:      Rick Macklem <rmacklem@uoguelph.ca>
To:        Andriy Gapon <avg@FreeBSD.org>, Julian Elischer <julian@freebsd.org>, Konstantin Belousov <kostikbel@gmail.com>
Cc:        FreeBSD Filesystems <freebsd-fs@freebsd.org>
Subject:   Re: How to fill in the fsid for file systems?
Message-ID:  <YTOPR0101MB116276DDB031C76E1F8B0560DDC90@YTOPR0101MB1162.CANPRD01.PROD.OUTLOOK.COM>
In-Reply-To: <03f24451-c0d0-0701-0e00-b2ce0f946887@FreeBSD.org>
References:  <YTOPR0101MB11620BAF0E206EE36E927A5ADDF30@YTOPR0101MB1162.CANPRD01.PROD.OUTLOOK.COM> <20181030012240.GM5335@kib.kiev.ua> <YTOPR0101MB11621427AF47133A93311E16DDCD0@YTOPR0101MB1162.CANPRD01.PROD.OUTLOOK.COM> <e7813a64-59c2-67a1-3471-b32a6ca42ef8@FreeBSD.org> <YTOPR0101MB116207BA89FB66EE9B1AAF01DDCD0@YTOPR0101MB1162.CANPRD01.PROD.OUTLOOK.COM> <a831d660-1ed9-ef21-f457-8e1e986b96f2@FreeBSD.org> <YTOPR0101MB11621C0D5F4F4D9BED169110DDCF0@YTOPR0101MB1162.CANPRD01.PROD.OUTLOOK.COM> <c98b999c-c4b8-55fe-adef-ac53e439487b@freebsd.org> <YTOPR0101MB1162A8CA4B3AAF230E73158DDDC90@YTOPR0101MB1162.CANPRD01.PROD.OUTLOOK.COM>, <03f24451-c0d0-0701-0e00-b2ce0f946887@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
--_002_YTOPR0101MB116276DDB031C76E1F8B0560DDC90YTOPR0101MB1162_
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

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 th=
e 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 b=
e
>exactly the same (provided no modification of the source and the target af=
ter
>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 GUID=
s
>would still be different.
Cool. Assuming the duplicated file system created via zfs send + zfs recv s=
till
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=3DN" mount option is in
D17839. I've also attached it to this message in case that is easier.
(It currently doesn't allow fsid=3DN 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 t=
ime between
      when VFS_MOUNT() sets the mnt_stat.f_fsid and when the mount structur=
e is=20
      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 wo=
uldn't be
      easy to fix.


--_002_YTOPR0101MB116276DDB031C76E1F8B0560DDC90YTOPR0101MB1162_
Content-Type: application/octet-stream; name="setfsid.patch"
Content-Description: setfsid.patch
Content-Disposition: attachment; filename="setfsid.patch"; size=2608;
	creation-date="Sun, 04 Nov 2018 23:54:10 GMT";
	modification-date="Sun, 04 Nov 2018 23:54:10 GMT"
Content-Transfer-Encoding: base64

LS0tIGtlcm4vdmZzX21vdW50LmMubm9mc2lkCTIwMTgtMDktMjkgMDE6MTM6MzQuNTIzMjQwMDAw
IC0wNDAwCisrKyBrZXJuL3Zmc19tb3VudC5jCTIwMTgtMTEtMDQgMjI6NDk6NDYuNjE0MDA3MDAw
IC0wNTAwCkBAIC0xMTAsNiArMTEwLDcgQEAgc3RhdGljIGNvbnN0IGNoYXIgKmdsb2JhbF9vcHRz
W10gPSB7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ltb3VudCAqdmZzX2J1c3lmcyhmc2lkX3QgKik7Cg==

--_002_YTOPR0101MB116276DDB031C76E1F8B0560DDC90YTOPR0101MB1162_--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?YTOPR0101MB116276DDB031C76E1F8B0560DDC90>