Message ID | 20240205200529.546646-2-kent.overstreet@linux.dev |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-53886-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp1164153dyb; Mon, 5 Feb 2024 13:51:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IEZLw5zRD+7BSjux01XsMoA2aE9D6pdbQhInMdUZ4OuALvPzX2WD0ZXbuN3Rdw13sgG0itW X-Received: by 2002:a05:6870:434f:b0:218:edd0:439b with SMTP id x15-20020a056870434f00b00218edd0439bmr578611oah.28.1707169919728; Mon, 05 Feb 2024 13:51:59 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707169919; cv=pass; d=google.com; s=arc-20160816; b=MORwmy0zdQMvQWnXDLjQ+3AcfaPWAB+y3Voo4+mPcafIdE1c6sEwNPZlLhwZZInvBf d6GIulSWYqaK/N8Rn3ijjxLhzktPfU+n4rQiAi0InTr/3+XZ/vescW9ieqGnsA39Vzg2 2+4Ql4Eqd/ix3xx2QKtxAdN3sqMJudzqQeVQC7Xueqar1IhbZM2CdGpniqlJ5CtOEtgQ cz6+UySHEwjqhmzgNkSn7lcLykwQlHXYB5S1vTXjO6HBGL/fTB6boxZDM6RHXIOK6s9u VsESY/T66Gnv0bGHA5Zut/uQMZwUV/qYQI7xFx/9mHwoX6By6ay30bIONEBs0G5Zj63j WrQQ== 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=mxk7XRZEL0snESkDWwhfb1zBoSWiW2T8Lz3o6KIMn8M=; fh=W07hrQAf2guqB9XBoX1ppxeXxsPUVG9Srcuzj9BjqiE=; b=T9pkD/HFdkqWMKh153le1bB5G1vwNQ5FGhq+tdpFU9b8aGEoIFmpwb8pflHC6z1Gts 8d8UW4tC7dAaxbc7EEV+Y7VT2U2y1w+ZTl3ghWE2F/8FkBtWfndRh+xm2X7z350yGiNE zTvBVW6WAnSkvXXd2VdkU3B3Lnd5ml10Of1GQ9dhpgH0OzRblhMSfNWimIFm+4K2N16k qBKpyqMQW+BXN+dkh2bB/U40vdUQckfRd399oGKJhj4pBQEWrnHmJ5r/6a8+04faPAgr n7dAj8R0OONlNO0REqDSkbcc71l+1IzvbHjpt1hF9YtyjfaZG98Yj60iGhAXb9XmbTEf pn4g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b="uob/dDzx"; 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-53886-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-53886-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev X-Forwarded-Encrypted: i=1; AJvYcCWi4iqsW8/79ZNGOXHt+utLvTZd0wA0cVt0QXBq2FBWSifsbsXV4gerHJdxMm2TkPzLaBxauBtb8p0mZHoVTfJ3iDlAhg== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id m185-20020a633fc2000000b005ce0205d0cfsi494749pga.306.2024.02.05.13.51.59 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Feb 2024 13:51:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-53886-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="uob/dDzx"; 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-53886-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-53886-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 A79C4289B00 for <ouuuleilei@gmail.com>; Mon, 5 Feb 2024 21:39:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 08BD212BF01; Mon, 5 Feb 2024 20:06:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="uob/dDzx" 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 9311A12A16C; Mon, 5 Feb 2024 20:06:06 +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=1707163568; cv=none; b=WG5zig3iEu5YanU0Dr/q2NkGiT1faHMkJK8JkZZc6Erb2uoo2lvmCbrNHKzV4SoJbHhvzdEqCPRpfcD/nuh3ljxmfEAb+07G8dflJk7s+OW1pNCr/EyuN2hD0OkSMrME9XP/vtFSndkCOkJlsU1+SQ1gWM+uBaOtbvy+GlMxWVU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707163568; c=relaxed/simple; bh=sT0YhdGMz+E9RZmaN5yZSWMd1g+aYCrhSj7fqmLAo7o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=iojZrQAi08dpdEkl+Iau1yW5TSwjo7Pp1GOhe//l2BFPdMLj4NrYQE7XXZ7sEfaHQqvLOzp1n8JybIeAmeqFpTPZyBwIIY3AeoxQBUY4wUfm8IjYYFOHqYppIfq2Y+KnG2Xj76VtCVyQSzrfhzi+EpE2P7xtYOjR0a9qSFOWvMQ= 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=uob/dDzx; 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 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=1707163564; 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=mxk7XRZEL0snESkDWwhfb1zBoSWiW2T8Lz3o6KIMn8M=; b=uob/dDzxQcIREDsMEM9g/iWBuz0YPHzPTzop+cY2f31oBhFBJpCrXqtQ7KCYfdmuorHek/ 3BdFAyeJ8xmW3cVWSpJ8jwVBKqrGw114zEAqI1kXcx6EbAAY7oyS1MVSqTQRGZeWGiMh3T 67MIwynAHlE/7CcJzvVvZxLHj5EuROc= From: Kent Overstreet <kent.overstreet@linux.dev> To: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-xfs@vger.kernel.org, linux-ext4@vger.kernel.org Cc: Kent Overstreet <kent.overstreet@linux.dev> Subject: [PATCH 1/6] fs: super_block->s_uuid_len Date: Mon, 5 Feb 2024 15:05:12 -0500 Message-ID: <20240205200529.546646-2-kent.overstreet@linux.dev> In-Reply-To: <20240205200529.546646-1-kent.overstreet@linux.dev> References: <20240205200529.546646-1-kent.overstreet@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790097405703080062 X-GMAIL-MSGID: 1790097405703080062 |
Series | filesystem visibility ioctls | |
Commit Message
Kent Overstreet
Feb. 5, 2024, 8:05 p.m. UTC
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.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
---
fs/super.c | 1 +
include/linux/fs.h | 1 +
2 files changed, 2 insertions(+)
Comments
On Mon, Feb 05, 2024 at 03:05:12PM -0500, Kent Overstreet wrote: > 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. > > Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> > --- > fs/super.c | 1 + > include/linux/fs.h | 1 + > 2 files changed, 2 insertions(+) > > diff --git a/fs/super.c b/fs/super.c > index d35e85295489..ed688d2a58a7 100644 > --- a/fs/super.c > +++ b/fs/super.c > @@ -375,6 +375,7 @@ static struct super_block *alloc_super(struct file_system_type *type, int flags, > s->s_time_gran = 1000000000; > s->s_time_min = TIME64_MIN; > s->s_time_max = TIME64_MAX; > + s->s_uuid_len = sizeof(s->s_uuid); So if the filesystem doesn't copy a uuid into sb->s_uuid, then we allow those 16 bytes to be pulled from userspace? Shouldn't this only get set when the filesystem copies it's uuid to the superblock? And then in the get uuid ioctl, if s_uuid_len is zero we can return -ENOENT to indicate the filesystem doesn't have a UUID, rather that require userspace to determine a filesystem doesn't have a valid UUID somehow... -Dave.
On Tue, Feb 06, 2024 at 08:58:49AM +1100, Dave Chinner wrote: > On Mon, Feb 05, 2024 at 03:05:12PM -0500, Kent Overstreet wrote: > > 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. > > > > Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> > > --- > > fs/super.c | 1 + > > include/linux/fs.h | 1 + > > 2 files changed, 2 insertions(+) > > > > diff --git a/fs/super.c b/fs/super.c > > index d35e85295489..ed688d2a58a7 100644 > > --- a/fs/super.c > > +++ b/fs/super.c > > @@ -375,6 +375,7 @@ static struct super_block *alloc_super(struct file_system_type *type, int flags, > > s->s_time_gran = 1000000000; > > s->s_time_min = TIME64_MIN; > > s->s_time_max = TIME64_MAX; > > + s->s_uuid_len = sizeof(s->s_uuid); > > So if the filesystem doesn't copy a uuid into sb->s_uuid, then we > allow those 16 bytes to be pulled from userspace? > > Shouldn't this only get set when the filesystem copies it's uuid > to the superblock? > > And then in the get uuid ioctl, if s_uuid_len is zero we can return > -ENOENT to indicate the filesystem doesn't have a UUID, rather that > require userspace to determine a filesystem doesn't have a valid > UUID somehow... *nod* this all falls out of your super_set_uuid() suggestion
diff --git a/fs/super.c b/fs/super.c index d35e85295489..ed688d2a58a7 100644 --- a/fs/super.c +++ b/fs/super.c @@ -375,6 +375,7 @@ static struct super_block *alloc_super(struct file_system_type *type, int flags, s->s_time_gran = 1000000000; s->s_time_min = TIME64_MIN; s->s_time_max = TIME64_MAX; + s->s_uuid_len = sizeof(s->s_uuid); s->s_shrink = shrinker_alloc(SHRINKER_NUMA_AWARE | SHRINKER_MEMCG_AWARE, "sb-%s", type->name); diff --git a/include/linux/fs.h b/include/linux/fs.h index ed5966a70495..ff41ea6c3a9c 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;