Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp5514967imw; Wed, 20 Jul 2022 07:12:54 -0700 (PDT) X-Google-Smtp-Source: AGRyM1s2eSeveCLMJNI6B1mEMrBCI9CC3Kkgrkm4vOImlUco2TWAyqn/WhUeEOvtq3j8wR5Kv3D1 X-Received: by 2002:a05:6870:581b:b0:10c:17cb:ebbd with SMTP id r27-20020a056870581b00b0010c17cbebbdmr2455962oap.131.1658326373889; Wed, 20 Jul 2022 07:12:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658326373; cv=none; d=google.com; s=arc-20160816; b=DrxOGNFZtEnyn0J50h97j++4JSZd1Y4qv70EMalLYmrLDHrxqoLurKwEZ69vzsxaVE byMctDx8izaaqHKu7UZ95eNpZP7hiB3UI9Iqx+e+Ap10Y5iHZEf+Bk1aIdAz8SAd+2V3 BYSX8h0yqZN18bAgDJhJ9b4v67JmrFyQiM12XyUAae3Dv7GHowJv78tvYlW+b/9mlr4b Ea/bjyqVIJN+ad6STi9OxZg6TS310OeR71kAVwNildL5+Rz3muksuTz7wggOx03kTCjn tXSwHX2/elnen68oTJ0K1kpKVjS+IIlSfku+RadzKXQYRwINY2VlRbtcN+EpgURfn2AE gqtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=FfBAUY2VINzd7/hZdmnYyQKs4GYCVpLDOLzWtysprLM=; b=XNLcvVaIl0lQtt/MxnF/P9XTXDH+fG8cWr7GMI7gqpSDO70hzMH8tqrxKPllg2GZVC GEeWsJo1QFqwy1F7dlJqxDhYeRlLrBF8SgPpt3Vzpkc6++lQUOmLuYKl+0l0e0PNmMrk +j/W+rLBH5Os4S8+ZN1L7u4K0WXefgNSTEjKmf6xJYHc9QJJLcq8zrjNZAxo9fPlOcd7 brjlETIpc52c/daB7492YUNmWewpb4yGMMmluQfAhAqFRClPoR6B6K95nB+mQyIEcPwe fql46D0SMnnZl1+xZ8gqwm1nsuABWx6GCynbFv9I81+QAnLLkLaP8cnv9H1fGzub/JTI D0MA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=ORLdWZ8K; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t23-20020a056870601700b00101ab2027a6si15912979oaa.167.2022.07.20.07.12.23; Wed, 20 Jul 2022 07:12:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=ORLdWZ8K; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232183AbiGTOL3 (ORCPT + 99 others); Wed, 20 Jul 2022 10:11:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231872AbiGTOL2 (ORCPT ); Wed, 20 Jul 2022 10:11:28 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0507B4C61D; Wed, 20 Jul 2022 07:11:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=FfBAUY2VINzd7/hZdmnYyQKs4GYCVpLDOLzWtysprLM=; b=ORLdWZ8K1zi4u+eqHrEEoZPAlF J/9/3ledj6TzPUeuBHfq2AMfjBXUZfYkSyJiBw5p70U1+23aQ3cVpXdbcQF0Qc1/o4NAA8p6Bi/JL bwspF0Fz4YpASZkAwFeGK1m1JLG4DiNpDcxt+VQgaSidzxzrURt/IU4HEeK4FK54gxXEXOIeHRdXa 7hO04XpiaQlCQahqDMoeHmo/gzquskHKEKe2FJAxcg0kT7DL2PgOyNDqxxOLU+WOH5P0Q+9CvnI18 5lMdaMfImFBqKWta9NRl1UEO5jJbNhRES215C9X8+2uBcgC90V7AKj3ihjUvoiDvxhkrW7efgVC7b YGIArIqg==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1oEAQ5-00EWYg-Jx; Wed, 20 Jul 2022 14:11:21 +0000 Date: Wed, 20 Jul 2022 15:11:21 +0100 From: Matthew Wilcox To: "Darrick J. Wong" Cc: Jeremy Bongio , Ted Tso , linux-ext4@vger.kernel.org, linux-api@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH v4] Add ioctls to get/set the ext4 superblock uuid. Message-ID: References: <20220719234131.235187-1-bongiojp@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Tue, Jul 19, 2022 at 08:30:57PM -0700, Darrick J. Wong wrote: > On Wed, Jul 20, 2022 at 04:18:51AM +0100, Matthew Wilcox wrote: > > On Tue, Jul 19, 2022 at 04:41:31PM -0700, Jeremy Bongio wrote: > > > +/* > > > + * Structure for EXT4_IOC_GETFSUUID/EXT4_IOC_SETFSUUID > > > + */ > > > +struct fsuuid { > > > + __u32 fsu_len; > > > + __u32 fsu_flags; > > > + __u8 fsu_uuid[]; > > > +}; > > > > A UUID has a defined size (128 bits): > > https://en.wikipedia.org/wiki/Universally_unique_identifier > > > > Why are we defining flags and len? > > @flags because XFS actually need to add a superblock feature bit > (meta_uuid) to change the UUID while the fs is mounted. That kind of > change can break backwards compatiblity, so we might want to make > *absolutely sure* that the sysadmin is aware of this: OK. So we'll define a 'force' flag at some point in the future. Got it. > @len because some filesystems like vfat have volume identifiers that > aren't actually UUIDs (they're u32); some day someone might want to port > vfat to implement at least the GETFSUUID part (they already have > FAT_IOCTL_GET_VOLUME_ID); and given the amount of confusion that results > when buffer lengths are implied (see [GS]ETFSLABEL) I'd rather this pair > of ioctls be explicit about the buffer length now rather than deal with > the fallout of omitting it now and regretting it later. Uhhh. So what are the semantics of len? That is, on SET, what does a filesystem do if userspace says "Here's 8 bytes" but the filesystem usually uses 16 bytes? What does the same filesystem do if userspace offers it 32 bytes? If the answer is "returns -EINVAL", how does userspace discover what size of volume ID is acceptable to a particular filesystem? And then, on GET, does 'len' just mean "here's the length of the buffer, put however much will fit into it"? Should filesystems update it to inform userspace how much was transferred? I think there was mention of a manpage earlier. And if this is truly for "volume ID" instead of "UUID", then lets call it "volume ID" and not "UUID" to prevent confusion.