From: NeilBrown Date: Mon, 13 Oct 2008 00:55:11 +0000 (+1100) Subject: md: Allow metadata_version to be updated for externally managed metadata. X-Git-Tag: v2.6.28-rc1~288^2~13 X-Git-Url: http://www.pilppa.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=ea43ddd8491feccf36267349748ea91b1194481e;p=linux-2.6-omap-h63xx.git md: Allow metadata_version to be updated for externally managed metadata. For externally managed metadata, the 'metadata_version' sysfs attribute is really just a channel for user-space programs to communicate about how the array is being managed. It can be useful for this to be changed while the array is active. Normally changes to metadata_version are not permitted while the array is active. Change that so that if the metadata is externally managed, the metadata_version can be changed to a different flavour of external management. Signed-off-by: NeilBrown --- diff --git a/drivers/md/md.c b/drivers/md/md.c index 7d8c2bb0a67..13dd7b27615 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -2943,7 +2943,13 @@ metadata_store(mddev_t *mddev, const char *buf, size_t len) { int major, minor; char *e; - if (!list_empty(&mddev->disks)) + /* Changing the details of 'external' metadata is + * always permitted. Otherwise there must be + * no devices attached to the array. + */ + if (mddev->external && strncmp(buf, "external:", 9) == 0) + ; + else if (!list_empty(&mddev->disks)) return -EBUSY; if (cmd_match(buf, "none")) {