Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp5743603imw; Wed, 20 Jul 2022 11:34:55 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uyeL4/km/olD7ozEjBsvzx58pdlTD5BNz4DdoM4dZfEjEFqZXYOjr8hetTItej0V3iB486 X-Received: by 2002:a17:907:60c7:b0:72e:d01f:b884 with SMTP id hv7-20020a17090760c700b0072ed01fb884mr32879482ejc.550.1658342095620; Wed, 20 Jul 2022 11:34:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658342095; cv=none; d=google.com; s=arc-20160816; b=enCizfNktRufR17siKwJxOL8e/wl1xqeckLRetd9wHrF5gVWj7z1RirxlYGNWzt5lc wkcWtAoOP5c8P5qwLYoUjXkkAc+VuFKXO8ylzHydtNurMRUYzTATPUqRYSSx2F4g/qPC 8Z2tbRRS8SyOOB/pKNHzTwJvu46pIrXSz0eGHztJeA2fDpuJf5GydFJFPLz3acx/y6VU 7fRSpcUcirJZLOuC9yQgZJhlr4Qy4jAPbcEniPDzTbkK6oPZpUnfxo33TtDkadeQQPSK 5Bi3EhweC2WolJsSOKimz34uYkh/F6nl2S0JLdEgNqzwZOzMVdiJV/3vGpbpC1JKVoQp igEw== 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=mRXw6tVbG1xi5xP9es+D9NEYgmnCt2nLwBhAxVuKwoc=; b=Ix6v/qHyUbcfOLsHXjGCwAn5R/il5zd3nTvAwCOxf18nzlCULjr5WDKsbt0qNTWAVi /I76JBR0kr2lBllu8oRNQtUuuAzThuvtfLOOfUPExgfcyq4NlsyN7YzHbQ0E7ghs0a2M Wy7Sa/z+d6KSvm+Eys30aKtwtfkg4n6ybKVua3sh2VZ4z1qwPPmatKeqYjsa+3yRoMmh 8YkDkZyqfjoFYnCWZ68fdJ7ZvH0B7890M7JN/QaPzd75oSd3Ny6Cs0cFG69b2H2EFcDq SSEmzWoIklQ5EfW+l8LZ7aYc++QkM6oio3FpHZuL8qRFqsg7C1l1/zKkktdESRWfqrTM AecA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=CS1CqvW9; 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 yz14-20020a170906dc4e00b0072a8a36c34esi20638649ejb.358.2022.07.20.11.34.23; Wed, 20 Jul 2022 11:34:55 -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=CS1CqvW9; 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 S230025AbiGTS1L (ORCPT + 99 others); Wed, 20 Jul 2022 14:27:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229735AbiGTS1K (ORCPT ); Wed, 20 Jul 2022 14:27:10 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA3172253A; Wed, 20 Jul 2022 11:27:08 -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=mRXw6tVbG1xi5xP9es+D9NEYgmnCt2nLwBhAxVuKwoc=; b=CS1CqvW9djmlVwvpElr1pXFlNR y/+ZzIwbmmPy93oBlPhaNRZxAgeeCeebsLyPmhLHo9vYNwmO/8kEjDv/aDIbiZWMSfCZJILkQksgH 1dMU3ObU+MhUAHzzH5sJp5C6ei49WGySp/8h/TQODKPyg5h5Xhz5BRPN82XVuo2O8KxLi97OeYqOT avIfPskPV6ocjreg+CcybP9grMKR0tDwsYo/kd905JOvC3meQVS5wOEJFWICc5IinzFja13oLSVVm 2OhhwREhUkNhRvM9eCztrryUYoz7QARRxPo6EaHeyUd1usud9O9bSKco/YLHxEdPPicme5VwtxLIQ xwdqA9fA==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1oEEPW-00EgkK-9o; Wed, 20 Jul 2022 18:27:02 +0000 Date: Wed, 20 Jul 2022 19:27:02 +0100 From: Matthew Wilcox To: Theodore Ts'o Cc: "Darrick J. Wong" , Jeremy Bongio , 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 Wed, Jul 20, 2022 at 02:00:25PM -0400, Theodore Ts'o wrote: > On Wed, Jul 20, 2022 at 03:11:21PM +0100, Matthew Wilcox wrote: > > 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? > > What I'd suggest is that for GET, the length field when called should > be the length of the buffer, and if the length is too small, we should > return some error --- probably EINVAL or ENOSPC. If the buffer size > length is larger than what is needed, having the file system update it > with the size of the UUID that was returned. > > And this would be how the userspace can discover size of the UUID. In > practice, though, the human user is going to be suppliyng the UUID, > which means the *human* is going to have to understand that "oh, this > is a VFAT file system, so I need to give 32-bit UUID formatted as > DEAD-BEAF" or "oh, this is a ntfs file system, so I need to enter into > the command line a UUID formatted as the text string > A24E62F14E62BDA3". (The user might also end up having to ntfs or vfat > specific uuid changing tool; that's unclear at this point.) I think you covered all my questions there except for what happens if the user tried to set ext4 to 0xDEADBEEF; that should return -EINVAL? They could specify 0xDEADBEEF'00000000'00000000'00000000 or 0x00000000'00000000'00000000'DEADBEEF, but it'd be up to them to choose which one they wanted rather than have the filesystem pad it out for them? > As far as Jeremy's patch is concerned, I don't think we need to change > anything forthe SET ioctl, but for the GET util, it would be better in > the extremely unlikely case where the user pass in a length larger > than 16 bytes (say, 32), that we return the 16 byte UUID, and update > the length field to be 16 bytes. > > I don't think it's strictly necessary, since in practice there is no > reason why a file system's volume identifier would ever be larger than > 16 bytes --- the chances that we might need an extra 240 bytes to > specify a multiverse identifier seems.... unlikely. :-) Yes, 128 bits is sufficiently unique for this use case.