From nobody Wed Feb 08 14:27:53 2023 X-Original-To: freebsd-hackers@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PBj5f22JJz3nTWZ for ; Wed, 8 Feb 2023 14:28:06 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-vk1-f177.google.com (mail-vk1-f177.google.com [209.85.221.177]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PBj5f0C1Pz4NCx for ; Wed, 8 Feb 2023 14:28:06 +0000 (UTC) (envelope-from asomers@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-vk1-f177.google.com with SMTP id r28so2970198vka.4 for ; Wed, 08 Feb 2023 06:28:06 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=98LO4QJZRi9hCRKKJPa7fdR9ukzd1IVP2/Gy/Alv+W8=; b=O3LB9qvl0eiHtzhVp0FUCpJUvWfmDdJ25+IYoNb7BRwmtuTmRZDxHCZTMhN7Zv6JFF mL/meWCdAWkYSy+8VJknaLF/OOb43/Xlu4yn+2lykq/pvC1jpIZpiCTqzruFAEqqgkcu G8ZpGAPw846se2OY2bbG7k/waLVLnm0q8HFsM8Tx8GzJSBOmTa31fM7ebl8g705PzVP1 80KMoJ5Rg58ujYVInJb+h462k2q3AFJUZzfWQbCSOy4MAXvuPU/mxwVM028XTvPXYG5e zO3k2+p6Z6Ekz1eTnVl01bFeUwcVlxLHhyia5jPISIXI266/PcarlMvz6WMLPUskAHsq z1zQ== X-Gm-Message-State: AO0yUKWnWqRpIg1cOL0smn5OxZypoHkd08SKH9EllJByYTQ8kRGT52Pu /GqBVrpzq2VHaKN4EwNDyFGunGbqxFdJdjXSyTU= X-Google-Smtp-Source: AK7set+dEGMBHoMdzJ1o+Yc14ic1KgGL5wNF1DyUiB0Xi0xRKMNBAZcLR2Y7j6qkwJO/CLuaH0Hp27dP0F38TlkzywQ= X-Received: by 2002:a1f:274d:0:b0:3e8:791d:5ee with SMTP id n74-20020a1f274d000000b003e8791d05eemr1775225vkn.14.1675866484961; Wed, 08 Feb 2023 06:28:04 -0800 (PST) List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@freebsd.org MIME-Version: 1.0 References: <0155CD68-849E-40D6-95A5-6AAD5E229A57@gmail.com> In-Reply-To: <0155CD68-849E-40D6-95A5-6AAD5E229A57@gmail.com> From: Alan Somers Date: Wed, 8 Feb 2023 07:27:53 -0700 Message-ID: Subject: Re: RFC: GEOM and hard disk LEDs To: Enji Cooper Cc: FreeBSD Hackers Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4PBj5f0C1Pz4NCx X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-ThisMailContainsUnwantedMimeParts: N On Tue, Feb 7, 2023 at 11:56 PM Enji Cooper wrote: > > > > On Feb 7, 2023, at 3:30 PM, Alan Somers wrote: > > > > Most modern SES backplanes have two LEDs per hard disk. There's a > > "fault" LED and a "locate" LED. You can control either one with > > sesutil(8) or, with a little more work, sg_ses from > > sysutils/sg3_utils. They're very handy for tasks like replacing a > > failed disk, especially in large enclosures. However, there isn't any > > way to automatically control them. It would be very convenient if, > > for example, zfsd(8) could do it. Basically, it would just set the > > fault LED for any disk that has been kicked out of a ZFS pool, and > > clear it for any disk that is healthy or is being resilvered. But > > zfsd does not do that. Instead, users' only options are to write a > > custom daemon or to use sesutil by hand. Instead of forcing all of us > > to write our own custom daemons, why not train zfsd to do it? > > > > My proposal is to add boolean GEOM attributes for "fault" and > > "locate". A userspace program would be able to look up their values > > for any geom with DIOCGATTR. Setting them would require a new ioctl > > (DIOCSATTR?). The disk class would issue a ENCIOC_SETELMSTAT to > > actually change the LEDs whenever this attribute changes. GEOM > > transforms such as geli would simply pass the attribute through to > > lower layers. Many-to-one transforms like gmultipath would pass the > > attribute through to all lower layers. zfsd could then set all vdevs' > > fault attributes when it starts up, and adjust individual disk's as > > appropriate on an event-driven basis. > > > > Questions: > > > > * Are there any obvious flaws in this plan, any reasons why GEOM > > attributes can't be used this way? > > > > * For one-to-many transforms like gpart the correct behavior is less > > clear: what if a disk has two partitions in two different pools, and > > one of them is healthy but the other isn't? > > > > * Besides ZFS, are there any other systems that could take advantage? > > > > * SATA enclosures uses SGPIO instead of SES. SGPIO is too limited, > > IMHO, to be of almost any use at all. I suggest not even trying to > > make it work with this scheme. > > Out of curiosity, is there a way that a client of zfsd could instead reach out to zfsd via a pipe, etc, when an event triggered by devd occurs? > Just trying to think of a way that would result in a cleaner architecture than having zfsd doing a busy-loop of some kind waiting for an event to happen. > Thanks, > -Enji What do you mean a "client of zfsd"? The current architecture is that zfsd blocks waiting for events from devd. It reads from /var/run/devd.seqpacket.pipe.