Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp5772085imw; Wed, 20 Jul 2022 12:11:57 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vjNUcnzlgiAbHYJ9X8eyRvMi4nfMh2NboAxpSnFp/465d5fUryd4RfL36RHKKJKxUuXpMu X-Received: by 2002:a05:6402:212:b0:43b:5419:f89b with SMTP id t18-20020a056402021200b0043b5419f89bmr30195153edv.9.1658344317431; Wed, 20 Jul 2022 12:11:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658344317; cv=none; d=google.com; s=arc-20160816; b=OFjY8yOeNpAx8HOpt9bpqnMN1QoCNWDL8sSt1u6hipIkXFBisp7PBdeRozpefZRz+9 ewnFLaf0+s4oimgaK/pVYBcH7ftyvPWzZc0PozQBrFNGrzf1pQxW+q1apLOSkd8fKzt9 6d8Yaz3YeIG8OMCdwf+T14kPnxwTdRHcQ1HZl7KQdow2KXu9M4uwjbVaaMgbcn7sYVVh PvlULTUbwzY7C0LctxTbjuN3T1JGE9za/d9wS77064KDpSJIF9LvRkQLHjM4YlIIvd4m z8vhrXGdudzyPYuCMt4ICKHusnwho9MGIRkiZUKT74681CcNO1crqqHkWcm44inTo3+g rtcg== 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=ipGaRjwQ4nH9+jZ3xFTf6qP2G+zhiq/i4K2Jn73V01c=; b=FELu9boXpKJ5bi7YznQtKlddiWBZSXzOoJ0avnqfyVnyP/jloBFMH/RYg/oWljeBjQ clTSxAmoTS5/V7OLgZw8Vg+miZ3IIMAO+C0flabH3tYdiMlRjotQnCv2T9JBTu3EB395 YCjWv6GaVjyjBhgNWAZWrhMD36TEL8uWBJ5sk4pELU86JfKMduFtBLwpFc17oAFPBt6D GLv+Xe/apv4gk9iliOl8IVwivJKzS7aw1aDluQ6t318RLCb7Ogkd+ZQxMfpZmFvj3Myz wwmyKhwgAYaSJ9Yo/7X0RLBaQ/lC0xyCc/dGWATtb4tEdN0RZITWJNawsszrneAjR8lj cBUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=cF96UzV6; 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 f20-20020a056402355400b0043a91617ae1si23687079edd.382.2022.07.20.12.11.24; Wed, 20 Jul 2022 12:11:57 -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=cF96UzV6; 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 S232429AbiGTTJK (ORCPT + 99 others); Wed, 20 Jul 2022 15:09:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49380 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232557AbiGTTJG (ORCPT ); Wed, 20 Jul 2022 15:09:06 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9796B664E5; Wed, 20 Jul 2022 12:09:04 -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=ipGaRjwQ4nH9+jZ3xFTf6qP2G+zhiq/i4K2Jn73V01c=; b=cF96UzV6r4vdnjnMeSb5pvMJ+7 hC55QhofmMGLiXuOdUQ/Ovzd0qL4u4ELLUd+hDrEcVyYEfgex1obdE8sxHjz5RgRe0l8jie/QNCVa n4kDifmk+I2U3aPo6q66qg25E9cBUyDTUbkXmQSbhSVPHC+8GSXuMxU5J73ffYvbl16sCZYbqFIMa roHuDxffqPLpsGTqeo5DYZtn1ZXnjEb0lGoZLx79VgbzRwgOEPpQ9XpjGyLX7kOcBBXCNwEHr46eL hATaojekWZBusuVJwvpFCtpG2SO535mDZ2gFvjijo1cPU6P7sMBY4ddCI3TnwuBtRvH2BGjiIWj8d zQ/WKt8w==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1oEF46-00EiXK-86; Wed, 20 Jul 2022 19:08:58 +0000 Date: Wed, 20 Jul 2022 20:08:58 +0100 From: Matthew Wilcox To: "Darrick J. Wong" Cc: Theodore Ts'o , 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 11:47:08AM -0700, Darrick J. Wong wrote: > On Wed, Jul 20, 2022 at 07:27:02PM +0100, Matthew Wilcox wrote: > > 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. > > I'd suggest something different -- calling the getfsuuid ioctl with a > null argument should return the filesystem's volid/uuid size as the > return value. If userspace supplies a non-null argument, then fsu_len > has to match the filesystem's volid/uuid size or else you get EINVAL. Or userspace passes in 0 for the len and the filesystem returns -EINVAL and sets ->len to what the valid size would be? There's a few ways of solving this.