From: Doug Ledford <dledford@redhat.com>
To: Linux RAID Mailing List <linux-raid@vger.kernel.org>
Subject: Re: More Hot Unplug/Plug work
Date: Wed, 28 Apr 2010 17:16:01 -0400 [thread overview]
Message-ID: <4BD8A591.3000702@redhat.com> (raw)
In-Reply-To: <20100428205937.GB6065@maude.comedia.it>
[-- Attachment #1: Type: text/plain, Size: 2496 bytes --]
On 04/28/2010 04:59 PM, Luca Berra wrote:
> On Wed, Apr 28, 2010 at 01:47:55PM -0400, Doug Ledford wrote:
>> DOMAIN path=pci-0000:00:1f.2-scsi-[2345]:0:0:0 action=partition
>> table=/etc/mdadm.table program=sfdisk
> i admit i did not take the time to pull from your git, so tell me to
> rtfc if needed.
rtfc ;-)
> it seems you are assuming program will take table as stdin.
No, table is program specific. In this case, for sfdisk, it would be
something taken as stdin. However, in the code, there is a specific
handler for the sfdisk program type. That handler provides a validate
routine to check the contents of the table= entry and make sure it's
valid, a check routine to check the table on a given disk and see if it
matches what it's supposed to be, and a write routine to update the
disks table to what it should be. How it goes about doing these things
is particular to the sfdisk handler. I do have plans to add a more
generic simple script handler that would allow you to pass things in as
you suggest, but I have not yet implemented it. And part of the reason
is that I'm extremely leary of the security implications of allowing a
text file to spell out a program to be called by a root invoked system
daemon. I can see a million different ways to compromise a system when
a daemon with raw disk access reads a command from a text file.
> would not it be better to use somethink like
> action=initialize command="sfdisk %d < /etc/mdadm.table" ?
> where command is invoked via a shell and %d is replaced with the device
> node. (more escapes could also be useful, e.g. the sysfs node)
This is precisely what the sfdisk handler will be doing, only it won't
be reading the command from the text file, it will have the knowledge of
how to invoke sfdisk safely compiled into the program where compromise
is much more difficult.
> besides that is there any provisioning to check that the device really
> is empty before running action?
Yes. In the code that tries to take new disks, it requires either the
force-partition option or that the device be declared clean, which per
Neil's suggestion is that both the first 4k and last 4k of the device is
comprised entirely of one of three patterns: 0x00, 0x5a, 0xff.
--
Doug Ledford <dledford@redhat.com>
GPG KeyID: CFBFF194
http://people.redhat.com/dledford
Infiniband specific RPMs available at
http://people.redhat.com/dledford/Infiniband
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
next prev parent reply other threads:[~2010-04-28 21:16 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-27 16:45 More Hot Unplug/Plug work Doug Ledford
2010-04-27 19:41 ` Christian Gatzemeier
2010-04-28 16:08 ` Labun, Marcin
2010-04-28 17:47 ` Doug Ledford
2010-04-28 18:34 ` Labun, Marcin
2010-04-28 21:05 ` Doug Ledford
2010-04-28 21:13 ` Dan Williams
2010-04-30 13:38 ` Doug Ledford
2010-04-29 1:01 ` Neil Brown
2010-04-29 1:19 ` Dan Williams
2010-04-29 2:37 ` Neil Brown
2010-04-29 18:22 ` Labun, Marcin
2010-04-29 21:55 ` Dan Williams
2010-05-03 5:58 ` Neil Brown
2010-05-08 1:06 ` Dan Williams
2010-04-30 16:13 ` Doug Ledford
2010-04-30 11:14 ` John Robinson
2010-04-30 15:52 ` Doug Ledford
2010-04-28 20:59 ` Luca Berra
2010-04-28 21:16 ` Doug Ledford [this message]
2010-04-29 20:32 ` Dan Williams
2010-04-29 21:22 ` Dan Williams
2010-04-30 16:26 ` Doug Ledford
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=4BD8A591.3000702@redhat.com \
--to=dledford@redhat.com \
--cc=linux-raid@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).