From owner-freebsd-fs@freebsd.org Sun Nov 4 23:57:32 2018 Return-Path: Delivered-To: freebsd-fs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B7A3F10F1F9C for ; Sun, 4 Nov 2018 23:57:32 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from CAN01-TO1-obe.outbound.protection.outlook.com (mail-eopbgr670044.outbound.protection.outlook.com [40.107.67.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (Client CN "mail.protection.outlook.com", Issuer "GlobalSign Organization Validation CA - SHA256 - G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E740E8DA9D; Sun, 4 Nov 2018 23:57:31 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from YTOPR0101MB1162.CANPRD01.PROD.OUTLOOK.COM (52.132.50.155) by YTOPR0101MB1212.CANPRD01.PROD.OUTLOOK.COM (52.132.43.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1294.21; Sun, 4 Nov 2018 23:57:30 +0000 Received: from YTOPR0101MB1162.CANPRD01.PROD.OUTLOOK.COM ([fe80::9c71:6eb6:1bff:727b]) by YTOPR0101MB1162.CANPRD01.PROD.OUTLOOK.COM ([fe80::9c71:6eb6:1bff:727b%3]) with mapi id 15.20.1294.032; Sun, 4 Nov 2018 23:57:30 +0000 From: Rick Macklem To: Andriy Gapon , Julian Elischer , Konstantin Belousov CC: FreeBSD Filesystems Subject: Re: How to fill in the fsid for file systems? Thread-Topic: How to fill in the fsid for file systems? Thread-Index: AQHUb557F1RNqdJl0kuwS+F5J/DjsKU2/twAgAGdwkKAAGQrgIAAehmGgAELs4CAATs6uIADh0gAgAB6NSyAAAkzgIAAhZMS Date: Sun, 4 Nov 2018 23:57:30 +0000 Message-ID: References: <20181030012240.GM5335@kib.kiev.ua> , <03f24451-c0d0-0701-0e00-b2ce0f946887@FreeBSD.org> In-Reply-To: <03f24451-c0d0-0701-0e00-b2ce0f946887@FreeBSD.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: yes X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=rmacklem@uoguelph.ca; x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; YTOPR0101MB1212; 6:UJS5pI6xlpjv5Y1oH5AvAHA4oXOz2qzz+Ki27f7ZuciZ9iXp1fSyTCxxcm3prg/FLdqy7ufKTEFjd+ZOhQYbuz0tJPTeSDc35x47kPr3QJpz9eNQk3KmSb+1EFLw2BlAA+bWftEBC+zUHzyNMiWo7LQyqVLArkGkPhPBf/DxHwG6Ctrtw6doPb2TKKHrWCqLDJh8TJoq1eXqMEn+R7lP/YDcv89D6WBse++/GmyBdkJeWFNwPyNPm7UcbC5B6P8l4sXzgmqpynQXHnNJu6E3IfQCvjV7xEe8E6OXR+w7Xye8n8fW84bPSgF/OsNJA6mH3+c/Uz4qQTnPKjhsUWznDD8YRjg8pgJK5QeSUcQUI4aVBElkyh9SdkZ1cV8SHl+el9djC/wTKYCOIMdG5G89eDa5qYbapVfGF9K9sgChF0Fq95VNslPjoCTRJLCAFKDGg50x1v6RzA9Kt6djtdH/bQ==; 5:zFsvZcomgNHUnbW/L1pyElQ83mclqAkGpA1BabdsqolRql9c1E2HW+/cJK6lOFL8TS9jAKyVEeNlYAeFuIitRTy6qe0WPhRc9wR6RXQpCwdUb5jpOEOMKfDMFBwkhBjJSuA25prUVGTJxypsZXn/+MsRnUnyUGSidS931XIyo+E=; 7:YxqBfAmuIiBPWrSb97Dpvu7ZaWKcdTwVG+rEViCuqKGdpp6DRMgmbFrjscNFtw8qmAVa+GqvQfhFW53Fof0Z8E+vIg+cVuOAYrmgGSv3hValZ43QP2b9kpNvar6HgDo6YOem+4dD6W8A8E4VtFwjvw== x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-correlation-id: 9047a111-5d7d-48fe-5803-08d642b147ec x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(49563074)(7193020); SRVR:YTOPR0101MB1212; x-ms-traffictypediagnostic: YTOPR0101MB1212: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(102415395)(6040522)(2401047)(8121501046)(5005006)(3231382)(944501410)(4983020)(52105095)(3002001)(10201501046)(93006095)(93001095)(148016)(149066)(150057)(6041310)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201703131423095)(201702281529075)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991095); SRVR:YTOPR0101MB1212; BCL:0; PCL:0; RULEID:; SRVR:YTOPR0101MB1212; x-forefront-prvs: 084674B2CF x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(396003)(136003)(346002)(376002)(39860400002)(366004)(189003)(199004)(99286004)(316002)(14454004)(74316002)(39060400002)(81166006)(81156014)(478600001)(7696005)(55016002)(99936001)(9686003)(110136005)(53936002)(8936002)(97736004)(5660300001)(6246003)(76176011)(229853002)(786003)(8676002)(93886005)(74482002)(305945005)(6436002)(2906002)(6506007)(33656002)(25786009)(86362001)(4326008)(68736007)(186003)(71200400001)(71190400001)(46003)(446003)(486006)(476003)(11346002)(102836004)(106356001)(5024004)(14444005)(256004)(105586002)(2900100001); DIR:OUT; SFP:1101; SCL:1; SRVR:YTOPR0101MB1212; H:YTOPR0101MB1162.CANPRD01.PROD.OUTLOOK.COM; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: uoguelph.ca does not designate permitted sender hosts) x-microsoft-antispam-message-info: o43fNoP69O1sfUlclmyIrmj7WAvyNzt89COnzaPvqs3bB8+UhXVRu3dmaai3zKfxOtfAh3Wt/YTAb4NqveEFwo2NRK0+by9Skm4Eb4MYFjxT+NRHCvS9yi4y9r6K4k6SVno5ohj8s7E/xmY9XypmIfkSJjmbx4L+smQ0vRG+JTlipkhvxQscs2yR+HvFZJFv9B3pXHXznoDDSG5Gauzfz/6vPhmjiP72GlV7n1hxQ3G7G8G6NF1WrM++XSSJTqRlB2w3PhezOlupU7VgS6qfX1OwdyrSFgZpH6t2vq3itcplsNBHBP7Gnml4HiJSKgCFIwmxNvz6m9xV0xkbwjSnOhjXe9XMQtK03D4GFRc0IHw= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: multipart/mixed; boundary="_002_YTOPR0101MB116276DDB031C76E1F8B0560DDC90YTOPR0101MB1162_" MIME-Version: 1.0 X-OriginatorOrg: uoguelph.ca X-MS-Exchange-CrossTenant-Network-Message-Id: 9047a111-5d7d-48fe-5803-08d642b147ec X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Nov 2018 23:57:30.2351 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: be62a12b-2cad-49a1-a5fa-85f4f3156a7d X-MS-Exchange-Transport-CrossTenantHeadersStamped: YTOPR0101MB1212 X-Rspamd-Queue-Id: E740E8DA9D X-Spamd-Result: default: False [-1.68 / 200.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.95)[-0.950,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip4:40.107.0.0/17]; HAS_ATTACHMENT(0.00)[]; MIME_GOOD(-0.10)[multipart/mixed,text/plain]; DMARC_NA(0.00)[uoguelph.ca]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; MX_GOOD(-0.01)[cached: mx2.hc184-76.ca.iphmx.com]; NEURAL_HAM_SHORT(-0.86)[-0.865,0]; RCVD_IN_DNSWL_NONE(0.00)[44.67.107.40.list.dnswl.org : 127.0.3.0]; IP_SCORE(-0.56)[asn: 8075(-2.71), country: US(-0.07)]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; SUBJECT_ENDS_QUESTION(1.00)[]; ASN(0.00)[asn:8075, ipnet:40.64.0.0/10, country:US]; RCVD_TLS_LAST(0.00)[] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Nov 2018 23:57:32 -0000 --_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 W10gPSB7CiAJInJ3IiwKIAkibm9zdWlkIiwKIAkibm9leGVjIiwKKwkiZnNpZCIsCiAJTlVMTAog fTsKIApAQCAtODM4LDYgKzgzOSw5IEBAIHZmc19kb21vdW50X2ZpcnN0KAogCXN0cnVjdCBtb3Vu dCAqbXA7CiAJc3RydWN0IHZub2RlICpuZXdkcDsKIAlpbnQgZXJyb3I7CisJdWludDY0X3QgZnNp ZHZhbDsKKwljaGFyICpmc2lkc3RyLCAqZnNpZGVuZDsKKwlpbnQgZnNpZGxlbjsKIAogCUFTU0VS VF9WT1BfRUxPQ0tFRCh2cCwgX19mdW5jX18pOwogCUtBU1NFUlQoKGZzZmxhZ3MgJiBNTlRfVVBE QVRFKSA9PSAwLCAoIk1OVF9VUERBVEUgc2hvdWxkbid0IGJlIGhlcmUiKSk7CkBAIC04OTAsNiAr ODk0LDI4IEBAIHZmc19kb21vdW50X2ZpcnN0KAogCSAqIGdldC4gIE5vIGZyZWVpbmcgb2YgY25f cG5idWYuCiAJICovCiAJZXJyb3IgPSBWRlNfTU9VTlQobXAp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