From patchwork Tue Feb 6 20:18:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kent Overstreet X-Patchwork-Id: 197639 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp1803396dyb; Tue, 6 Feb 2024 12:26:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IECaSe5/ayH/zcN3Y5NUjBVhnw+RwQHF/ZpVKGLW4d+kdDntrs5BRiDDimCv1NnsUjDuCvI X-Received: by 2002:a2e:8744:0:b0:2d0:af6e:3d5a with SMTP id q4-20020a2e8744000000b002d0af6e3d5amr2355087ljj.31.1707251203341; Tue, 06 Feb 2024 12:26:43 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707251203; cv=pass; d=google.com; s=arc-20160816; b=dLCt8cFPCV26YaA9EurptXpU1C3HJyWxDQsi+1WUcWbLRY402eHM8h6lJiDva3WfyC 1uKFTQqGVrZBWAylmAEmd0+0vflGquXdU7EW9kl+FictWpB0s96WGxuW/uAbtkzhinwT 3BDx0WnSKcAh0/WZfKdJKELmI3HysO7jjVm3T+alTotPIG7QByyIpSeUZ7lmDYjAr6a+ 9GmB9yW4bicdVl55rej0yKiI85PvUA2L2ZFfRg96CFCXiXiS5hnXks4p2i5wGk9j+6B1 RxOUOtOruJm1SUxSpkLU6f6uhem/6XC5mJCyQG3j5+/NFrB1SIvrYC/qx2Vn99DkLcBo ELPQ== 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=wa58PtJA1fEj7KT99tVetLIDmYZFQYqMwoh2nppQYCw=; fh=OdmakY/mhTfwrHv6L80hsbRbnAW2z4Tm3Em6Kk+8ck8=; b=gkaMfQeclnZ9whxDap94dR04dcQGkB15Lvw5wqPqfhvE+XlSjM2PapyPKY85ZkV/W5 ulXfFcJhAtvIviS0wDrdaqR0CbZZqnoUbcGywnYdS+Vb0KrEyo59OOtWbz4dO85FeaFc NP3WX5YlX38pYBEROYvl1cjo5wrvQfRMyUEY6ps/pFrPxSnq+R7g6tTwBMsQmmKvR/Gj 56VFSs+Wh+K8W9k1F7huMVIKsRP7h/F5/WSMLbeK+SXw/l9E5kITN3UPx9CEKa3MGs0E YXZKbE2qPfjbE28eKBJPLfm4+iJQB1kEHRtDpRwdqe5WWvp+lprPv1/dQQtnBbR7kx4k VA5w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=ItsvzwHw; 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-55582-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-55582-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev X-Forwarded-Encrypted: i=1; AJvYcCVW006CB/ETsg4LTLRBlWv/HKoJKHMSIPI6/EGhDFsLIkSk3ovbsfHZ1YPGNq2V8k8XYORFVUEtvmWfYY9gx7+HzvVZJQ== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id w3-20020aa7dcc3000000b0056024d8cc8csi1444853edu.509.2024.02.06.12.26.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 12:26:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-55582-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=ItsvzwHw; 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-55582-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-55582-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 7C9A91F27514 for ; Tue, 6 Feb 2024 20:20:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EB3E01BDED; 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="ItsvzwHw" Received: from out-176.mta0.migadu.com (out-176.mta0.migadu.com [91.218.175.176]) (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 8D39C17BA6 for ; Tue, 6 Feb 2024 20:19:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707250752; cv=none; b=MDYu2OVanTgBa8iT+IjCrkwaEXFhgiEEAh/oMmbTiR/ZSmnOV1i6VmaHh+fJmyJ5nEVPpueEJ81TYLQbSMHR3eqH5HQGENAvU9UDyDXVBtht6n/mqa1/FW0Fp9SAZYj+gPI2djiSlY+Ci16chm4rEQFQ7qNDjqykB8jwLXzRRIE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707250752; c=relaxed/simple; bh=IFPQ2jungHyUB4CEcxolgK/qYt4FICu78XWohMSyZBI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QEi8/lkTZId82V4gzEqk0nZ8xqUnqk9iaifzXWRThOulqFytypktzkNnyz3KR+pz4Ib+4A93uhGlUWRZ1htnQJXEnWD6C0w8WucU9O/qX6cgmQ48HmG/oUMjah3Bre8dAl8r66HVWIqfoDvaIt3diMTvp9/vtseAy6Yu2Sb1LU0= 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=ItsvzwHw; arc=none smtp.client-ip=91.218.175.176 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=1707250748; 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=wa58PtJA1fEj7KT99tVetLIDmYZFQYqMwoh2nppQYCw=; b=ItsvzwHwNNPEMuHmsPn2p1KXWHXVJ9HrmVnzfW7oibn8pUHwy31qJcU8LGI+pduY5MzI5Z OKXph/Hlf4RTyrKU+msyhEwYuCoOId6rSPRhEqWhy3Sri4xhMyp1Jsy0MoNV2keCa9z3qQ RD/NwjpVTvHWXpTpVDokO6r1e6f4tEw= From: Kent Overstreet To: brauner@kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Kent Overstreet Subject: [PATCH v2 1/7] fs: super_set_uuid() Date: Tue, 6 Feb 2024 15:18:49 -0500 Message-ID: <20240206201858.952303-2-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: 1790182637630793200 X-GMAIL-MSGID: 1790182637630793200 Some weird old filesytems have UUID-like things that we wish to expose as UUIDs, but are smaller; add a length field so that the new FS_IOC_(GET|SET)UUID ioctls can handle them in generic code. And add a helper super_set_uuid(), for setting nonstandard length uuids. Helper is now required for the new FS_IOC_GETUUID ioctl; if super_set_uuid() hasn't been called, the ioctl won't be supported. Signed-off-by: Kent Overstreet Reviewed-by: Dave Chinner --- fs/bcachefs/fs.c | 2 +- fs/ext4/super.c | 2 +- fs/f2fs/super.c | 2 +- fs/gfs2/ops_fstype.c | 2 +- fs/kernfs/mount.c | 4 +++- fs/ocfs2/super.c | 4 ++-- fs/ubifs/super.c | 2 +- fs/xfs/xfs_mount.c | 2 +- include/linux/fs.h | 9 +++++++++ mm/shmem.c | 4 +++- 10 files changed, 23 insertions(+), 10 deletions(-) diff --git a/fs/bcachefs/fs.c b/fs/bcachefs/fs.c index 77ea61090e91..68e9a89e42bb 100644 --- a/fs/bcachefs/fs.c +++ b/fs/bcachefs/fs.c @@ -1946,7 +1946,7 @@ static struct dentry *bch2_mount(struct file_system_type *fs_type, sb->s_time_gran = c->sb.nsec_per_time_unit; sb->s_time_min = div_s64(S64_MIN, c->sb.time_units_per_sec) + 1; sb->s_time_max = div_s64(S64_MAX, c->sb.time_units_per_sec); - sb->s_uuid = c->sb.user_uuid; + super_set_uuid(sb, c->sb.user_uuid.b, sizeof(c->sb.user_uuid)); c->vfs_sb = sb; strscpy(sb->s_id, c->name, sizeof(sb->s_id)); diff --git a/fs/ext4/super.c b/fs/ext4/super.c index dcba0f85dfe2..9e28ebd0869a 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -5346,7 +5346,7 @@ static int __ext4_fill_super(struct fs_context *fc, struct super_block *sb) sb->s_qcop = &ext4_qctl_operations; sb->s_quota_types = QTYPE_MASK_USR | QTYPE_MASK_GRP | QTYPE_MASK_PRJ; #endif - memcpy(&sb->s_uuid, es->s_uuid, sizeof(es->s_uuid)); + super_set_uuid(sb, es->s_uuid, sizeof(es->s_uuid)); INIT_LIST_HEAD(&sbi->s_orphan); /* unlinked but open files */ mutex_init(&sbi->s_orphan_lock); diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index d45ab0992ae5..5dd7b7b26db9 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -4496,7 +4496,7 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent) sb->s_time_gran = 1; sb->s_flags = (sb->s_flags & ~SB_POSIXACL) | (test_opt(sbi, POSIX_ACL) ? SB_POSIXACL : 0); - memcpy(&sb->s_uuid, raw_super->uuid, sizeof(raw_super->uuid)); + super_set_uuid(&sb, (void *) raw_super->uuid, sizeof(raw_super->uuid)); sb->s_iflags |= SB_I_CGROUPWB; /* init f2fs-specific super block info */ diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c index 1281e60be639..572d58e86296 100644 --- a/fs/gfs2/ops_fstype.c +++ b/fs/gfs2/ops_fstype.c @@ -214,7 +214,7 @@ static void gfs2_sb_in(struct gfs2_sbd *sdp, const void *buf) memcpy(sb->sb_lockproto, str->sb_lockproto, GFS2_LOCKNAME_LEN); memcpy(sb->sb_locktable, str->sb_locktable, GFS2_LOCKNAME_LEN); - memcpy(&s->s_uuid, str->sb_uuid, 16); + super_set_uuid(s, str->sb_uuid, 16); } /** diff --git a/fs/kernfs/mount.c b/fs/kernfs/mount.c index 0c93cad0f0ac..e29f4edf9572 100644 --- a/fs/kernfs/mount.c +++ b/fs/kernfs/mount.c @@ -358,7 +358,9 @@ int kernfs_get_tree(struct fs_context *fc) } sb->s_flags |= SB_ACTIVE; - uuid_gen(&sb->s_uuid); + uuid_t uuid; + uuid_gen(&uuid); + super_set_uuid(sb, uuid.b, sizeof(uuid)); down_write(&root->kernfs_supers_rwsem); list_add(&info->node, &info->root->supers); diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index 6b906424902b..a70aff17d455 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c @@ -2027,8 +2027,8 @@ static int ocfs2_initialize_super(struct super_block *sb, cbits = le32_to_cpu(di->id2.i_super.s_clustersize_bits); bbits = le32_to_cpu(di->id2.i_super.s_blocksize_bits); sb->s_maxbytes = ocfs2_max_file_offset(bbits, cbits); - memcpy(&sb->s_uuid, di->id2.i_super.s_uuid, - sizeof(di->id2.i_super.s_uuid)); + super_set_uuid(sb, di->id2.i_super.s_uuid, + sizeof(di->id2.i_super.s_uuid)); osb->osb_dx_mask = (1 << (cbits - bbits)) - 1; diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c index 09e270d6ed02..f780729eec06 100644 --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c @@ -2245,7 +2245,7 @@ static int ubifs_fill_super(struct super_block *sb, void *data, int silent) goto out_umount; } - import_uuid(&sb->s_uuid, c->uuid); + super_set_uuid(sb, c->uuid, sizeof(c->uuid)); mutex_unlock(&c->umount_mutex); return 0; diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c index aabb25dc3efa..4a46bc44088f 100644 --- a/fs/xfs/xfs_mount.c +++ b/fs/xfs/xfs_mount.c @@ -62,7 +62,7 @@ xfs_uuid_mount( int hole, i; /* Publish UUID in struct super_block */ - uuid_copy(&mp->m_super->s_uuid, uuid); + super_set_uuid(mp->m_super, uuid->b, sizeof(*uuid)); if (xfs_has_nouuid(mp)) return 0; diff --git a/include/linux/fs.h b/include/linux/fs.h index ed5966a70495..acdc56987cb1 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -1257,6 +1257,7 @@ struct super_block { char s_id[32]; /* Informational name */ uuid_t s_uuid; /* UUID */ + u8 s_uuid_len; /* Default 16, possibly smaller for weird filesystems */ unsigned int s_max_links; @@ -2532,6 +2533,14 @@ extern __printf(2, 3) int super_setup_bdi_name(struct super_block *sb, char *fmt, ...); extern int super_setup_bdi(struct super_block *sb); +static inline void super_set_uuid(struct super_block *sb, const u8 *uuid, unsigned len) +{ + if (WARN_ON(len > sizeof(sb->s_uuid))) + len = sizeof(sb->s_uuid); + sb->s_uuid_len = len; + memcpy(&sb->s_uuid, uuid, len); +} + extern int current_umask(void); extern void ihold(struct inode * inode); diff --git a/mm/shmem.c b/mm/shmem.c index d7c84ff62186..be41955e52da 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -4355,7 +4355,9 @@ static int shmem_fill_super(struct super_block *sb, struct fs_context *fc) #ifdef CONFIG_TMPFS_POSIX_ACL sb->s_flags |= SB_POSIXACL; #endif - uuid_gen(&sb->s_uuid); + uuid_t uuid; + uuid_gen(&uuid); + super_set_uuid(sb, uuid.b, sizeof(uuid)); #ifdef CONFIG_TMPFS_QUOTA if (ctx->seen & SHMEM_SEEN_QUOTA) { 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, From patchwork Tue Feb 6 20:18:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kent Overstreet X-Patchwork-Id: 197633 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp1799350dyb; Tue, 6 Feb 2024 12:20:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IGfZBTZEZ266q3PfcI4SwBVfTN/TlciLWBP6MXkBMaf3UdTCDypfIvBliGuVa4EofaqLt2P X-Received: by 2002:a05:6358:d599:b0:176:d3d2:66a2 with SMTP id ms25-20020a056358d59900b00176d3d266a2mr723735rwb.15.1707250848969; Tue, 06 Feb 2024 12:20:48 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707250848; cv=pass; d=google.com; s=arc-20160816; b=AJtHDZg5TiY7T1LDY+TYbaaxNweYvJnaa/C1KPiazlzZlonYTbPkgy9fqIw9XSWwj6 WR+CqY31PouBpIopkdvIm5a5Ru9CmhnL+BJZSxjigVAJ1VPY47/9tcKVXjryjJlXdZIn JuVLuvesa0cgZ89xwVLqyDHJZkKKcqqDPwR/zK4XAu7PrxWf5M6bW5npRew6DOcGShA0 oK48+8DALqbeJmQPi3fwZervrxdC61M2zgtU8SBxeS+VTdrVHYic9v0XnyszWoayoiP+ hP6gc1DzU7/8Dh8LK81wRylcRyfC+V2V0F4nopPNtWIZiCWtnfIw5Tfj7PSirm7ygbH1 xq3w== 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=cUWUWQYx2apHh584Rw7/E+yXOteLWIl9kYmQ30+LMmM=; fh=XgWb3Pl8DEyb3x5ZYxIxKdMan6EfwkjXkNNpEM6vqxg=; b=PjxWPHzJJmlmhPMGqjl7zD9LstWvrH6kTxIDuvjp71Be1SUFPybjrYxDRWYW9pLcKk VHzqA2+eN+9ws0iq6/U8hR/q9GDhSi1EkePK+E8PaAiTLnPdVxNXsV7Ahb8TN2YaCGob EkCfSRnZnfkogc+gFKyxjBqnP2+xO7Xjta/m+xPwH9syvIOgvJDVPOnl9141cvLHM71X uYZwD7ql4si28GbRUB8NvQZyD+oS1cGM7UG4Mpo7XtjG4wf5DOAX/Ror6spI6ySxu1w1 +Pcypf7gT71LBsNPYv4/9APXPhGF52VE9pKz+jaW5B6D+fDgz2wtrfFyqsVxYgW1Ibb6 QypQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=pD1lnZx2; 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-55584-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-55584-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev X-Forwarded-Encrypted: i=1; AJvYcCV9UxqrfOb+xjdiFsFTH/pSvtozJZ2dtrAAgtQR7O0lGdE70gyGzsxGaXVTKc3dcoLqwqCMoM+nmLqzQhu2jeqteCLjig== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d9-20020a05622a15c900b0042bf17dc87esi3276599qty.152.2024.02.06.12.20.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 12:20:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-55584-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=pD1lnZx2; 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-55584-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-55584-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id BBE501C20E41 for ; Tue, 6 Feb 2024 20:20:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6361B1C694; Tue, 6 Feb 2024 20:19:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="pD1lnZx2" Received: from out-174.mta0.migadu.com (out-174.mta0.migadu.com [91.218.175.174]) (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 B7C3B1804F for ; Tue, 6 Feb 2024 20:19:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707250754; cv=none; b=cA4yj8H3VS5t1EM1qxeBBq+PIKN7EWGlanOykyVEP+XPG6ti2MN0F19tclC9d0lO1L2EjVuBy7a1qwdq6RRBaiZij2W6GMDbIbmLsy9tefDHUAJDyCusOsyHgrWnTt6uNAQK6ODIReEfco9ATvFK42dq1spd2+nUJTgy7DS+bAE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707250754; c=relaxed/simple; bh=Nl2uD7WLGO6LwYrdmtsTqVkhwhbUvhZiQtCqAfnLPOg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PrseR3PLVsn3s9zsQsIMGJDcUiDsd5OAwcx9VdBXh7nFB24HnorJXn8J3XUvE4r+4LQA0+YflTGUin5Z//8WmFHr/15E75xuJUodMflMF2lBjTiFWZf8fRv4RnbgSFOJ6rT0NGWYd8AhL+PutmyIkWg3GC6U30fM4uCPzkNn3xg= 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=pD1lnZx2; arc=none smtp.client-ip=91.218.175.174 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=1707250750; 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=cUWUWQYx2apHh584Rw7/E+yXOteLWIl9kYmQ30+LMmM=; b=pD1lnZx25k66T6d8cUseYkNdiKRM6rwnY7db3KlIqpszfG+WRNa4M1ZLVrYl1A5UUzrmlA 8rmQRWHdrv4nbzS32Te2wHIF16jdGH71+IzPLqbBBg6SSCH1L8qPJgUkC7bCt2ZnLaKxJB wp1uqbhAlwB5wC7OhMFhbRH6xiWI87c= From: Kent Overstreet To: brauner@kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Kent Overstreet , Jan Kara , Dave Chinner , "Darrick J. Wong" , Theodore Ts'o , linux-fsdevel@vger.kernel.or Subject: [PATCH v2 3/7] fs: FS_IOC_GETUUID Date: Tue, 6 Feb 2024 15:18:51 -0500 Message-ID: <20240206201858.952303-4-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: 1790182266261933863 X-GMAIL-MSGID: 1790182266261933863 Add a new generic ioctls for querying the filesystem UUID. These are lifted versions of the ext4 ioctls, with one change: we're not using a flexible array member, because UUIDs will never be more than 16 bytes. This patch adds a generic implementation of FS_IOC_GETFSUUID, which reads from super_block->s_uuid. We're not lifting SETFSUUID from ext4 - that can be done on offline filesystems by the people who need it, trying to do it online is just asking for too much trouble. Cc: Christian Brauner Cc: Jan Kara Cc: Dave Chinner Cc: "Darrick J. Wong" Cc: Theodore Ts'o Cc: linux-fsdevel@vger.kernel.or Signed-off-by: Kent Overstreet --- fs/ioctl.c | 16 ++++++++++++++++ include/uapi/linux/fs.h | 17 +++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/fs/ioctl.c b/fs/ioctl.c index 76cf22ac97d7..046c30294a82 100644 --- a/fs/ioctl.c +++ b/fs/ioctl.c @@ -763,6 +763,19 @@ static int ioctl_fssetxattr(struct file *file, void __user *argp) return err; } +static int ioctl_getfsuuid(struct file *file, void __user *argp) +{ + struct super_block *sb = file_inode(file)->i_sb; + + if (!sb->s_uuid_len) + return -ENOIOCTLCMD; + + struct fsuuid2 u = { .len = sb->s_uuid_len, }; + memcpy(&u.uuid[0], &sb->s_uuid, sb->s_uuid_len); + + return copy_to_user(argp, &u, sizeof(u)) ? -EFAULT : 0; +} + /* * do_vfs_ioctl() is not for drivers and not intended to be EXPORT_SYMBOL()'d. * It's just a simple helper for sys_ioctl and compat_sys_ioctl. @@ -845,6 +858,9 @@ static int do_vfs_ioctl(struct file *filp, unsigned int fd, case FS_IOC_FSSETXATTR: return ioctl_fssetxattr(filp, argp); + case FS_IOC_GETFSUUID: + return ioctl_getfsuuid(filp, argp); + default: if (S_ISREG(inode->i_mode)) return file_ioctl(filp, cmd, argp); diff --git a/include/uapi/linux/fs.h b/include/uapi/linux/fs.h index 48ad69f7722e..16a6ecadfd8d 100644 --- a/include/uapi/linux/fs.h +++ b/include/uapi/linux/fs.h @@ -64,6 +64,19 @@ struct fstrim_range { __u64 minlen; }; +/* + * We include a length field because some filesystems (vfat) have an identifier + * that we do want to expose as a UUID, but doesn't have the standard length. + * + * We use a fixed size buffer beacuse this interface will, by fiat, never + * support "UUIDs" longer than 16 bytes; we don't want to force all downstream + * users to have to deal with that. + */ +struct fsuuid2 { + __u8 len; + __u8 uuid[16]; +}; + /* extent-same (dedupe) ioctls; these MUST match the btrfs ioctl definitions */ #define FILE_DEDUPE_RANGE_SAME 0 #define FILE_DEDUPE_RANGE_DIFFERS 1 @@ -190,6 +203,9 @@ struct fsxattr { * (see uapi/linux/blkzoned.h) */ +/* Returns the external filesystem UUID, the same one blkid returns */ +#define FS_IOC_GETFSUUID _IOR(0x12, 142, struct fsuuid2) + #define BMAP_IOCTL 1 /* obsolete - kept for compatibility */ #define FIBMAP _IO(0x00,1) /* bmap access */ #define FIGETBSZ _IO(0x00,2) /* get the block size used for bmap */ @@ -198,6 +214,7 @@ struct fsxattr { #define FITRIM _IOWR('X', 121, struct fstrim_range) /* Trim */ #define FICLONE _IOW(0x94, 9, int) #define FICLONERANGE _IOW(0x94, 13, struct file_clone_range) + #define FIDEDUPERANGE _IOWR(0x94, 54, struct file_dedupe_range) #define FSLABEL_MAX 256 /* Max chars for the interface; each fs may differ */ From patchwork Tue Feb 6 20:18:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kent Overstreet X-Patchwork-Id: 197636 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp1800446dyb; Tue, 6 Feb 2024 12:22:28 -0800 (PST) X-Google-Smtp-Source: AGHT+IG4Cie34AUshl5wavpb+FL9xLWprPrqwG/02apsWhNlZsaeaComuQNc9kJJcRB7r52/SdfH X-Received: by 2002:a05:6e02:ed0:b0:363:6da9:2bc3 with SMTP id i16-20020a056e020ed000b003636da92bc3mr3663821ilk.11.1707250948553; Tue, 06 Feb 2024 12:22:28 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707250948; cv=pass; d=google.com; s=arc-20160816; b=elTOSTP4gaygZc6KDBZO5ETVodLoIkzAl4PIB6XKP6ax6YOsO/mRrjr8chzdUEV7jl 8z9XWjfAXFRIyvzoaORRG1ihuF6qDgFikFP1gwOWCyYy41PyUijxPA+rX7DJpiq96C+O KmhgW2HEKk68MU6E/Etn3qg0qs3jsL5R0O93nLkXJpJjAtCSyBrSQlB/xVif0Uw6e/l4 LsPVrUAixh2EXcr9uV7WPaqkNAnt32bIPgqEHtUsS4qlk/8bQ/n8OOwjeHS9sMnFKVBV bPCjZgb6hF0E5FOIfEXuvqIieHOhTvaZI0fBV6qrvi3C2PMfuuoth2d/RwhjthecaKxh Ev3Q== 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=ORZ3NxtyAsFtX+LQqgBHca7yU+LThn04BGVHp9Ql3Xo=; fh=vQVtohJShOuj69t7sy87o5REMyLYJZC7HwiZx+UZJEg=; b=xC7NP5bZx4difafzBChya83YYSYDeIfd/+m2EFfD8dc4xu0CwU4MaEP98OGFcXAnu2 Y/ZtF2YtNYbpFh2uHf1L/wIJ8f6SGg7byFcovfw7koRmQ1Q05H+x2kxGU+dwyx3JrXtw m3iNXhP5L2PRUynUEMi1U7DQufimdzFGEAJr7Md5TAlzwhmMoA0HCATGYC4AYQ+fqTBZ ibvyrsqUkVgP2woSdSNSK9rEK/XjKgNBg0Z5KU5Zjg4UQV60oADMTnjg+fEqeCYJMpnn /ysx40WLKBNM98bichTkzKT+7Q5rtEViKD7BbDGdMbSCqe6yLmaCWZwzsk8Bp5T5LEiS q0IQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=fwScqX0m; 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-55585-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-55585-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev X-Forwarded-Encrypted: i=1; AJvYcCWX4FCVQmHBrY2m3pL2x6z2RUmqY2epMRwduoYDbRFtNxQtcqDe4w1xkS4UP8G7VIa4yM50carVF3wzybWiLCkP9TW2+g== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id w4-20020a63f504000000b005c680fbab19si2071857pgh.513.2024.02.06.12.22.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 12:22:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-55585-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=fwScqX0m; 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-55585-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-55585-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 932FDB22E68 for ; Tue, 6 Feb 2024 20:21:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4A25617984; Tue, 6 Feb 2024 20:19:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="fwScqX0m" Received: from out-179.mta0.migadu.com (out-179.mta0.migadu.com [91.218.175.179]) (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 CB8C71B597 for ; Tue, 6 Feb 2024 20:19:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707250755; cv=none; b=VvW/7TlsloSmJ9ekpr2E8QnSoSTffCSFLClgzv2lJslm1B/WRnJKkZ0e9aPG7veQXa52ZvXT85z8Fi9DVV5t04Zm/27FePN5A85qMXJjWf3tT6INRdWoL/kn+/X8PeG1HE+K8tobOSI33e9zeizOWYBDgV+DgHUVvuZ4EGGZy8E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707250755; c=relaxed/simple; bh=BmbZGsFxwakjn0IikUsjUWm3IXpJHfHD1/as7Xt9Pcw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Cw/EBFZPJJ8mRim3UzHcuynp2xJcAuvxkIcWiYVTp9d949FKAr0N5duj4SBC/vDnE7cQ4Qqxgc2CyEArrmRCB0S8A4i0MfG4GiMEaN2pR4qAO69g6BUsHYXBhlnTBOlTt3GTHQvvu6OMHUblTOywCDpMkfAiUwB+y5boSMsh104= 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=fwScqX0m; arc=none smtp.client-ip=91.218.175.179 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=1707250751; 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=ORZ3NxtyAsFtX+LQqgBHca7yU+LThn04BGVHp9Ql3Xo=; b=fwScqX0mnWDNlYrU6EpWlu3bS17zj2d/+yx3GJV7H8mqYcnwQLUTmo0E3m/Lxpforau8JM O+M+wuxH0ZwvKEc+AP7mBE9c3gA2HhDVpS0NAZHr+sq1enlGS+NtJ+yDqcmeBxzVjNW5BR M6CJaUFkFsWGlVLN1DWOT3IYg+QzLKc= From: Kent Overstreet To: brauner@kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Kent Overstreet Subject: [PATCH v2 4/7] fat: Hook up sb->s_uuid Date: Tue, 6 Feb 2024 15:18:52 -0500 Message-ID: <20240206201858.952303-5-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: 1790182370432697193 X-GMAIL-MSGID: 1790182370432697193 Now that we have a standard ioctl for querying the filesystem UUID, initialize sb->s_uuid so that it works. Signed-off-by: Kent Overstreet --- fs/fat/inode.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/fat/inode.c b/fs/fat/inode.c index 1fac3dabf130..5c813696d1ff 100644 --- a/fs/fat/inode.c +++ b/fs/fat/inode.c @@ -1762,6 +1762,9 @@ int fat_fill_super(struct super_block *sb, void *data, int silent, int isvfat, else /* fat 16 or 12 */ sbi->vol_id = bpb.fat16_vol_id; + __le32 vol_id_le = cpu_to_le32(sbi->vol_id); + super_set_uuid(sb, (void *) &vol_id_le, sizeof(vol_id_le)); + sbi->dir_per_block = sb->s_blocksize / sizeof(struct msdos_dir_entry); sbi->dir_per_block_bits = ffs(sbi->dir_per_block) - 1; From patchwork Tue Feb 6 20:18:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kent Overstreet X-Patchwork-Id: 197634 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp1799754dyb; Tue, 6 Feb 2024 12:21:28 -0800 (PST) X-Google-Smtp-Source: AGHT+IGNoW83Kqkkz2QMQdVKWWD/kW1yFb7Y8iSSlASmaaBr6F6izpkF7tMZwdq6QwQpx7UZfFY/ X-Received: by 2002:a05:6870:7251:b0:218:5f59:2a84 with SMTP id y17-20020a056870725100b002185f592a84mr4081241oaf.53.1707250888172; Tue, 06 Feb 2024 12:21:28 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707250888; cv=pass; d=google.com; s=arc-20160816; b=dojVvSD6AMA9NYKvrZgTQl5K+1k0tVNqro+JEPIrrCqVIjsanHikIDtJuS82qGF5UR /8qLhOmV6nnQU3twsqdm/CdfN5Ch0ucNGgTCPgcWvcxKBPLgD/+/pC8Q1FK0d0gktefV Oz47SpA7VarKRi7IyLRDZRExGMaymXPOxLXoqrRkjo9uBjDLltHyQ0rRrfbJIazbDgdN 0MC6IRztwzXz7YFNLfj7ePaTpFl/of4LKcq/3qb8C5Fo8t0jl3VggUtTeFRZQsZzTjO3 KgGZ82lGCIC49amiJowH7Ojxi5saNmEGIb+XZVDS5DWdYpGKN+D1js3hDVeRSOuxEy1Q HF2Q== 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=ItugtweJECqHs1CmLKyw1iHGhu+1pYozy9UbRerZ1b8=; fh=AChkNG47gCq2S3JEGeNRoKv7oD8JZhp3uhQXtHOp5AM=; b=ZmkCxi8s/yO4758QzgIuccuw63NHeKJ6yY5gJF5Iff8TLSlz02vb8y0jvjgoXXYw9O loV4svD8Mco6ZaZMz1FGEI3LoT2rjmbd8AWB2IBR/Kg28dYvYLl/6nfmK9f1wyukVzvd +h+MRImsJMRE8ioejRxNE2ElaMKxFNzubLv9Hv8AUcmVKfvgK4D7bBDpr0MZH2S3FVJi HNmRZLmTpUb8DCEXOUfminGILVe5wuapXzp8gZI8x6L4iQwlG83Ky32REgTKucmE+zl/ uJfR5KC4ZT1Wyzrf4OrLhOs1w3cOT8qzXUtVaGdk3Gs5vUPQqTr0MmfGfOMS/PmViiL7 lCwg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=DKSKc9Qu; 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-55586-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-55586-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev X-Forwarded-Encrypted: i=1; AJvYcCXf1XzRGFUbrHDoxzw5BQjkXBgxMzqZxpGpmUER0z+2yZ3svbLCu0jJoCjxCux6DdzWP939Y50dNn6iAzUGdUS7cRr+nA== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id x21-20020a634a15000000b005dbddc1aeb6si2080981pga.514.2024.02.06.12.21.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 12:21:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-55586-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=DKSKc9Qu; 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-55586-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-55586-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 E5CD22878E8 for ; Tue, 6 Feb 2024 20:21:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 891111CD33; Tue, 6 Feb 2024 20:19:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="DKSKc9Qu" Received: from out-183.mta0.migadu.com (out-183.mta0.migadu.com [91.218.175.183]) (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 EFEBE1B947 for ; Tue, 6 Feb 2024 20:19:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.183 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707250756; cv=none; b=GuuO52oEIkwKi88ZBnFmfKuLw7PI3+OmUePRXtEZzmOaJkemPsdQ00NQBJFqst+d/yrbZTS4BsntpEPdvHU6JgV1xVD9/zqELVeUl1AKZSQkLOJeIcKe9kyyFw6HT5UvTjl6U/+caLtoCGDFSzrhYgnXSw3gv4DrL9sU0JoVt8Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707250756; c=relaxed/simple; bh=ihVywjsRPaRNHRnt5rdgpKCQd+dwFydgn6siSAIZffg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GjPyJkwwFjrook2OzIpZ0x/s7EbXSoFRPx1egOjkPK+q9jMjzE9MpcMmU6h1sFqqd2UhExOC68TN9Ycdo4dLAFkcOuh/WJibztcF9RyFVwR7d23txI0NYcjXdc1l6eI4HK/fW8cGP10wmgSUbStC4L8em5Yr+QZTEwearHe9D0A= 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=DKSKc9Qu; arc=none smtp.client-ip=91.218.175.183 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=1707250753; 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=ItugtweJECqHs1CmLKyw1iHGhu+1pYozy9UbRerZ1b8=; b=DKSKc9QueSrA93ArB5oPwxfyFK2m+WBscYd1Ghb0bw+a38mdK+rp6SEpyQ5H5sEyXc47tJ 1lSieGlvpOwAuUV5wMDjp1IUIIENjvGsMXu08c/BO/IUoy1qzVPM+rLzftUJ5sKLRcmN+p WxIEql9iBhVS8q97qUtyqkAtYTn5QkY= From: Kent Overstreet To: brauner@kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Kent Overstreet , Jan Kara , Dave Chinner , "Darrick J. Wong" , Theodore Ts'o , Josef Bacik Subject: [PATCH v2 5/7] fs: FS_IOC_GETSYSFSNAME Date: Tue, 6 Feb 2024 15:18:53 -0500 Message-ID: <20240206201858.952303-6-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: 1790182307175006313 X-GMAIL-MSGID: 1790182307175006313 Add a new ioctl for getting the sysfs name of a filesystem - the path under /sys/fs. This is going to let us standardize exporting data from sysfs across filesystems, e.g. time stats. The returned path will always be of the form "$FSTYP/$SYSFS_IDENTIFIER", where the sysfs identifier may be a UUID (for bcachefs) or a device name (xfs). Cc: Christian Brauner Cc: Jan Kara Cc: Dave Chinner Cc: "Darrick J. Wong" Cc: Theodore Ts'o Cc: Josef Bacik Signed-off-by: Kent Overstreet --- fs/ioctl.c | 17 +++++++++++++++++ include/linux/fs.h | 1 + include/uapi/linux/fs.h | 10 ++++++++++ 3 files changed, 28 insertions(+) diff --git a/fs/ioctl.c b/fs/ioctl.c index 046c30294a82..7c37765bd04e 100644 --- a/fs/ioctl.c +++ b/fs/ioctl.c @@ -776,6 +776,20 @@ static int ioctl_getfsuuid(struct file *file, void __user *argp) return copy_to_user(argp, &u, sizeof(u)) ? -EFAULT : 0; } +static int ioctl_get_fs_sysfs_path(struct file *file, void __user *argp) +{ + struct super_block *sb = file_inode(file)->i_sb; + + if (!strlen(sb->s_sysfs_name)) + return -ENOIOCTLCMD; + + struct fssysfspath u = {}; + + snprintf(u.name, sizeof(u.name), "%s/%s", sb->s_type->name, sb->s_sysfs_name); + + return copy_to_user(argp, &u, sizeof(u)) ? -EFAULT : 0; +} + /* * do_vfs_ioctl() is not for drivers and not intended to be EXPORT_SYMBOL()'d. * It's just a simple helper for sys_ioctl and compat_sys_ioctl. @@ -861,6 +875,9 @@ static int do_vfs_ioctl(struct file *filp, unsigned int fd, case FS_IOC_GETFSUUID: return ioctl_getfsuuid(filp, argp); + case FS_IOC_GETFSSYSFSPATH: + return ioctl_get_fs_sysfs_path(filp, argp); + default: if (S_ISREG(inode->i_mode)) return file_ioctl(filp, cmd, argp); diff --git a/include/linux/fs.h b/include/linux/fs.h index acdc56987cb1..b96c1d009718 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -1258,6 +1258,7 @@ struct super_block { char s_id[32]; /* Informational name */ uuid_t s_uuid; /* UUID */ u8 s_uuid_len; /* Default 16, possibly smaller for weird filesystems */ + char s_sysfs_name[UUID_STRING_LEN + 1]; unsigned int s_max_links; diff --git a/include/uapi/linux/fs.h b/include/uapi/linux/fs.h index 16a6ecadfd8d..c0f7bd4b6350 100644 --- a/include/uapi/linux/fs.h +++ b/include/uapi/linux/fs.h @@ -77,6 +77,10 @@ struct fsuuid2 { __u8 uuid[16]; }; +struct fssysfspath { + __u8 name[128]; +}; + /* extent-same (dedupe) ioctls; these MUST match the btrfs ioctl definitions */ #define FILE_DEDUPE_RANGE_SAME 0 #define FILE_DEDUPE_RANGE_DIFFERS 1 @@ -206,6 +210,12 @@ struct fsxattr { /* Returns the external filesystem UUID, the same one blkid returns */ #define FS_IOC_GETFSUUID _IOR(0x12, 142, struct fsuuid2) +/* + * Returns the path component under /sys/fs/ that refers to this filesystem; + * also /sys/kernel/debug/ for filesystems with debugfs exports + */ +#define FS_IOC_GETFSSYSFSPATH _IOR(0x12, 143, struct fssysfspath) + #define BMAP_IOCTL 1 /* obsolete - kept for compatibility */ #define FIBMAP _IO(0x00,1) /* bmap access */ #define FIGETBSZ _IO(0x00,2) /* get the block size used for bmap */ From patchwork Tue Feb 6 20:18:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kent Overstreet X-Patchwork-Id: 197640 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp1805845dyb; Tue, 6 Feb 2024 12:31:47 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWfFID6FiRczPdartSsUubAV6wV/FTWm82vR+AHqV0R33DU69bK1OqZ3oNdRIlbf+pMlE5KXSgXK/ZsTb1/vQmtQ48fHQ== X-Google-Smtp-Source: AGHT+IEImpvy+M+sH7A+L6ctAwucttF/NZQAEaAwob6a7RdWjTTyT+HpondhfX7wUQkjTL8hGxkJ X-Received: by 2002:a2e:9b8f:0:b0:2d0:aae8:2297 with SMTP id z15-20020a2e9b8f000000b002d0aae82297mr2799723lji.5.1707251507088; Tue, 06 Feb 2024 12:31:47 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707251507; cv=pass; d=google.com; s=arc-20160816; b=E6S4JGRzFj4cfcZbcBPFCcz+U0lEvJgwgjI7tX212hEJNgoAxrp3T+UkYuTRXURrU/ chO607D352o6hVJGz97Ipn0uxtbxzZ2q5uMl0Oh+qtwWQj5E3/fjtRw1Z0TcsScSuYG4 nNBIYbQCdoWoK44MfO7HB4wh4e82kD42H+7TzCyutXyMSfO52HtF/CqX6stjyny3t0Ps xDbXgvsjGJQsGrHbwam9VIU8zcMvlKs/wrFYY+2EWzUSrKkz1MHLioK9mhp+rpHeoctP G+PgrrCaE/9Z4LQ8LAvs9o4fmws4vqRQKniVE/jEtPuYitdGc574K//ue/g+vv7UjDvh 04Cw== 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=2YXrtm+1+cRzzafgmSF6M7/9FRb0PSFDCes3wLXLLXk=; fh=Cwim2aeQGjaCCkMgbTjrm7KzLGkzvPdh3mafTRm9hVQ=; b=Wx2C1d5gvQo6UN/BOiRqWFm+3PkQxzVMAS20vEKnmZlSIHTVopKrDlq7g6iOcRhhR2 fHxZb3KwnrpQA5yMALObkZo1XTxQDYDpJOZrgqKsG/FMsz5cORW7KB11f057NZQoxF9y o6bDS3+kShjpzPvMFOw+0zAdt4+I73nWOTiiHaB2FTqOVJ5BB5SG6fpiu+edJwUhaIas 56sySO3jHhd1d0wbFR11kQGY/h0ZHsZCaJ2FvVZflVubL61Jar50W6xwq5GD/Kc035+u 1bht3zgoQs9EDe3YbnPmMPq9PkOz3QO2BCtCq+QhoM9aG/OC58xyj8zKfr0ETcRGBioG F3RA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=uprbPkH6; 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-55587-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-55587-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev X-Forwarded-Encrypted: i=1; AJvYcCWCvY+YuKbxd4tz2F3r23xy3kgP7XAaO0yavDolw3rLmikjlicEOowPV/cw7Pgws/T9Fa3I2MCYG8Q/czXLP7crl6H9LA== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id k10-20020aa7d8ca000000b0055fbbfb89b9si1463748eds.294.2024.02.06.12.31.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 12:31:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-55587-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=uprbPkH6; 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-55587-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-55587-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 am.mirrors.kernel.org (Postfix) with ESMTPS id E77001F2884C for ; Tue, 6 Feb 2024 20:21:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CFFDE1CD3D; Tue, 6 Feb 2024 20:19:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="uprbPkH6" Received: from out-174.mta0.migadu.com (out-174.mta0.migadu.com [91.218.175.174]) (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 8E22B1BC27 for ; Tue, 6 Feb 2024 20:19:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707250757; cv=none; b=iZygL5v1aPreG0F0a/hiNjLXCAYO4hi20umbhacoz5cVITsqP5hcMtTj/AMtUuI2qCUbwSm/FzghH1jzlsdVYkiym3CatWdYY/2GKJPtk9rJjYZSGqCHZf1hQKvU3EFUkGqNuZ8IAd3DoCNXa/KCpb/OrJBC3DwtuF76HUXKniM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707250757; c=relaxed/simple; bh=IagyAptpbVbCJIu7tGslMZS09sjpEcntZ7cc/Wf4Lo8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=j5AxySGdbqr4EQy2gvSRpHER47O7XUYHi28/vzri3QMtZpIU2noX5X+BApfyPI/sCSiuNObxSeLjIK+Wdd4kttNy+8u7YbLPcQl0y4iqot6wWr5anUZIEMh9k9cwtWX8hEtpfWF6alrOWiL1pBcJMj/Z1QYvgdOMliL2omN7TeM= 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=uprbPkH6; arc=none smtp.client-ip=91.218.175.174 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=1707250754; 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=2YXrtm+1+cRzzafgmSF6M7/9FRb0PSFDCes3wLXLLXk=; b=uprbPkH6CHnUWKye0Byqav98Oq/yCStE6lfL0ElOIC4gcxaaHvA80rGm1JIpl+gfF6aYSU H/2BhtQ5tWOrIbwGFABiVF1kllQoAIlp6yRZ0vjPdFLK+HfBsk9AIF9P0Rbb/4ecbuUvaX OZD/5Tu4GHOLeZdfSEfizG72iYAZsDU= From: Kent Overstreet To: brauner@kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Kent Overstreet Subject: [PATCH v2 6/7] xfs: add support for FS_IOC_GETSYSFSNAME Date: Tue, 6 Feb 2024 15:18:54 -0500 Message-ID: <20240206201858.952303-7-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: 1790182956294224522 X-GMAIL-MSGID: 1790182956294224522 Signed-off-by: Kent Overstreet --- fs/xfs/xfs_mount.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c index 4a46bc44088f..d87d14d8f699 100644 --- a/fs/xfs/xfs_mount.c +++ b/fs/xfs/xfs_mount.c @@ -711,6 +711,8 @@ xfs_mountfs( if (error) goto out; + strscpy(mp->m_super->s_sysfs_name, mp->m_super->s_id, sizeof(mp->m_super->m_sysfs_name)); + error = xfs_sysfs_init(&mp->m_stats.xs_kobj, &xfs_stats_ktype, &mp->m_kobj, "stats"); if (error) From patchwork Tue Feb 6 20:18:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kent Overstreet X-Patchwork-Id: 197635 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp1799888dyb; Tue, 6 Feb 2024 12:21:40 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX4b1Pf/TQSbXKf2t5oNwyHTEZ0byjmj31N8kckUQiPMYj6JS55v9NG8mJh6JRpgRzuN2+fl0X126XQKFf62o1jgy5v9Q== X-Google-Smtp-Source: AGHT+IHktAY0x42cp1d/uunlY/2ABcQobX0+L36Se75GrERLHGYcN4cKLXXt2gXxqk9Jo6bKwHPE X-Received: by 2002:a05:6a20:6881:b0:19c:74b9:9388 with SMTP id n1-20020a056a20688100b0019c74b99388mr2176110pzj.13.1707250900419; Tue, 06 Feb 2024 12:21:40 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707250900; cv=pass; d=google.com; s=arc-20160816; b=qR0Jl50aHdJ9BmoW4sXAaKXTpZhw63w/5h+Tk9uMxBlVHpxeyDIc3wHZCoj4p711Vh gaAvm1GMZkafrwSQLNTzY/lqncj5v/xdoZi/AktuKeQhF2mSZT6ZzfA64OsYH2gU9ppe 3Pv0BuSOXs6A3yLTxGttNWun2CsxWTrY3krIiJr/9a/SRRFTeO+unrmxYlF23vnWyTGF rnyOs1ePtwDgtmo9ajltP3hg4ISlCfPXpF0HLgMk44eIQ+7eYfj8afo4ShfvAP9vAWdH 1eMuP8Tye0IC1wL6ujjNS9vIBJh6Es6fJZGcAYs7Ns9gPTNfKw0HOFhAsArycTdn6SCc 7nPw== 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=HS2DNqPoHrMr86/7fyMQRw3X2SfMSsS/w2jgXzblZj4=; fh=V9GPwxspUa8xmnJbxIBjiwP6CBvBG4Qi6G5/vmwC1O8=; b=lbmX5h5QQnyfKZWNuNXobHBIEfBABOhxY3Gr0U14v7bEFnePJInwEaxZILkJ3IGRVy PYbnxxbA8eHHYnANc9aByABRPjDqmNB/XraJeHqO7png2/f6lNqyBwB2WAYy8yAbTjgD VwV00q2Xu1Ywnb9GY6/mM3agd1NwIaerbVOGSJfhaJSnhHPoHiRC7rwppsbyOSy4aFHh UxiM3iwQEGXgdStDZkJuFZo/jraPT/r80BusMG/S3sT62s2nqH8QmrWL7p61P5f13EHF 4mOQ8Ilqphu1MjMaEr6919DwEgwRADvfbMRoEmKpCpVK/mBdbq/WiVOcdkjl2gvO4VVo bnaA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=vA3VH49Y; 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-55588-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-55588-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev X-Forwarded-Encrypted: i=1; AJvYcCU4EtUu7n8OxmmZI75wYowly+2Yf40Btnk3rM9dsvSox24+1m+mCCNbvUGZs4x47bRGYnae2Dr9ScZaVja8LfEfqZkQsw== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id n5-20020a63e045000000b005cdf7f2f98asi2251900pgj.50.2024.02.06.12.21.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 12:21:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-55588-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=vA3VH49Y; 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-55588-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-55588-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 2534928907C for ; Tue, 6 Feb 2024 20:21:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D35B41CF95; Tue, 6 Feb 2024 20:19:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="vA3VH49Y" 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 839D31BF47 for ; Tue, 6 Feb 2024 20:19:16 +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=1707250758; cv=none; b=h1600yFwLFB2RDFj+6P7CFVU4k0+fUJbpqweoL5Zk9nHQ6hSnp97kPxWFE1L2Tcm4uTFbPiEW1H+oLw2POEJXWIoqauAmZ9x78WPepP9CsJv0IVFcT/s1S3tdaa7q4l/i0pGfJCAS9TYCztCvpaRWGMe+Bkk6J9jHyG9AXMgVas= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707250758; c=relaxed/simple; bh=X3Sg2AcjCoYlzGPQWL0/90G/r75mZK7+imgUhXh2xWA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=quC0XDuo7VOOVXkhKFs5DHQZ2uepxoD5xHJo8WuC6jF4l0AQKjt5QKKB6VmBPYi4IYDaa8KWUphS85Aym9QH37ZUmwtKpJU2l010KIuW9/h/c/lF2RUnocIb6kaR66Exir4BVH1ayyp7iI/9G28aJ7iUUZfInnAn5kCiamKDgDw= 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=vA3VH49Y; 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=1707250754; 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=HS2DNqPoHrMr86/7fyMQRw3X2SfMSsS/w2jgXzblZj4=; b=vA3VH49YCcbP41sLGedvzTPAn2RynBfx0oSwhUmEScLf6JBSIVcYOlbbQtSrx3ASP3zNY2 QbA4jIQAfA8EGNBrsQw7YFPAhjsPQRPuH18QPrjmH0NrFuOiswNii8I0E2VRhipLZCA6eZ 3eBxPfmco1kleAeQooJV/izdzqViSac= From: Kent Overstreet To: brauner@kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Kent Overstreet Subject: [PATCH v2 7/7] bcachefs: add support for FS_IOC_GETSYSFSNAME Date: Tue, 6 Feb 2024 15:18:55 -0500 Message-ID: <20240206201858.952303-8-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: 1790182320108275943 X-GMAIL-MSGID: 1790182320108275943 Signed-off-by: Kent Overstreet --- fs/bcachefs/fs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/bcachefs/fs.c b/fs/bcachefs/fs.c index 68e9a89e42bb..785438dbe7ef 100644 --- a/fs/bcachefs/fs.c +++ b/fs/bcachefs/fs.c @@ -1947,6 +1947,7 @@ static struct dentry *bch2_mount(struct file_system_type *fs_type, sb->s_time_min = div_s64(S64_MIN, c->sb.time_units_per_sec) + 1; sb->s_time_max = div_s64(S64_MAX, c->sb.time_units_per_sec); super_set_uuid(sb, c->sb.user_uuid.b, sizeof(c->sb.user_uuid)); + snprintf(sb->s_sysfs_name, sizeof(sb->s_sysfs_name), "%pU", c->sb.user_uuid.b); c->vfs_sb = sb; strscpy(sb->s_id, c->name, sizeof(sb->s_id));