From patchwork Tue Feb 6 20:18:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kent Overstreet X-Patchwork-Id: 197632 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp1799069dyb; Tue, 6 Feb 2024 12:20:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IGvlq1LqKVBbzOCWCBd7Pf5qt3uwVhPdi2gA9lDM+WmLez3dFRNgYfiOKXpJ6boqS4xe7Xf X-Received: by 2002:a17:902:ea0d:b0:1d9:53ca:e651 with SMTP id s13-20020a170902ea0d00b001d953cae651mr2849326plg.33.1707250819779; Tue, 06 Feb 2024 12:20:19 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707250819; cv=pass; d=google.com; s=arc-20160816; b=vem9aqIsomcPl02nQWZAD860KpPdkSdXupz7TrtUL2JgjMqF6xopVLd70LBQAAt2CC AlGuIyWqm6Ro5stxurBCnLGDgXHf+M52npLFYwbE5PM1BdqZmyO7SDwFBgE6dzy0qKu+ eIeFm0IHM3Y/hJdeVHKixc5xBX/jlxQs206P2wbJJdClyYbgsMbJdIoeMb/bKmgq42QE MeZQVtyyPw+PBLf1XKG6a6nj59q7zGC5OlETOlI12UEpZxG9HfGPh9pmeREzMrdfT5LU QMh3E2hDsj2yE5WjC4bssTsE+0uaKAHG8p8gaJKE3APQs9Ze57Wy1L8Dvnvu+SNLUIqM nLnw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=UNJ5lQuPym878v0er8vpFPNJuyo1lBu3+aim1D8jyPw=; fh=t33oqpI/IWd2WyS9yT7d2zrOolSEaVbVjKN5XKW/uDQ=; b=jU1e6CzEkYH9lx/Wl3o/R3ygZPCTZgXfqRjRlQVRHtsJJIvAi6V3Hpjl9s0mCEiIyh u/Fg+I9S/JtlAhIgT9AlLR+8vYRuNdyoFsRhePKQZsTeCcnQKyVl4LaVv9KG8TKi5alr wdTFS1UYMJz20gKBtg+jxAHnO+Jwyn1scVBHm/uiMiWrXWRvXmNelVLoRRWtsNDvARea FIeZUqGtOdHu1P/JAUTBZpYSqIzr9DZ/lUj8KDhen41lA6DyBttObG/FcRQcuSG/E6+5 VKnq4Vlg1fdKYYuCQlK3OHIzzWSmmMJWvAFy47IUL1HeWS1MQR/lQBJqf1UdkNlPPPkr MZHQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=OhqAo2ny; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-55583-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-55583-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev X-Forwarded-Encrypted: i=1; AJvYcCU3K48+yK//CsB8QT5svM9bcH286vaCM9hE1bRPTLD0J/1ZxLz12t/XTDL5cyV0cwcTdsEI2eHaizLMBLnjcP5xbW53gA== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id j8-20020a170903024800b001d8b5747fd3si2183260plh.228.2024.02.06.12.20.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 12:20:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-55583-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=OhqAo2ny; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-55583-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-55583-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 8F3AE287623 for ; Tue, 6 Feb 2024 20:20:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E115E1BDE2; Tue, 6 Feb 2024 20:19:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="OhqAo2ny" Received: from out-186.mta0.migadu.com (out-186.mta0.migadu.com [91.218.175.186]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 56D6617BA3 for ; Tue, 6 Feb 2024 20:19:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.186 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707250753; cv=none; b=EZViW/SyLw6ibdmunW95JbXJcktjAEJtd52KvK1LZcKIR5uSfPyqYJoFtXiGM6H+jB00M0HxsJ7sdm13+SKhp6zaArjp36Aw42HaPSs/xGM2pDOQzL06ciqODAXEUqtV/FQR2jxV285ao7/oz+xmGKc0Aft1wHtJOR0a7H3YD7Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707250753; c=relaxed/simple; bh=n3McJjJh/WLCQm3zWRum7CJcJhpjLROkO/Uv6o5ddcM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hOrvNkme+/GuRytXWglxwMuoWyQdWELkkZ94VffVn8iHMaVVaL9aec8HVvpnOFfnLVNqD9LknZvanDOKKFY0xfOW6+W0GfHGJ38/OfWM2tJPXR3iS8VY/w3mcFUtQ0Dfveb+3t3R8Tt0rgU0/zUTc/6XhiYsUDNiDKOo6cE5s9Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=OhqAo2ny; arc=none smtp.client-ip=91.218.175.186 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1707250749; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UNJ5lQuPym878v0er8vpFPNJuyo1lBu3+aim1D8jyPw=; b=OhqAo2nyn+QVkXwlDoLVABeH4M1vXv0DMDYC6gNSNbDYa5Rd5PtFfzkmSkyMfI8nk8/BK5 TM0nhld+LO/gbU7Str1jdj+3e7cCMVMy8aBV8ig2dfLFKrtgcjW4moH2uS4NIvuoJkMftz Q7wFSn7haiI7X3b8Mklge47WtX3EAqI= From: Kent Overstreet To: brauner@kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Kent Overstreet , Miklos Szeredi , Amir Goldstein , linux-unionfs@vger.kernel.org Subject: [PATCH v2 2/7] overlayfs: Convert to super_set_uuid() Date: Tue, 6 Feb 2024 15:18:50 -0500 Message-ID: <20240206201858.952303-3-kent.overstreet@linux.dev> In-Reply-To: <20240206201858.952303-1-kent.overstreet@linux.dev> References: <20240206201858.952303-1-kent.overstreet@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790182235538656969 X-GMAIL-MSGID: 1790182235538656969 We don't want to be settingc sb->s_uuid directly anymore, as there's a length field that also has to be set, and this conversion was not completely trivial. Signed-off-by: Kent Overstreet Cc: Miklos Szeredi Cc: Amir Goldstein Cc: linux-unionfs@vger.kernel.org --- fs/overlayfs/util.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/fs/overlayfs/util.c b/fs/overlayfs/util.c index 0217094c23ea..f1f0ee9a9dff 100644 --- a/fs/overlayfs/util.c +++ b/fs/overlayfs/util.c @@ -760,13 +760,14 @@ bool ovl_init_uuid_xattr(struct super_block *sb, struct ovl_fs *ofs, const struct path *upperpath) { bool set = false; + uuid_t uuid; int res; /* Try to load existing persistent uuid */ - res = ovl_path_getxattr(ofs, upperpath, OVL_XATTR_UUID, sb->s_uuid.b, + res = ovl_path_getxattr(ofs, upperpath, OVL_XATTR_UUID, uuid.b, UUID_SIZE); if (res == UUID_SIZE) - return true; + goto success; if (res != -ENODATA) goto fail; @@ -794,14 +795,14 @@ bool ovl_init_uuid_xattr(struct super_block *sb, struct ovl_fs *ofs, } /* Generate overlay instance uuid */ - uuid_gen(&sb->s_uuid); + uuid_gen(&uuid); /* Try to store persistent uuid */ set = true; - res = ovl_setxattr(ofs, upperpath->dentry, OVL_XATTR_UUID, sb->s_uuid.b, + res = ovl_setxattr(ofs, upperpath->dentry, OVL_XATTR_UUID, uuid.b, UUID_SIZE); if (res == 0) - return true; + goto success; fail: memset(sb->s_uuid.b, 0, UUID_SIZE); @@ -809,6 +810,9 @@ bool ovl_init_uuid_xattr(struct super_block *sb, struct ovl_fs *ofs, pr_warn("failed to %s uuid (%pd2, err=%i); falling back to uuid=null.\n", set ? "set" : "get", upperpath->dentry, res); return false; +success: + super_set_uuid(sb, uuid.b, sizeof(uuid)); + return true; } bool ovl_path_check_dir_xattr(struct ovl_fs *ofs, const struct path *path,