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: 13547767 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 947CC17BAE for ; Tue, 6 Feb 2024 20:19:10 +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=1707250752; cv=none; b=PNYNGofOPP+hekCo6SgkYuYIZEqL6GNKVrE+4F8iBqUCyKOD/6y/eBMqTOWuG83BHujQcnQm/8w1ZOcL45yS25k00ZaYE1EJ4/3C/MDH8dh2s6tk/cdVJpf6xKPAuTpxOth5Dt8zSu9HMKE5d7oArd9oatxHjB7SUUDdnIUtxus= 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.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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="ItsvzwHw" 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-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT 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: 13547768 Received: from out-171.mta0.migadu.com (out-171.mta0.migadu.com [91.218.175.171]) (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 885C217BB9 for ; Tue, 6 Feb 2024 20:19:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707250753; cv=none; b=PP2dbiBrMxHglqAX5OLY+GInH27a3CMRH5QJ+52jVFDFNT/mZLfCSH01f9zyLjEgZTcEc/Ldh+pq9IRR2/yXpX58qaY+7zBLoVg6QKyRsKYduGj22A3GRrJ9TsIKeigsvnnGsrXx8M31MWsG+s8IbkR9BbgEpYna7iwJD13Uyyk= 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.171 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="OhqAo2ny" 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-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT 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: 13547769 Received: from out-181.mta0.migadu.com (out-181.mta0.migadu.com [91.218.175.181]) (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 ECA7218AF8 for ; Tue, 6 Feb 2024 20:19:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707250754; cv=none; b=O2FSbU3BnbvahNTYc7Du0ExO9vuK0g+l35cZ9MkRzlLP/afOSPaAEcPSCFZBaJMLD521+MoQyPik/o/97EFe2F3GwMgFhk38xCrDevdXgNN4fgha7CiRR1h93gpVtNKe7KiIuTdK6p9qG6ocamgTWGR8m6XWByR4llNvMmF/jxA= 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.181 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="pD1lnZx2" 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-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT 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: 13547770 Received: from out-187.mta0.migadu.com (out-187.mta0.migadu.com [91.218.175.187]) (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 993651B275 for ; Tue, 6 Feb 2024 20:19:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.187 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707250755; cv=none; b=sMIwnCGK1EVZwZEKfpsNCOFlZmpLMc1EDg3gH0NRbeqliJlMFjzORjx2mcbq77oWQnT5TJo0aU04PNDmWgtjGMZBGOp5gcn582IuQHNJe1mGGewOZOwqxphJmVT7/5MdUfxedQ1wAYlq61odklo9hmGTf0oro4fCaeN3ORGsWmo= 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.187 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="fwScqX0m" 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-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT 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: 13547771 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 BD6851B81C for ; Tue, 6 Feb 2024 20:19:14 +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=1707250756; cv=none; b=TBRsJZmE9vqt2nxctNCWi/DZfum0QxCidhERX3dyCuxgBiRyPs3kIc6UihswIfYvAD6bDOHOjoFZ+1dILpgXd4GFtenfdJGVMAlTsQ9QnQUrmBjPPZT8mG0cDoORSzaNNSglgnPc/Te1CHhBhyuZKpIWLEo+m4SIp8SsEg/eD04= 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.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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="DKSKc9Qu" 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-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT 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: 13547772 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 A16611BC30 for ; Tue, 6 Feb 2024 20:19:15 +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=1707250757; cv=none; b=YlVXfdcXWuvVjntJaHSj8VOX1i6N5Lx/bungvrUvrsqaUTcO/roCK4Lk9tCmIda7CXKA0+ltucgcM6ywQm8MEYxxUM4HTdFd4DdCSFRar4vzWzxUFplJcg79gD5HwMDZDymEWiXotZuOuRIh8nyJuIjXqArC0Fxukygd++EH+G4= 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.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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="uprbPkH6" 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-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT 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: 13547773 Received: from out-173.mta0.migadu.com (out-173.mta0.migadu.com [91.218.175.173]) (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 491D11BF3A for ; Tue, 6 Feb 2024 20:19:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707250757; cv=none; b=DpEcSg2D1MxebGhJ2db9kbu08xt1eLNUcB4us90e5yJDEUfrPGYzaMjwXPSQEAv1/dbkI5fZMseZfGtKv7J3+yk+f4HICTFOcuhEVPlRQwQx6pbNtliAzM6OhpomzsxvsGUduKx8Rz2XV43wjWTWbsc12UvakOJTK0y/JLnDKws= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707250757; c=relaxed/simple; bh=X3Sg2AcjCoYlzGPQWL0/90G/r75mZK7+imgUhXh2xWA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uB4/0CBmZuQNjYim26mgg6KTIasmkdwr9G4UqRAWDhTaaHJCkerO4Wdz+3BUNqJwRJGk1/P9LdnKQQuK+s5oiNV/hwkFO8WDGX/VEEvo01BZGfLmuOI8zyO6AqUITWQTsyBm7AR5xdJp5Bz03FpcTwR/LKYYi5HCLC/3Rt3RWDQ= 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.173 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="vA3VH49Y" 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-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT 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));