Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp4664145rwb; Mon, 21 Nov 2022 10:13:42 -0800 (PST) X-Google-Smtp-Source: AA0mqf5Dw+MDUA46MJcqWL0LkQPdN112RoxxsfmUl4RH0qBZhkdlVQDqkHzUQ0gkalU/+4SWzohm X-Received: by 2002:a05:6402:2a09:b0:461:30d8:6742 with SMTP id ey9-20020a0564022a0900b0046130d86742mr17422811edb.172.1669054421924; Mon, 21 Nov 2022 10:13:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669054421; cv=none; d=google.com; s=arc-20160816; b=yJXoa/CtgUlmZCDujLUdex9LonB3lIHEfExaW6YNU4mZleHxhi+QDnXNiIy6C3zpf5 FCQuHg9HZTiXGRcl05VEmoy30GR29NV4hf+a3oKGyZqIfEJ9dDwUSEfVGloNhtEqvOdC zruXmu5gfHfqGwd5Ja1Bl+if8HOLmPjdf8imXgLLYiMEaZXaVDH3C9YxJgWZ8NSD6+ju 53GPROkvHoihDKcl9J3eXTxHLt09xMLKC28arWj0+VtmDwFQWleZAvIfCyZdDEvP+wBI JeTvhAAK21bZINegZdDY7SOdHxKmBT0mySqcdXIxQA6XauH/stzW8l0h1H9h46n4xKRj 0uzA== 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=iqeRaeUIst/Jy8ijea0V3wXahAp7O9Dk37gTRYnPo2Y=; b=xGwyijO7M4MMyqu9Q8hh3qrHdl+1oQAwp+S34AU7Ikndd5OJj1YLO/fxXHN70adnh+ gkQ9T0VbH+FSqaomu/7lyJhG4yYWI8yVu7XZUmbWSv9ippWAs2IgD4PjmXwEFPvjVqR7 VG1KlmCSyLJZoxiVq6P2iD6P/BLZpSqkfh0cJXqm+4qvUs7h3WQ1DkQRBLKebFLHM+Km QOGTIrl9ytXJRTzu9WAoN77DuQkFpFWn5lD/agcjl2ur7QaKxR/oG3xEP4SAE5AbKT0/ bnO/fFcp1oDVr9Sy/eEG1kTs3IwXVQiFJ5bi+/hwHR04a8RNMzld0d1HSCL+kWebnMCB tkYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Fbjpmu0a; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id wz12-20020a170906fe4c00b0078d2a84f2f8si8568202ejb.645.2022.11.21.10.13.09; Mon, 21 Nov 2022 10:13:41 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=Fbjpmu0a; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230305AbiKUSGC (ORCPT + 99 others); Mon, 21 Nov 2022 13:06:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229586AbiKUSGB (ORCPT ); Mon, 21 Nov 2022 13:06:01 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 108FC60342; Mon, 21 Nov 2022 10:06:00 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8507F613DC; Mon, 21 Nov 2022 18:06:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CF042C433D7; Mon, 21 Nov 2022 18:05:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669053959; bh=KcGeGgzdL/p3lg4gYpR7RzGwN+Oh/2fke6kb0RNFCo4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Fbjpmu0apb0B/gPVUQF/BOfrLTJh+BJHKq6ndxkoFyDbK5Dw0dtFpZ1RM7AWSl1jz OCCyuxnfS0wVLHqi5cUWvlaeNAO/457k8CArDDbq5TSlOkm3Rf8PQRSdcck+qhLJ7c qxWDuxG4vj9omLs7ES137q4KZfqmkBTHulCyz4OnbjyBUISyn9Pxyu1rMfYqR4rWur UfIY379UtRM3RrjaQOWcyahoT0UDJftQM8nx0IQZrM8uSK7PtnxYkoVegfuWxwgsId qLV6HsHNqeEaP2dtD5GDROTV9qxtgRX3E5KwRTtLMJs5A4/4ZOaJlvVi/hmoWNZVPc QJVPdWzbbMA8A== Date: Mon, 21 Nov 2022 10:05:59 -0800 From: "Darrick J. Wong" To: Catherine Hoang Cc: linux-xfs@vger.kernel.org, linux-ext4@vger.kernel.org Subject: Re: [PATCH v2 2/2] xfs: add FS_IOC_GETFSUUID ioctl Message-ID: References: <20221118211408.72796-1-catherine.hoang@oracle.com> <20221118211408.72796-3-catherine.hoang@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221118211408.72796-3-catherine.hoang@oracle.com> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 Fri, Nov 18, 2022 at 01:14:08PM -0800, Catherine Hoang wrote: > Add a new ioctl to retrieve the UUID of a mounted xfs filesystem. This is a > precursor to adding the SETFSUUID ioctl. > > Signed-off-by: Catherine Hoang > Reviewed-by: Allison Henderson LGTM, Reviewed-by: Darrick J. Wong --D > --- > fs/xfs/xfs_ioctl.c | 36 ++++++++++++++++++++++++++++++++++++ > 1 file changed, 36 insertions(+) > > diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c > index 1f783e979629..cf77715afe9e 100644 > --- a/fs/xfs/xfs_ioctl.c > +++ b/fs/xfs/xfs_ioctl.c > @@ -1865,6 +1865,39 @@ xfs_fs_eofblocks_from_user( > return 0; > } > > +static int > +xfs_ioctl_getuuid( > + struct xfs_mount *mp, > + struct fsuuid __user *ufsuuid) > +{ > + struct fsuuid fsuuid; > + __u8 uuid[UUID_SIZE]; > + > + if (copy_from_user(&fsuuid, ufsuuid, sizeof(fsuuid))) > + return -EFAULT; > + > + if (fsuuid.fsu_len == 0) { > + fsuuid.fsu_len = UUID_SIZE; > + if (copy_to_user(&ufsuuid->fsu_len, &fsuuid.fsu_len, > + sizeof(fsuuid.fsu_len))) > + return -EFAULT; > + return 0; > + } > + > + if (fsuuid.fsu_len < UUID_SIZE || fsuuid.fsu_flags != 0) > + return -EINVAL; > + > + spin_lock(&mp->m_sb_lock); > + memcpy(uuid, &mp->m_sb.sb_uuid, UUID_SIZE); > + spin_unlock(&mp->m_sb_lock); > + > + fsuuid.fsu_len = UUID_SIZE; > + if (copy_to_user(ufsuuid, &fsuuid, sizeof(fsuuid)) || > + copy_to_user(&ufsuuid->fsu_uuid[0], uuid, UUID_SIZE)) > + return -EFAULT; > + return 0; > +} > + > /* > * These long-unused ioctls were removed from the official ioctl API in 5.17, > * but retain these definitions so that we can log warnings about them. > @@ -2153,6 +2186,9 @@ xfs_file_ioctl( > return error; > } > > + case FS_IOC_GETFSUUID: > + return xfs_ioctl_getuuid(mp, arg); > + > default: > return -ENOTTY; > } > -- > 2.25.1 >