From: Abd-Alrhman Masalkhi <abd.masalkhi@gmail.com>
To: song@kernel.org, yukuai@fygo.io, chengzhihao1@huawei.com,
magiclinan@didiglobal.com, xiao@kernel.org
Cc: linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org,
Abd-Alrhman Masalkhi <abd.masalkhi@gmail.com>
Subject: [RFC PATCH v2 0/4] md: add a control device for array management
Date: Thu, 1 Oct 2026 12:56:07 +0000 [thread overview]
Message-ID: <20261001125611.943731-1-abd.masalkhi@gmail.com> (raw)
Hi,
This series adds a new /dev/md-control misc character device for
managing md arrays without opening the corresponding md block device.
Currently, md management ioctls are issued on the md block device
itself, which requires the caller to hold the array open while
configuring or stopping it.
This is a problem for STOP_ARRAY and STOP_ARRAY_RO. Before the array is
stopped, the page cache must be flushed, and no other task may have the
device open or be writing to it. The issue arises when several tasks
share the same file descriptor table, as they count as a single opener.
Consequently, one task may still be writing while another task flushes
the page cache and stops the array. A write within this window can race
with the stop operation.
The new control device is not tied to any md array. Each request
identifies the target array by name, UUID, or device number, and
carries a flags field. Unknown flags are rejected with -ENOTTY. The new
commands mirror the existing md block-device ioctls, with STOP_ARRAY_RO
represented by MD_STOP_ARRAY with MD_RO_FLAG set.
New 64-bit structures, including mdu_ioctl, are introduced
(mdu_array_info64, mdu_disk_info64, mdu_param64, mdu_bitmap_file64,
and mdu_version64) to resolve padding and overflow issues in fields
such as size, ctime, and utime.
The existing md block-device ioctl interface remains unchanged.
A warning is emitted when it is used to recommend upgrading mdadm to
use the new control interface.
The mdadm has been modified correspondingly:
Link: https://lore.kernel.org/linux-raid/20260928211849.3602414-1-abd.masalkhi@gmail.com
This is an RFC because the new UAPI (struct mdu_ioctl, mdu_array_info64,
mdu_disk_info64, mdu_param64, mdu_bitmap_file64, and mdu_version64 and
the new command set). I am thinking about adding a new command
MD_NEW_ARRAY or MD_CREATE_ARRAY to create a new array. Feedback on the
interface is welcome.
I am aslo considering adding a command to create a new array
MD_NEW_ARRAY/MD_CREATE_ARRAY.
I am thinking of adding a new command MD_NEW_ARRAY or MD_CREATE_ARRAY
to create a new array.
Changes in v2:
- Move the code from md-ctl.c into md.c and remove md-ctl.c.
- Handle the new commands directly in mdctl_ioctl() instead of
converting them to the old ioctls.
- Use a dynamic misc minor number for /dev/md-control.
- Drop the devname module alias, which only works with a fixed minor.
- Fix the issues reported by sashiko-bot.
- Take disks_mutex around the lookups, so that they never see an
mddev that md_alloc() has not finished.
- Clear hold_active only when a command succeeds.
- Link-v1: https://lore.kernel.org/linux-raid/20260928201224.3602262-1-abd.masalkhi@gmail.com
Abd-Alrhman Masalkhi
Abd-Alrhman Masalkhi (4):
md: add uapi definitions for the md control device
md: pass struct mdu_disk_info64 to md_add_new_disk()
md: use struct mdu_array_info64 for SET_ARRAY_INFO
md: add a control device for array management
drivers/md/md-autodetect.c | 4 +-
drivers/md/md.c | 700 ++++++++++++++++++++++++++++++++-
drivers/md/md.h | 17 +-
include/uapi/linux/raid/md_u.h | 119 ++++++
4 files changed, 820 insertions(+), 20 deletions(-)
base-commit: 5c2f4115051d064ad79b0b4edac70a2b62528d9d
--
2.43.0
next reply other threads:[~2026-10-01 12:56 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-01 12:56 Abd-Alrhman Masalkhi [this message]
2026-10-01 12:56 ` [RFC PATCH v2 1/4] md: add uapi definitions for the md control device Abd-Alrhman Masalkhi
2026-10-01 12:56 ` [RFC PATCH v2 2/4] md: pass struct mdu_disk_info64 to md_add_new_disk() Abd-Alrhman Masalkhi
2026-10-01 12:56 ` [RFC PATCH v2 3/4] md: use struct mdu_array_info64 for SET_ARRAY_INFO Abd-Alrhman Masalkhi
2026-10-01 12:56 ` [RFC PATCH v2 4/4] md: add a control device for array management Abd-Alrhman Masalkhi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261001125611.943731-1-abd.masalkhi@gmail.com \
--to=abd.masalkhi@gmail.com \
--cc=chengzhihao1@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=magiclinan@didiglobal.com \
--cc=song@kernel.org \
--cc=xiao@kernel.org \
--cc=yukuai@fygo.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®