* Re: [PATCH 1/9] MD: add a new disk role to present cache device
From: NeilBrown @ 2015-08-05 1:05 UTC (permalink / raw)
To: Shaohua Li; +Cc: linux-raid, Kernel-team, songliubraving, hch, dan.j.williams
In-Reply-To: <e871cc4fc266c76f1d4b55225f2c0a6aacb18680.1438215986.git.shli@fb.com>
On Wed, 29 Jul 2015 17:38:41 -0700 Shaohua Li <shli@fb.com> wrote:
> From: Song Liu <songliubraving@fb.com>
>
> Next patches will use a disk as raid5/6 caching. We need a new disk role
> to present the cache device and add MD_FEATURE_WRITE_CACHE to
> feature_map for backward compability.
>
> Signed-off-by: Song Liu <songliubraving@fb.com>
> Signed-off-by: Shaohua Li <shli@fb.com>
> ---
> drivers/md/md.c | 24 ++++++++++++++++++++++--
> drivers/md/md.h | 4 ++++
> include/uapi/linux/raid/md_p.h | 3 +++
> 3 files changed, 29 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/md/md.c b/drivers/md/md.c
> index d429c30..fd84f16 100644
> --- a/drivers/md/md.c
> +++ b/drivers/md/md.c
> @@ -1656,6 +1656,16 @@ static int super_1_validate(struct mddev *mddev, struct md_rdev *rdev)
> case 0xfffe: /* faulty */
> set_bit(Faulty, &rdev->flags);
> break;
> + case 0xfffd: /* cache device */
> + if (!(sb->feature_map & MD_FEATURE_WRITE_CACHE)) {
> + /* cache device without cache feature */
> + printk(KERN_WARNING
> + "md: cache device provided without write "
> + "cache feature, ignoring the device\n");
> + return -EINVAL;
> + }
> + set_bit(WriteCache, &rdev->flags);
> + break;
> default:
> rdev->saved_raid_disk = role;
> if ((le32_to_cpu(sb->feature_map) &
> @@ -1811,7 +1821,10 @@ static void super_1_sync(struct mddev *mddev, struct md_rdev *rdev)
> sb->dev_roles[i] = cpu_to_le16(0xfffe);
> else if (test_bit(In_sync, &rdev2->flags))
> sb->dev_roles[i] = cpu_to_le16(rdev2->raid_disk);
> - else if (rdev2->raid_disk >= 0)
> + else if (test_bit(WriteCache, &rdev2->flags)) {
> + sb->dev_roles[i] = cpu_to_le16(0xfffd);
> + sb->feature_map |= cpu_to_le32(MD_FEATURE_WRITE_CACHE);
> + } else if (rdev2->raid_disk >= 0)
> sb->dev_roles[i] = cpu_to_le16(rdev2->raid_disk);
> else
> sb->dev_roles[i] = cpu_to_le16(0xffff);
> @@ -5803,7 +5816,8 @@ static int get_disk_info(struct mddev *mddev, void __user * arg)
> else if (test_bit(In_sync, &rdev->flags)) {
> info.state |= (1<<MD_DISK_ACTIVE);
> info.state |= (1<<MD_DISK_SYNC);
> - }
> + } else if (test_bit(WriteCache, &rdev->flags))
> + info.state |= (1<<MD_DISK_WRITECACHE);
> if (test_bit(WriteMostly, &rdev->flags))
> info.state |= (1<<MD_DISK_WRITEMOSTLY);
> } else {
> @@ -5918,6 +5932,8 @@ static int add_new_disk(struct mddev *mddev, mdu_disk_info_t *info)
> else
> clear_bit(WriteMostly, &rdev->flags);
>
> + if (info->state & (1<<MD_DISK_WRITECACHE))
> + set_bit(WriteCache, &rdev->flags);
> /*
> * check whether the device shows up in other nodes
> */
> @@ -7286,6 +7302,10 @@ static int md_seq_show(struct seq_file *seq, void *v)
> seq_printf(seq, "(F)");
> continue;
> }
> + if (test_bit(WriteCache, &rdev->flags)) {
> + seq_printf(seq, "(C)");
> + continue;
> + }
> if (rdev->raid_disk < 0)
> seq_printf(seq, "(S)"); /* spare */
> if (test_bit(Replacement, &rdev->flags))
> diff --git a/drivers/md/md.h b/drivers/md/md.h
> index 7da6e9c..a9f27db 100644
> --- a/drivers/md/md.h
> +++ b/drivers/md/md.h
> @@ -176,6 +176,10 @@ enum flag_bits {
> * This device is seen locally but not
> * by the whole cluster
> */
> + WriteCache, /* This device is used as write cache.
> + * Usually, this device should be faster
> + * than other devices in the array
> + */
> };
>
> #define BB_LEN_MASK (0x00000000000001FFULL)
> diff --git a/include/uapi/linux/raid/md_p.h b/include/uapi/linux/raid/md_p.h
> index 2ae6131..8c8e12c 100644
> --- a/include/uapi/linux/raid/md_p.h
> +++ b/include/uapi/linux/raid/md_p.h
> @@ -89,6 +89,7 @@
> * read requests will only be sent here in
> * dire need
> */
> +#define MD_DISK_WRITECACHE 18 /* disk is used as the write cache in RAID-5/6 */
>
> typedef struct mdp_device_descriptor_s {
> __u32 number; /* 0 Device number in the entire set */
> @@ -302,6 +303,7 @@ struct mdp_superblock_1 {
> #define MD_FEATURE_RECOVERY_BITMAP 128 /* recovery that is happening
> * is guided by bitmap.
> */
> +#define MD_FEATURE_WRITE_CACHE 256 /* support write cache */
> #define MD_FEATURE_ALL (MD_FEATURE_BITMAP_OFFSET \
> |MD_FEATURE_RECOVERY_OFFSET \
> |MD_FEATURE_RESHAPE_ACTIVE \
> @@ -310,6 +312,7 @@ struct mdp_superblock_1 {
> |MD_FEATURE_RESHAPE_BACKWARDS \
> |MD_FEATURE_NEW_OFFSET \
> |MD_FEATURE_RECOVERY_BITMAP \
> + |MD_FEATURE_WRITE_CACHE \
> )
>
> #endif
That last line is technically a bit premature. Once you add
MD_FEATURE_WRITE_CACHE to MD_FEATURE_ALL, super_1_load will start
accepting metadata with that bit set. We should really leave that
until the code is really ready to deal with it.
Otherwise this patch is OK.
Thanks,
NeilBrown
^ permalink raw reply
* Re: [PATCH 1/9] MD: add a new disk role to present cache device
From: NeilBrown @ 2015-08-05 0:25 UTC (permalink / raw)
To: Song Liu
Cc: Christoph Hellwig, Shaohua Li, linux-raid@vger.kernel.org,
Kernel Team, dan.j.williams@intel.com
In-Reply-To: <C709E4D363AAB64590BFAC54D4C478AA0104B1CF0D@PRN-MBX02-4.TheFacebook.com>
On Tue, 4 Aug 2015 18:17:25 +0000 Song Liu <songliubraving@fb.com>
wrote:
> > -----Original Message-----
> > From: Christoph Hellwig [mailto:hch@infradead.org]
> > Sent: Tuesday, August 4, 2015 7:28 AM
> > To: Shaohua Li
> > Cc: linux-raid@vger.kernel.org; Kernel Team; Song Liu; hch@infradead.org;
> > dan.j.williams@intel.com; neilb@suse.de
> > Subject: Re: [PATCH 1/9] MD: add a new disk role to present cache device
> >
> > > case 0xfffe: /* faulty */
> > > set_bit(Faulty, &rdev->flags);
> > > break;
> > > + case 0xfffd: /* cache device */
> >
> > Any chance to get constants for these magic numbers as an additional prep
> > patch?
> I will add patch for special roles (spare, faulty, cache, etc.).
>
>
> >
> > Also I don't really think that adding the role without the actual implementation
> > is that useful.
>
> Currently, we are planning to use 0xfffd for both "cache device" and
> "journal device" (fix write hole only). Would you prefer to separate these
> two scenarios with two different roles (0xfffd and 0xfffc)?
No, definitely not. It is a log device. whether it is being used just
to close the write hole or more aggressively as a write-ahead cache to
reduce latency doesn't change the nature of the data on the device.
So just one new device type: "log" or "journal" or something describing
what is on the device.
Thanks,
NeilBrown
^ permalink raw reply
* [GIT PULL REQUEST] md updates for 4.2-rc
From: NeilBrown @ 2015-08-04 22:10 UTC (permalink / raw)
To: Linus Torvalds
Cc: lkml, linux-raid, Tomas Papan, Benjamin Randazzo, Josh Boyer,
Alexander Lyakas
One of these patches is for a CVE: CVE-2015-5697
I'm not convinced it is serious (data leak from CAP_SYS_ADMIN ioctl)
but as people seem to want to back-port it, I've included a minimal
version here. The remainder of that patch from Benjamin is
code-cleanup and will arrive in the 4.3 merge window.
NeilBrown
The following changes since commit 74d33293e467df61de1b1d8b2fbe29e550dec33b:
Linux 4.2-rc5 (2015-08-02 18:34:55 -0700)
are available in the git repository at:
git://neil.brown.name/md/ tags/md/4.2-rc5-fixes
for you to fetch changes up to 49895bcc7e566ba455eb2996607d6fbd3447ce16:
md/raid5: don't let shrink_slab shrink too far. (2015-08-03 17:10:56
+1000)
----------------------------------------------------------------
Three more fixes for md in 4.2
Mostly corner-case stuff.
----------------------------------------------------------------
Benjamin Randazzo (1):
md: use kzalloc() when bitmap is disabled
NeilBrown (2):
md/raid1: extend spinlock to protect raid1_end_read_request
against inconsistencies
md/raid5: don't let shrink_slab shrink too far.
drivers/md/md.c | 2 +-
drivers/md/raid1.c | 10 ++++++----
drivers/md/raid5.c | 5 +++--
3 files changed, 10 insertions(+), 7 deletions(-)
^ permalink raw reply
* ANNOUNCE: mdadm 3.3.4 - A tool for managing md Soft RAID under Linux
From: NeilBrown @ 2015-08-04 22:04 UTC (permalink / raw)
To: linux-raid
I am somewhat disappointed to have to announce the availability of
mdadm version 3.3.4
It is available at the usual places:
http://www.kernel.org/pub/linux/utils/raid/mdadm/
and via git at
git://github.com/neilbrown/mdadm
git://neil.brown.name/mdadm
http://git.neil.brown.name/git/mdadm.git
In mdadm-3.3 a change was made to how IMSM (Intel Matrix Storage
Manager) metadata was handled. Previously an IMSM array would only
be assembled if it was attached to an IMSM controller.
In 3.3 this was relaxed as there are circumstances where the
controller is not properly detected. Unfortunately this has negative
consequences which have only just come to light.
If you have an IMSM RAID1 configured and then disable RAID in the
BIOS, the metadata will remain on the devices. If you then install
some other OS on one device and then install Linux on the other, Linux
might eventually start noticing the IMSM metadata (depending a bit on whether
mdadm is included in the initramfs) and might start up the RAID1. This could
copy one device over the other, thus trashing one of the installations.
Not good.
So with this release IMSM arrays will only be assembled if attached to
an IMSM controller, or if "--force" is given to --assemble, or if the
environment variable IMSM_NO_PLATFORM is set (used primarily for
testing).
I strongly recommend upgrading to 3.3.4 if you are using 3.3 or later.
NeilBrown 3rd August 2015.
^ permalink raw reply
* Re: raid5: handle_stripe_dirtying
From: NeilBrown @ 2015-08-04 21:31 UTC (permalink / raw)
To: Markus Stockhausen; +Cc: linux-raid@vger.kernel.org
In-Reply-To: <12EF8D94C6F8734FB2FF37B9FBEDD1735FCD417B@EXCHANGE.collogia.de>
On Tue, 4 Aug 2015 18:32:37 +0000 Markus Stockhausen
<stockhausen@collogia.de> wrote:
> Hi Neil,
>
> before sending a wrong patch. Could you help me to understand the reason
> for an unconditional singular
Sending a wrong patch is not such a bad thing - it would help me know
what you are thinking, and so reduce guess-work :-)
>
> set_bit(STRIPE_HANDLE, &sh->state);
>
> in function handle_stripe_dirtying of raid5.c? It seems to be there since
> its introduction somewhere 8 years ago - patch "raid5: refactor handle_stripe5
> and handle_stripe6 (v3)".
>
> If I understand the idea behind the flag right it is required to ensure
> handling of the stripe in the next handle_stripe() run. That would only make
> sense if we set it unconditionally OR depending on some changes to the
> stripe. The above function does both. See a few lines below in the deep
> if-blocks.
So I'm guessing that you want to remove one of those? Probably
justified.
That duplication goes back to
Commit: 396a6123577d ("v2.4.5.4 -> v2.4.5.5")
I think your understanding of STRIPE_HANDLE is pretty spot-on.
NeilBrown
>
> Thanks in advance.
>
> Markus
^ permalink raw reply
* raid5: handle_stripe_dirtying
From: Markus Stockhausen @ 2015-08-04 18:32 UTC (permalink / raw)
To: Neil Brown; +Cc: linux-raid@vger.kernel.org
[-- Attachment #1: Type: text/plain, Size: 689 bytes --]
Hi Neil,
before sending a wrong patch. Could you help me to understand the reason
for an unconditional singular
set_bit(STRIPE_HANDLE, &sh->state);
in function handle_stripe_dirtying of raid5.c? It seems to be there since
its introduction somewhere 8 years ago - patch "raid5: refactor handle_stripe5
and handle_stripe6 (v3)".
If I understand the idea behind the flag right it is required to ensure
handling of the stripe in the next handle_stripe() run. That would only make
sense if we set it unconditionally OR depending on some changes to the
stripe. The above function does both. See a few lines below in the deep
if-blocks.
Thanks in advance.
Markus
=
[-- Attachment #2: InterScan_Disclaimer.txt --]
[-- Type: text/plain, Size: 1650 bytes --]
****************************************************************************
Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte
Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail
irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und
vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte
Weitergabe dieser Mail ist nicht gestattet.
Ãber das Internet versandte E-Mails können unter fremden Namen erstellt oder
manipuliert werden. Deshalb ist diese als E-Mail verschickte Nachricht keine
rechtsverbindliche Willenserklärung.
Collogia
Unternehmensberatung AG
Ubierring 11
D-50678 Köln
Vorstand:
Kadir Akin
Dr. Michael Höhnerbach
Vorsitzender des Aufsichtsrates:
Hans Kristian Langva
Registergericht: Amtsgericht Köln
Registernummer: HRB 52 497
This e-mail may contain confidential and/or privileged information. If you
are not the intended recipient (or have received this e-mail in error)
please notify the sender immediately and destroy this e-mail. Any
unauthorized copying, disclosure or distribution of the material in this
e-mail is strictly forbidden.
e-mails sent over the internet may have been written under a wrong name or
been manipulated. That is why this message sent as an e-mail is not a
legally binding declaration of intention.
Collogia
Unternehmensberatung AG
Ubierring 11
D-50678 Köln
executive board:
Kadir Akin
Dr. Michael Höhnerbach
President of the supervisory board:
Hans Kristian Langva
Registry office: district court Cologne
Register number: HRB 52 497
****************************************************************************
^ permalink raw reply
* RE: [PATCH 1/9] MD: add a new disk role to present cache device
From: Song Liu @ 2015-08-04 18:17 UTC (permalink / raw)
To: Christoph Hellwig, Shaohua Li
Cc: linux-raid@vger.kernel.org, Kernel Team, dan.j.williams@intel.com,
neilb@suse.de
In-Reply-To: <20150804142824.GA8204@infradead.org>
> -----Original Message-----
> From: Christoph Hellwig [mailto:hch@infradead.org]
> Sent: Tuesday, August 4, 2015 7:28 AM
> To: Shaohua Li
> Cc: linux-raid@vger.kernel.org; Kernel Team; Song Liu; hch@infradead.org;
> dan.j.williams@intel.com; neilb@suse.de
> Subject: Re: [PATCH 1/9] MD: add a new disk role to present cache device
>
> > case 0xfffe: /* faulty */
> > set_bit(Faulty, &rdev->flags);
> > break;
> > + case 0xfffd: /* cache device */
>
> Any chance to get constants for these magic numbers as an additional prep
> patch?
I will add patch for special roles (spare, faulty, cache, etc.).
>
> Also I don't really think that adding the role without the actual implementation
> is that useful.
Currently, we are planning to use 0xfffd for both "cache device" and
"journal device" (fix write hole only). Would you prefer to separate these
two scenarios with two different roles (0xfffd and 0xfffc)?
Thanks,
Song
^ permalink raw reply
* Re: RAID1 degraded
From: Robert L Mathews @ 2015-08-04 15:56 UTC (permalink / raw)
To: linux-raid
In-Reply-To: <14A646FC-54F8-4A2E-978D-49800FB534CF@me.com>
On 8/3/15 10:55 PM, Hans Malissa wrote:
> Rebooting the system didn’t solve the problem, /dev/sdc is still nowhere to be found.
Possible tip: I've seen several cases where rebooting was not enough to
make a failed drive visible. In some cases, power actually needs to be
removed from the server for a few seconds (or the drive needs to be
removed and reinserted if it's hot-swap capable).
That's because the drive software itself may be hung in a way that only
gets fixed when power is removed from, then restored to, the drive.
--
Robert L Mathews, Tiger Technologies, http://www.tigertech.net/
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: RAID1 degraded
From: Anthonys Lists @ 2015-08-04 14:38 UTC (permalink / raw)
To: Hans Malissa; +Cc: linux-raid
In-Reply-To: <14A646FC-54F8-4A2E-978D-49800FB534CF@me.com>
On 04/08/2015 06:55, Hans Malissa wrote:
> Thanks a lot for your help!
> Rebooting the system didn’t solve the problem, /dev/sdc is still nowhere to be found.
> So I will have to replace /dev/sdc.
> I tried to learn a bit about SRC/ERC from list archives, and it seems like my hard drives (1TB Seagate Barracuda’s) don’t support this option:
>
> # smartctl -l scterc /dev/sdb
> smartctl 6.0 2012-10-10 r3643 [x86_64-linux-3.7.10-1.45-desktop] (SUSE RPM)
> Copyright (C) 2002-12, Bruce Allen, Christian Franke,www.smartmontools.org
>
> SCT Error Recovery Control command not supported
I've got Seagate Barracudas (the 3TB version) and was a bit miffed to
realise that they didn't support this. That said, with mirrored 1TB
drives, you shouldn't have any real problems with SRC/ERC - the problem
is that a drive that returns 1 error per 10TB read is within spec, if
your array is over that size, then "good" drives could well cause a
crashed array if you have any glitches. (It seems that most drives are
well over spec, but why run the risk).
If you're price-conscious, WD Reds are not much more expensive than
Barracudas, and are advertised as "good for RAID". I'm looking at them
for my next hard drives.
Cheers,
Wol
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH 2/9] md: override md superblock recovery_offset for cache device
From: Christoph Hellwig @ 2015-08-04 14:30 UTC (permalink / raw)
To: Shaohua Li
Cc: linux-raid, Kernel-team, songliubraving, hch, dan.j.williams,
neilb
In-Reply-To: <42ac39ae4466dda63b1dee827c2bd3741d669860.1438215986.git.shli@fb.com>
On Wed, Jul 29, 2015 at 05:38:42PM -0700, Shaohua Li wrote:
> Cache device stores data in a log structure. We need record the log
> start. Here we override md superblock recovery_offset for this purpose.
> This field of a cache device is meaningless otherwise.
Just reusing the field for a different purpose without a different
name or comment is highly confusing.
I'd suggest to create unions in both the on-disk and in-memory
structures and properly document that new usage for cache devices.
^ permalink raw reply
* Re: [PATCH 1/9] MD: add a new disk role to present cache device
From: Christoph Hellwig @ 2015-08-04 14:28 UTC (permalink / raw)
To: Shaohua Li
Cc: linux-raid, Kernel-team, songliubraving, hch, dan.j.williams,
neilb
In-Reply-To: <e871cc4fc266c76f1d4b55225f2c0a6aacb18680.1438215986.git.shli@fb.com>
> case 0xfffe: /* faulty */
> set_bit(Faulty, &rdev->flags);
> break;
> + case 0xfffd: /* cache device */
Any chance to get constants for these magic numbers as an additional
prep patch?
Also I don't really think that adding the role without the actual
implementation is that useful.
^ permalink raw reply
* Re: [PATCH 1/2] Safeguard against writing to an active device of another node
From: Guoqing Jiang @ 2015-08-04 10:23 UTC (permalink / raw)
To: Adam Goryachev; +Cc: Goldwyn Rodrigues, neilb, linux-raid
In-Reply-To: <55C0918A.7010808@websitemanagers.com.au>
Adam Goryachev wrote:
> On 04/08/15 20:05, Guoqing Jiang wrote:
>
>> Hi Goldwyn,
>>
>> Thanks for review.
>>
>> Goldwyn Rodrigues wrote:
>>
>>>> + set_dlm_hookers(); /* get dlm funcs from libdlm_lt.so.3 */
>>>> +
>>>>
>>> Universal Comment: Let call it set_dlm_hooks as opposed to hookers.
>>>
>>>
>> Not sure I understood correctly, the second patch used set_hookers to
>> call set_dlm_hookers.
>>
>
> I think Neil meant to ask you to please do a global s/hookers/hooks/
> because hooker has a particular meaning in english which is different to
> what you intended.
> http://www.urbandictionary.com/define.php?term=hooker
>
> Hope that helps.
>
Got it, thanks for the website, will change it.
Thanks,
Guoqing
^ permalink raw reply
* Re: [PATCH 1/2] Safeguard against writing to an active device of another node
From: Adam Goryachev @ 2015-08-04 10:18 UTC (permalink / raw)
To: Guoqing Jiang, Goldwyn Rodrigues; +Cc: neilb, linux-raid
In-Reply-To: <55C08E5C.5090604@suse.com>
On 04/08/15 20:05, Guoqing Jiang wrote:
> Hi Goldwyn,
>
> Thanks for review.
>
> Goldwyn Rodrigues wrote:
>>> + set_dlm_hookers(); /* get dlm funcs from libdlm_lt.so.3 */
>>> +
>> Universal Comment: Let call it set_dlm_hooks as opposed to hookers.
>>
> Not sure I understood correctly, the second patch used set_hookers to
> call set_dlm_hookers.
I think Neil meant to ask you to please do a global s/hookers/hooks/
because hooker has a particular meaning in english which is different to
what you intended.
http://www.urbandictionary.com/define.php?term=hooker
Hope that helps.
Regards,
Adam
>>> #define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
>>>
>>> +static struct dlm_hookers *dlm_hookers = NULL;
>>> +static int is_dlm_hookers_ready = 0;
>> This should not be required, just checking for dlm_hooks == NULL
>> should be enough. This needs to be set accordingly in set_dlm_hooks.
>>
> is_dlm_hookers_ready is introduced to check the dlm_* functions is
> appeared in libdlm_lt.so.3
> or not, in case there is problem within the dlm lib.
>
>>> +static struct dlm_lock_resource *dlm_lock_res = NULL;
>>> +static int ast_called = 0;
>>> +
>>> +struct dlm_lock_resource {
>>> + dlm_lshandle_t *ls;
>>> + struct dlm_lksb lksb;
>>> +};
>>> +
>>> +int is_clustered(struct supertype *st)
>>> +{
>>> + /* is it a cluster md or not */
>>> + if (is_dlm_hookers_ready && st->cluster_name)
>>> + return 1;
>>> + else
>>> + return 0;
>>> +}
>>> +
>>> +/* Using poll(2) to wait for and dispatch ASTs */
>>> +static int poll_for_ast(dlm_lshandle_t ls)
>>> +{
>>> + struct pollfd pfd;
>> Shouldn't you check dlm_hooks is NULL here? and starting of every
>> function which requires dlm_hooks.
>>
>> Also, a return value from these functions do not mean an error, it
>> means the library is not present.
>>
> I don't think so, because is_dlm_hookers_ready not only ensures
> libdlm_lt.so.3 existed and it also make sure
> all the needed dlm hookers are set. And
> cluster_get_dlmlock/cluster_release_dlmlock/dlm_ast/poll_for_ast
> could only be execute while is_dlm_hookers_ready is set to 1.
>
> Thanks,
> Guoqing
> --
> To unsubscribe from this list: send the line "unsubscribe linux-raid" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Adam Goryachev
Website Managers
www.websitemanagers.com.au
^ permalink raw reply
* Re: [PATCH 2/2] Make cmap_* also has same policy as dlm_*
From: Guoqing Jiang @ 2015-08-04 10:09 UTC (permalink / raw)
To: Goldwyn Rodrigues; +Cc: neilb, linux-raid
In-Reply-To: <55BF5766.9070008@suse.com>
Hi Goldwyn,
Goldwyn Rodrigues wrote:
> On 08/03/2015 06:31 AM, Guoqing Jiang wrote:
>> Let libcmap lib and related funs also only need one-time
>> setup during mdadm running period.
>>
>> Signed-off-by: Guoqing Jiang <gqjiang@suse.com>
>> ---
>> mdadm.c | 23 +++++++++++--------
>> mdadm.h | 20 ++++++++++++++++
>> util.c | 81
>> +++++++++++++++++++++++++++++++++++++++--------------------------
>> 3 files changed, 82 insertions(+), 42 deletions(-)
>>
[snip]
>> +
>> +void set_hookers(void)
>> +{
>> + set_dlm_hookers();
>> + set_cmap_hookers();
>> +}
>> +
>> +void free_hookers(void)
>> +{
>> + free_dlm_hookers();
>> + free_cmap_hookers();
>> +}
>>
>
> You could put both functions in a single structure called cluster_hooks.
>
Yes, it could be. If there more libs are needed in future, so I prefer
separate them according to different libraries.
Thanks,
Guoqing
^ permalink raw reply
* Re: [PATCH 1/2] Safeguard against writing to an active device of another node
From: Guoqing Jiang @ 2015-08-04 10:05 UTC (permalink / raw)
To: Goldwyn Rodrigues; +Cc: neilb, linux-raid
In-Reply-To: <55BF570A.6050403@suse.com>
Hi Goldwyn,
Thanks for review.
Goldwyn Rodrigues wrote:
>>
>> + set_dlm_hookers(); /* get dlm funcs from libdlm_lt.so.3 */
>> +
>
> Universal Comment: Let call it set_dlm_hooks as opposed to hookers.
>
Not sure I understood correctly, the second patch used set_hookers to
call set_dlm_hookers.
>>
>> #define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
>>
>> +static struct dlm_hookers *dlm_hookers = NULL;
>> +static int is_dlm_hookers_ready = 0;
>
> This should not be required, just checking for dlm_hooks == NULL
> should be enough. This needs to be set accordingly in set_dlm_hooks.
>
is_dlm_hookers_ready is introduced to check the dlm_* functions is
appeared in libdlm_lt.so.3
or not, in case there is problem within the dlm lib.
>> +static struct dlm_lock_resource *dlm_lock_res = NULL;
>> +static int ast_called = 0;
>> +
>> +struct dlm_lock_resource {
>> + dlm_lshandle_t *ls;
>> + struct dlm_lksb lksb;
>> +};
>> +
>> +int is_clustered(struct supertype *st)
>> +{
>> + /* is it a cluster md or not */
>> + if (is_dlm_hookers_ready && st->cluster_name)
>> + return 1;
>> + else
>> + return 0;
>> +}
>> +
>> +/* Using poll(2) to wait for and dispatch ASTs */
>> +static int poll_for_ast(dlm_lshandle_t ls)
>> +{
>> + struct pollfd pfd;
>
> Shouldn't you check dlm_hooks is NULL here? and starting of every
> function which requires dlm_hooks.
>
> Also, a return value from these functions do not mean an error, it
> means the library is not present.
>
I don't think so, because is_dlm_hookers_ready not only ensures
libdlm_lt.so.3 existed and it also make sure
all the needed dlm hookers are set. And
cluster_get_dlmlock/cluster_release_dlmlock/dlm_ast/poll_for_ast
could only be execute while is_dlm_hookers_ready is set to 1.
Thanks,
Guoqing
^ permalink raw reply
* Re: RAID1 degraded
From: Adam Goryachev @ 2015-08-04 6:02 UTC (permalink / raw)
To: linux-raid
In-Reply-To: <A5793A94-EC9B-4221-A420-9E39EF0ABEEC@me.com>
On 04/08/15 15:51, Hans Malissa wrote:
> Thanks a lot for your help!
> Rebooting the system didn’t solve the problem, /dev/sdc is still
> nowhere to be found.
> So I will have to replace /dev/sdc.
> I tried to learn a bit about SRC/ERC from list archives, and it seems
> like my hard drives (1TB Seagate Barracuda’s) don’t support this option:
>
> # smartctl -l scterc /dev/sdb
> smartctl 6.0 2012-10-10 r3643 [x86_64-linux-3.7.10-1.45-desktop] (SUSE
> RPM)
> Copyright (C) 2002-12, Bruce Allen, Christian Franke,
> www.smartmontools.org <http://www.smartmontools.org>
>
> SCT Error Recovery Control command not supported
>
> /dev/sdc is (was) of exactly the same type, so it wouldn’t support
> SRC/ERC either.
> This doesn’t seem to be the problem here, since the drive has just
> disappeared.
Nope that is true, but it is always good to learn about the issue before
it becomes the problem.
> But I will certainly take this into account when buying a replacement
> drive. Any current recommendations about what would work best in a
> RAID1 instead of a 1TB Seagate Barracuda?
My personal preference was WD Black drives, or else Enterprise Black,
but they were always a lot more expensive. I think WD Red are "RAID
Certified" these days. (Note, I mostly use SSD now rather than any brand
HDD, so not a lot of recent experiences).
> Just to make sure I understand correctly how to replace /dev/sdc and
> repair my RAID1, the steps to do would be:
>
> 1. Shutdown PC
> 2. Replace /dev/sdc
> 3. Restart computer
> 4. Partition the new /dev/sdc
> 5. Run # mdadm —manage /dev/md0 —add /dev/sdc1
> 6. Wait for synchronization to finish
>
> Did I get this right? Am I missing anything? Are there additional
> steps (I am backing my data up, anyway) that I can take to maximize my
> chance for success?
Yep, all sounds good. Just make a note of the serial number for sdb
before you shutdown, and ensure you are removing the correct drive. The
good thing with RAID1 is that it is difficult to really screw it up, but
backups are *always* a good idea :)
Regards,
Adam
> Thanks a lot,
>
> Hans
>
> On Aug 3, 2015, at 10:33 PM, Adam Goryachev
> <mailinglists@websitemanagers.com.au
> <mailto:mailinglists@websitemanagers.com.au>> wrote:
>
>> On 04/08/15 14:16, Hans Malissa wrote:
>>> Thanks a lot for your help!
>>> smartctl yields the following information (details see below):
>>> /dev/sdb looks ok, but /dev/sdc seems to have quite a problem.
>>> /dev/sdc seems nonexistent, it’s not even in /dev/ anymore. The disk
>>> is physically present, but that’s about it.
>>> The kernel logs contain a lot of information; what should I be
>>> looking for?
>>
>> The logs should contain information on why or what happened when the
>> disk (sdc) vanished. In your case, it does indeed look like sdc has
>> failed, so you have a number of options depending on your preference:
>> 1) Simply reboot (including a complete power off) the machine, and
>> see if sdc comes back. If it does, do some tests, and then add back
>> to the array. If it survives, then carry on as normal.
>>
>> 2) If you are more cautious (and more prepared to spend the money
>> rather than risk the data), then purchase a replacement disk, and
>> replace sdc with the new disk. Prepare the drive/partition, and add
>> it to the raid array.
>>
>> Please make sure you "Research SCT/ERC on this list"!!! before
>> purchasing the replacement drive. It is far better to buy the right
>> drive if possible.
>>
>> Regards,
>> Adam
>>
>>> Thanks a lot,
>>>
>>> Hans
>>>
>>> # smartctl -a /dev/sdb
>>> smartctl 6.0 2012-10-10 r3643 [x86_64-linux-3.7.10-1.45-desktop]
>>> (SUSE RPM)
>>> Copyright (C) 2002-12, Bruce Allen, Christian Franke,
>>> www.smartmontools.org <http://www.smartmontools.org>
>>>
>>> === START OF INFORMATION SECTION ===
>>> Model Family: Seagate Barracuda 7200.14 (AF)
>>> Device Model: ST1000DM003-1ER162
>>> Serial Number: Z4Y6N2J3
>>> LU WWN Device Id: 5 000c50 07afe5c18
>>> Firmware Version: CC45
>>> User Capacity: 1,000,204,886,016 bytes [1.00 TB]
>>> Sector Sizes: 512 bytes logical, 4096 bytes physical
>>> Rotation Rate: 7200 rpm
>>> Device is: In smartctl database [for details use: -P show]
>>> ATA Version is: ACS-2, ACS-3 T13/2161-D revision 3b
>>> SATA Version is: SATA 3.1, 6.0 Gb/s (current: 6.0 Gb/s)
>>> Local Time is: Mon Aug 3 21:52:32 2015 MDT
>>>
>>> ==> WARNING: A firmware update for this drive may be available,
>>> see the following Seagate web pages:
>>> http://knowledge.seagate.com/articles/en_US/FAQ/207931en
>>> http://knowledge.seagate.com/articles/en_US/FAQ/223651en
>>>
>>> SMART support is: Available - device has SMART capability.
>>> SMART support is: Enabled
>>>
>>> === START OF READ SMART DATA SECTION ===
>>> SMART overall-health self-assessment test result: PASSED
>>>
>>> General SMART Values:
>>> Offline data collection status: (0x00) Offline data collection activity
>>> was never started.
>>> Auto Offline Data
>>> Collection: Disabled.
>>> Self-test execution status: ( 0) The previous self-test
>>> routine completed
>>> without error or no
>>> self-test has ever
>>> been run.
>>> Total time to complete Offline
>>> data collection: ( 80) seconds.
>>> Offline data collection
>>> capabilities: (0x73) SMART execute Offline immediate.
>>> Auto Offline data collection
>>> on/off support.
>>> Suspend Offline collection
>>> upon new
>>> command.
>>> No Offline surface scan
>>> supported.
>>> Self-test supported.
>>> Conveyance Self-test supported.
>>> Selective Self-test supported.
>>> SMART capabilities: (0x0003) Saves SMART data before entering
>>> power-saving mode.
>>> Supports SMART auto save timer.
>>> Error logging capability: (0x01) Error logging supported.
>>> General Purpose Logging
>>> supported.
>>> Short self-test routine
>>> recommended polling time: ( 1) minutes.
>>> Extended self-test routine
>>> recommended polling time: ( 105) minutes.
>>> Conveyance self-test routine
>>> recommended polling time: ( 2) minutes.
>>> SCT capabilities: (0x1085) SCT Status supported.
>>>
>>> SMART Attributes Data Structure revision number: 10
>>> Vendor Specific SMART Attributes with Thresholds:
>>> ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE
>>> UPDATED WHEN_FAILED RAW_VALUE
>>> 1 Raw_Read_Error_Rate 0x000f 111 100 006 Pre-fail
>>> Always - 39301104
>>> 3 Spin_Up_Time 0x0003 097 097 000 Pre-fail
>>> Always - 0
>>> 4 Start_Stop_Count 0x0032 100 100 020 Old_age
>>> Always - 20
>>> 5 Reallocated_Sector_Ct 0x0033 100 100 010 Pre-fail
>>> Always - 0
>>> 7 Seek_Error_Rate 0x000f 063 060 030 Pre-fail
>>> Always - 2152462
>>> 9 Power_On_Hours 0x0032 098 098 000 Old_age
>>> Always - 1872
>>> 10 Spin_Retry_Count 0x0013 100 100 097 Pre-fail
>>> Always - 0
>>> 12 Power_Cycle_Count 0x0032 100 100 020 Old_age
>>> Always - 20
>>> 183 Runtime_Bad_Block 0x0032 100 100 000 Old_age
>>> Always - 0
>>> 184 End-to-End_Error 0x0032 100 100 099 Old_age
>>> Always - 0
>>> 187 Reported_Uncorrect 0x0032 100 100 000 Old_age
>>> Always - 0
>>> 188 Command_Timeout 0x0032 100 100 000 Old_age
>>> Always - 0 0 0
>>> 189 High_Fly_Writes 0x003a 100 100 000 Old_age
>>> Always - 0
>>> 190 Airflow_Temperature_Cel 0x0022 068 064 045 Old_age
>>> Always - 32 (Min/Max 26/35)
>>> 191 G-Sense_Error_Rate 0x0032 100 100 000 Old_age
>>> Always - 0
>>> 192 Power-Off_Retract_Count 0x0032 100 100 000 Old_age
>>> Always - 0
>>> 193 Load_Cycle_Count 0x0032 093 093 000 Old_age
>>> Always - 15119
>>> 194 Temperature_Celsius 0x0022 032 040 000 Old_age
>>> Always - 32 (0 19 0 0 0)
>>> 197 Current_Pending_Sector 0x0012 100 100 000 Old_age
>>> Always - 0
>>> 198 Offline_Uncorrectable 0x0010 100 100 000 Old_age
>>> Offline - 0
>>> 199 UDMA_CRC_Error_Count 0x003e 200 200 000 Old_age
>>> Always - 0
>>> 240 Head_Flying_Hours 0x0000 100 253 000 Old_age
>>> Offline - 662h+04m+56.474s
>>> 241 Total_LBAs_Written 0x0000 100 253 000 Old_age
>>> Offline - 2212066311
>>> 242 Total_LBAs_Read 0x0000 100 253 000 Old_age
>>> Offline - 4204083236
>>>
>>> SMART Error Log Version: 1
>>> No Errors Logged
>>>
>>> SMART Self-test log structure revision number 1
>>> No self-tests have been logged. [To run self-tests, use: smartctl -t]
>>>
>>>
>>> SMART Selective self-test log data structure revision number 1
>>> SPAN MIN_LBA MAX_LBA CURRENT_TEST_STATUS
>>> 1 0 0 Not_testing
>>> 2 0 0 Not_testing
>>> 3 0 0 Not_testing
>>> 4 0 0 Not_testing
>>> 5 0 0 Not_testing
>>> Selective self-test flags (0x0):
>>> After scanning selected spans, do NOT read-scan remainder of disk.
>>> If Selective self-test is pending on power-up, resume after 0 minute
>>> delay.
>>>
>>> # smartctl -a /dev/sdc
>>> smartctl 6.0 2012-10-10 r3643 [x86_64-linux-3.7.10-1.45-desktop]
>>> (SUSE RPM)
>>> Copyright (C) 2002-12, Bruce Allen, Christian Franke,
>>> www.smartmontools.org
>>>
>>> Smartctl open device: /dev/sdc failed: No such device
>>>
>>> On Aug 3, 2015, at 5:48 PM, Adam Goryachev
>>> <mailinglists@websitemanagers.com.au> wrote:
>>>
>>>> On 04/08/15 08:18, Hans Malissa wrote:
>>>>> Hi everybody,
>>>>>
>>>>> It looks like one of my disks in my RAID1 just failed:
>>>>>
>>>>> [SNIP]
>>>>>
>>>>> Are there any other tests I could run in order to figure out
>>>>> what’s going on? It looks like I will have to replace /dev/sdc1
>>>>> with a new hard drive. What is the correct procedure to do so
>>>>> without loosing my data?
>>>>>
>>>> Have a look at dmesg or your system kernel logs for details.
>>>> Also, use smartctl to examine what the drive itself thinks.
>>>> Also, try to use dd to read/write the drive.
>>>>
>>>> One common scenario is that you haven't configured the timing for
>>>> the drive correctly, and the drive is working perfectly, but didn't
>>>> respond to the kernel quickly enough. Research SCT/ERC on this list
>>>>
>>>> Regards,
>>>> Adam
>>>> --
>>>> Adam Goryachev Website Managers www.websitemanagers.com.au
>>
>>
>> --
>> Adam Goryachev Website Managerswww.websitemanagers.com.au
>> <http://www.websitemanagers.com.au/>
>
--
Adam Goryachev Website Managers www.websitemanagers.com.au
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: RAID1 degraded
From: Hans Malissa @ 2015-08-04 5:55 UTC (permalink / raw)
To: Adam Goryachev; +Cc: linux-raid
In-Reply-To: <55C0409E.5010004@websitemanagers.com.au>
Thanks a lot for your help!
Rebooting the system didn’t solve the problem, /dev/sdc is still nowhere to be found.
So I will have to replace /dev/sdc.
I tried to learn a bit about SRC/ERC from list archives, and it seems like my hard drives (1TB Seagate Barracuda’s) don’t support this option:
# smartctl -l scterc /dev/sdb
smartctl 6.0 2012-10-10 r3643 [x86_64-linux-3.7.10-1.45-desktop] (SUSE RPM)
Copyright (C) 2002-12, Bruce Allen, Christian Franke, www.smartmontools.org
SCT Error Recovery Control command not supported
/dev/sdc is (was) of exactly the same type, so it wouldn’t support SRC/ERC either.
This doesn’t seem to be the problem here, since the drive has just disappeared.
But I will certainly take this into account when buying a replacement drive. Any current recommendations about what would work best in a RAID1 instead of a 1TB Seagate Barracuda?
Just to make sure I understand correctly how to replace /dev/sdc and repair my RAID1, the steps to do would be:
• Shutdown PC
• Replace /dev/sdc
• Restart computer
• Partition the new /dev/sdc
• Run # mdadm --manage /dev/md0 --add /dev/sdc1
• Wait for synchronization to finish
Did I get this right? Am I missing anything? Are there additional steps (I am backing my data up, anyway) that I can take to maximize my chance for success?
Thanks a lot,
Hans
On Aug 3, 2015, at 10:33 PM, Adam Goryachev <mailinglists@websitemanagers.com.au> wrote:
> On 04/08/15 14:16, Hans Malissa wrote:
>> Thanks a lot for your help!
>> smartctl yields the following information (details see below): /dev/sdb looks ok, but /dev/sdc seems to have quite a problem. /dev/sdc seems nonexistent, it’s not even in /dev/ anymore. The disk is physically present, but that’s about it.
>> The kernel logs contain a lot of information; what should I be looking for?
>
> The logs should contain information on why or what happened when the disk (sdc) vanished. In your case, it does indeed look like sdc has failed, so you have a number of options depending on your preference:
> 1) Simply reboot (including a complete power off) the machine, and see if sdc comes back. If it does, do some tests, and then add back to the array. If it survives, then carry on as normal.
>
> 2) If you are more cautious (and more prepared to spend the money rather than risk the data), then purchase a replacement disk, and replace sdc with the new disk. Prepare the drive/partition, and add it to the raid array.
>
> Please make sure you "Research SCT/ERC on this list"!!! before purchasing the replacement drive. It is far better to buy the right drive if possible.
>
> Regards,
> Adam
>
>> Thanks a lot,
>>
>> Hans
>>
>> # smartctl -a /dev/sdb
>> smartctl 6.0 2012-10-10 r3643 [x86_64-linux-3.7.10-1.45-desktop] (SUSE RPM)
>> Copyright (C) 2002-12, Bruce Allen, Christian Franke, www.smartmontools.org
>>
>> === START OF INFORMATION SECTION ===
>> Model Family: Seagate Barracuda 7200.14 (AF)
>> Device Model: ST1000DM003-1ER162
>> Serial Number: Z4Y6N2J3
>> LU WWN Device Id: 5 000c50 07afe5c18
>> Firmware Version: CC45
>> User Capacity: 1,000,204,886,016 bytes [1.00 TB]
>> Sector Sizes: 512 bytes logical, 4096 bytes physical
>> Rotation Rate: 7200 rpm
>> Device is: In smartctl database [for details use: -P show]
>> ATA Version is: ACS-2, ACS-3 T13/2161-D revision 3b
>> SATA Version is: SATA 3.1, 6.0 Gb/s (current: 6.0 Gb/s)
>> Local Time is: Mon Aug 3 21:52:32 2015 MDT
>>
>> ==> WARNING: A firmware update for this drive may be available,
>> see the following Seagate web pages:
>> http://knowledge.seagate.com/articles/en_US/FAQ/207931en
>> http://knowledge.seagate.com/articles/en_US/FAQ/223651en
>>
>> SMART support is: Available - device has SMART capability.
>> SMART support is: Enabled
>>
>> === START OF READ SMART DATA SECTION ===
>> SMART overall-health self-assessment test result: PASSED
>>
>> General SMART Values:
>> Offline data collection status: (0x00) Offline data collection activity
>> was never started.
>> Auto Offline Data Collection: Disabled.
>> Self-test execution status: ( 0) The previous self-test routine completed
>> without error or no self-test has ever
>> been run.
>> Total time to complete Offline
>> data collection: ( 80) seconds.
>> Offline data collection
>> capabilities: (0x73) SMART execute Offline immediate.
>> Auto Offline data collection on/off support.
>> Suspend Offline collection upon new
>> command.
>> No Offline surface scan supported.
>> Self-test supported.
>> Conveyance Self-test supported.
>> Selective Self-test supported.
>> SMART capabilities: (0x0003) Saves SMART data before entering
>> power-saving mode.
>> Supports SMART auto save timer.
>> Error logging capability: (0x01) Error logging supported.
>> General Purpose Logging supported.
>> Short self-test routine
>> recommended polling time: ( 1) minutes.
>> Extended self-test routine
>> recommended polling time: ( 105) minutes.
>> Conveyance self-test routine
>> recommended polling time: ( 2) minutes.
>> SCT capabilities: (0x1085) SCT Status supported.
>>
>> SMART Attributes Data Structure revision number: 10
>> Vendor Specific SMART Attributes with Thresholds:
>> ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE
>> 1 Raw_Read_Error_Rate 0x000f 111 100 006 Pre-fail Always - 39301104
>> 3 Spin_Up_Time 0x0003 097 097 000 Pre-fail Always - 0
>> 4 Start_Stop_Count 0x0032 100 100 020 Old_age Always - 20
>> 5 Reallocated_Sector_Ct 0x0033 100 100 010 Pre-fail Always - 0
>> 7 Seek_Error_Rate 0x000f 063 060 030 Pre-fail Always - 2152462
>> 9 Power_On_Hours 0x0032 098 098 000 Old_age Always - 1872
>> 10 Spin_Retry_Count 0x0013 100 100 097 Pre-fail Always - 0
>> 12 Power_Cycle_Count 0x0032 100 100 020 Old_age Always - 20
>> 183 Runtime_Bad_Block 0x0032 100 100 000 Old_age Always - 0
>> 184 End-to-End_Error 0x0032 100 100 099 Old_age Always - 0
>> 187 Reported_Uncorrect 0x0032 100 100 000 Old_age Always - 0
>> 188 Command_Timeout 0x0032 100 100 000 Old_age Always - 0 0 0
>> 189 High_Fly_Writes 0x003a 100 100 000 Old_age Always - 0
>> 190 Airflow_Temperature_Cel 0x0022 068 064 045 Old_age Always - 32 (Min/Max 26/35)
>> 191 G-Sense_Error_Rate 0x0032 100 100 000 Old_age Always - 0
>> 192 Power-Off_Retract_Count 0x0032 100 100 000 Old_age Always - 0
>> 193 Load_Cycle_Count 0x0032 093 093 000 Old_age Always - 15119
>> 194 Temperature_Celsius 0x0022 032 040 000 Old_age Always - 32 (0 19 0 0 0)
>> 197 Current_Pending_Sector 0x0012 100 100 000 Old_age Always - 0
>> 198 Offline_Uncorrectable 0x0010 100 100 000 Old_age Offline - 0
>> 199 UDMA_CRC_Error_Count 0x003e 200 200 000 Old_age Always - 0
>> 240 Head_Flying_Hours 0x0000 100 253 000 Old_age Offline - 662h+04m+56.474s
>> 241 Total_LBAs_Written 0x0000 100 253 000 Old_age Offline - 2212066311
>> 242 Total_LBAs_Read 0x0000 100 253 000 Old_age Offline - 4204083236
>>
>> SMART Error Log Version: 1
>> No Errors Logged
>>
>> SMART Self-test log structure revision number 1
>> No self-tests have been logged. [To run self-tests, use: smartctl -t]
>>
>>
>> SMART Selective self-test log data structure revision number 1
>> SPAN MIN_LBA MAX_LBA CURRENT_TEST_STATUS
>> 1 0 0 Not_testing
>> 2 0 0 Not_testing
>> 3 0 0 Not_testing
>> 4 0 0 Not_testing
>> 5 0 0 Not_testing
>> Selective self-test flags (0x0):
>> After scanning selected spans, do NOT read-scan remainder of disk.
>> If Selective self-test is pending on power-up, resume after 0 minute delay.
>>
>> # smartctl -a /dev/sdc
>> smartctl 6.0 2012-10-10 r3643 [x86_64-linux-3.7.10-1.45-desktop] (SUSE RPM)
>> Copyright (C) 2002-12, Bruce Allen, Christian Franke, www.smartmontools.org
>>
>> Smartctl open device: /dev/sdc failed: No such device
>>
>> On Aug 3, 2015, at 5:48 PM, Adam Goryachev <mailinglists@websitemanagers.com.au> wrote:
>>
>>> On 04/08/15 08:18, Hans Malissa wrote:
>>>> Hi everybody,
>>>>
>>>> It looks like one of my disks in my RAID1 just failed:
>>>>
>>>> [SNIP]
>>>>
>>>> Are there any other tests I could run in order to figure out what’s going on? It looks like I will have to replace /dev/sdc1 with a new hard drive. What is the correct procedure to do so without loosing my data?
>>>>
>>> Have a look at dmesg or your system kernel logs for details.
>>> Also, use smartctl to examine what the drive itself thinks.
>>> Also, try to use dd to read/write the drive.
>>>
>>> One common scenario is that you haven't configured the timing for the drive correctly, and the drive is working perfectly, but didn't respond to the kernel quickly enough. Research SCT/ERC on this list
>>>
>>> Regards,
>>> Adam
>>> --
>>> Adam Goryachev Website Managers www.websitemanagers.com.au
>
>
> --
> Adam Goryachev Website Managers www.websitemanagers.com.au
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: RAID1 degraded
From: Adam Goryachev @ 2015-08-04 4:33 UTC (permalink / raw)
To: Hans Malissa; +Cc: linux-raid
In-Reply-To: <478DB4ED-9FAB-4035-A482-0BC11046B6C2@me.com>
On 04/08/15 14:16, Hans Malissa wrote:
> Thanks a lot for your help!
> smartctl yields the following information (details see below): /dev/sdb looks ok, but /dev/sdc seems to have quite a problem. /dev/sdc seems nonexistent, it’s not even in /dev/ anymore. The disk is physically present, but that’s about it.
> The kernel logs contain a lot of information; what should I be looking for?
The logs should contain information on why or what happened when the
disk (sdc) vanished. In your case, it does indeed look like sdc has
failed, so you have a number of options depending on your preference:
1) Simply reboot (including a complete power off) the machine, and see
if sdc comes back. If it does, do some tests, and then add back to the
array. If it survives, then carry on as normal.
2) If you are more cautious (and more prepared to spend the money rather
than risk the data), then purchase a replacement disk, and replace sdc
with the new disk. Prepare the drive/partition, and add it to the raid
array.
Please make sure you "Research SCT/ERC on this list"!!! before
purchasing the replacement drive. It is far better to buy the right
drive if possible.
Regards,
Adam
> Thanks a lot,
>
> Hans
>
> # smartctl -a /dev/sdb
> smartctl 6.0 2012-10-10 r3643 [x86_64-linux-3.7.10-1.45-desktop] (SUSE RPM)
> Copyright (C) 2002-12, Bruce Allen, Christian Franke, www.smartmontools.org
>
> === START OF INFORMATION SECTION ===
> Model Family: Seagate Barracuda 7200.14 (AF)
> Device Model: ST1000DM003-1ER162
> Serial Number: Z4Y6N2J3
> LU WWN Device Id: 5 000c50 07afe5c18
> Firmware Version: CC45
> User Capacity: 1,000,204,886,016 bytes [1.00 TB]
> Sector Sizes: 512 bytes logical, 4096 bytes physical
> Rotation Rate: 7200 rpm
> Device is: In smartctl database [for details use: -P show]
> ATA Version is: ACS-2, ACS-3 T13/2161-D revision 3b
> SATA Version is: SATA 3.1, 6.0 Gb/s (current: 6.0 Gb/s)
> Local Time is: Mon Aug 3 21:52:32 2015 MDT
>
> ==> WARNING: A firmware update for this drive may be available,
> see the following Seagate web pages:
> http://knowledge.seagate.com/articles/en_US/FAQ/207931en
> http://knowledge.seagate.com/articles/en_US/FAQ/223651en
>
> SMART support is: Available - device has SMART capability.
> SMART support is: Enabled
>
> === START OF READ SMART DATA SECTION ===
> SMART overall-health self-assessment test result: PASSED
>
> General SMART Values:
> Offline data collection status: (0x00) Offline data collection activity
> was never started.
> Auto Offline Data Collection: Disabled.
> Self-test execution status: ( 0) The previous self-test routine completed
> without error or no self-test has ever
> been run.
> Total time to complete Offline
> data collection: ( 80) seconds.
> Offline data collection
> capabilities: (0x73) SMART execute Offline immediate.
> Auto Offline data collection on/off support.
> Suspend Offline collection upon new
> command.
> No Offline surface scan supported.
> Self-test supported.
> Conveyance Self-test supported.
> Selective Self-test supported.
> SMART capabilities: (0x0003) Saves SMART data before entering
> power-saving mode.
> Supports SMART auto save timer.
> Error logging capability: (0x01) Error logging supported.
> General Purpose Logging supported.
> Short self-test routine
> recommended polling time: ( 1) minutes.
> Extended self-test routine
> recommended polling time: ( 105) minutes.
> Conveyance self-test routine
> recommended polling time: ( 2) minutes.
> SCT capabilities: (0x1085) SCT Status supported.
>
> SMART Attributes Data Structure revision number: 10
> Vendor Specific SMART Attributes with Thresholds:
> ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE
> 1 Raw_Read_Error_Rate 0x000f 111 100 006 Pre-fail Always - 39301104
> 3 Spin_Up_Time 0x0003 097 097 000 Pre-fail Always - 0
> 4 Start_Stop_Count 0x0032 100 100 020 Old_age Always - 20
> 5 Reallocated_Sector_Ct 0x0033 100 100 010 Pre-fail Always - 0
> 7 Seek_Error_Rate 0x000f 063 060 030 Pre-fail Always - 2152462
> 9 Power_On_Hours 0x0032 098 098 000 Old_age Always - 1872
> 10 Spin_Retry_Count 0x0013 100 100 097 Pre-fail Always - 0
> 12 Power_Cycle_Count 0x0032 100 100 020 Old_age Always - 20
> 183 Runtime_Bad_Block 0x0032 100 100 000 Old_age Always - 0
> 184 End-to-End_Error 0x0032 100 100 099 Old_age Always - 0
> 187 Reported_Uncorrect 0x0032 100 100 000 Old_age Always - 0
> 188 Command_Timeout 0x0032 100 100 000 Old_age Always - 0 0 0
> 189 High_Fly_Writes 0x003a 100 100 000 Old_age Always - 0
> 190 Airflow_Temperature_Cel 0x0022 068 064 045 Old_age Always - 32 (Min/Max 26/35)
> 191 G-Sense_Error_Rate 0x0032 100 100 000 Old_age Always - 0
> 192 Power-Off_Retract_Count 0x0032 100 100 000 Old_age Always - 0
> 193 Load_Cycle_Count 0x0032 093 093 000 Old_age Always - 15119
> 194 Temperature_Celsius 0x0022 032 040 000 Old_age Always - 32 (0 19 0 0 0)
> 197 Current_Pending_Sector 0x0012 100 100 000 Old_age Always - 0
> 198 Offline_Uncorrectable 0x0010 100 100 000 Old_age Offline - 0
> 199 UDMA_CRC_Error_Count 0x003e 200 200 000 Old_age Always - 0
> 240 Head_Flying_Hours 0x0000 100 253 000 Old_age Offline - 662h+04m+56.474s
> 241 Total_LBAs_Written 0x0000 100 253 000 Old_age Offline - 2212066311
> 242 Total_LBAs_Read 0x0000 100 253 000 Old_age Offline - 4204083236
>
> SMART Error Log Version: 1
> No Errors Logged
>
> SMART Self-test log structure revision number 1
> No self-tests have been logged. [To run self-tests, use: smartctl -t]
>
>
> SMART Selective self-test log data structure revision number 1
> SPAN MIN_LBA MAX_LBA CURRENT_TEST_STATUS
> 1 0 0 Not_testing
> 2 0 0 Not_testing
> 3 0 0 Not_testing
> 4 0 0 Not_testing
> 5 0 0 Not_testing
> Selective self-test flags (0x0):
> After scanning selected spans, do NOT read-scan remainder of disk.
> If Selective self-test is pending on power-up, resume after 0 minute delay.
>
> # smartctl -a /dev/sdc
> smartctl 6.0 2012-10-10 r3643 [x86_64-linux-3.7.10-1.45-desktop] (SUSE RPM)
> Copyright (C) 2002-12, Bruce Allen, Christian Franke, www.smartmontools.org
>
> Smartctl open device: /dev/sdc failed: No such device
>
> On Aug 3, 2015, at 5:48 PM, Adam Goryachev <mailinglists@websitemanagers.com.au> wrote:
>
>> On 04/08/15 08:18, Hans Malissa wrote:
>>> Hi everybody,
>>>
>>> It looks like one of my disks in my RAID1 just failed:
>>>
>>> [SNIP]
>>>
>>> Are there any other tests I could run in order to figure out what’s going on? It looks like I will have to replace /dev/sdc1 with a new hard drive. What is the correct procedure to do so without loosing my data?
>>>
>> Have a look at dmesg or your system kernel logs for details.
>> Also, use smartctl to examine what the drive itself thinks.
>> Also, try to use dd to read/write the drive.
>>
>> One common scenario is that you haven't configured the timing for the drive correctly, and the drive is working perfectly, but didn't respond to the kernel quickly enough. Research SCT/ERC on this list
>>
>> Regards,
>> Adam
>> --
>> Adam Goryachev Website Managers www.websitemanagers.com.au
--
Adam Goryachev Website Managers www.websitemanagers.com.au
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: RAID1 degraded
From: Hans Malissa @ 2015-08-04 4:16 UTC (permalink / raw)
To: Adam Goryachev; +Cc: linux-raid
In-Reply-To: <55BFFDD3.5000005@websitemanagers.com.au>
Thanks a lot for your help!
smartctl yields the following information (details see below): /dev/sdb looks ok, but /dev/sdc seems to have quite a problem. /dev/sdc seems nonexistent, it’s not even in /dev/ anymore. The disk is physically present, but that’s about it.
The kernel logs contain a lot of information; what should I be looking for?
Thanks a lot,
Hans
# smartctl -a /dev/sdb
smartctl 6.0 2012-10-10 r3643 [x86_64-linux-3.7.10-1.45-desktop] (SUSE RPM)
Copyright (C) 2002-12, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF INFORMATION SECTION ===
Model Family: Seagate Barracuda 7200.14 (AF)
Device Model: ST1000DM003-1ER162
Serial Number: Z4Y6N2J3
LU WWN Device Id: 5 000c50 07afe5c18
Firmware Version: CC45
User Capacity: 1,000,204,886,016 bytes [1.00 TB]
Sector Sizes: 512 bytes logical, 4096 bytes physical
Rotation Rate: 7200 rpm
Device is: In smartctl database [for details use: -P show]
ATA Version is: ACS-2, ACS-3 T13/2161-D revision 3b
SATA Version is: SATA 3.1, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is: Mon Aug 3 21:52:32 2015 MDT
==> WARNING: A firmware update for this drive may be available,
see the following Seagate web pages:
http://knowledge.seagate.com/articles/en_US/FAQ/207931en
http://knowledge.seagate.com/articles/en_US/FAQ/223651en
SMART support is: Available - device has SMART capability.
SMART support is: Enabled
=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED
General SMART Values:
Offline data collection status: (0x00) Offline data collection activity
was never started.
Auto Offline Data Collection: Disabled.
Self-test execution status: ( 0) The previous self-test routine completed
without error or no self-test has ever
been run.
Total time to complete Offline
data collection: ( 80) seconds.
Offline data collection
capabilities: (0x73) SMART execute Offline immediate.
Auto Offline data collection on/off support.
Suspend Offline collection upon new
command.
No Offline surface scan supported.
Self-test supported.
Conveyance Self-test supported.
Selective Self-test supported.
SMART capabilities: (0x0003) Saves SMART data before entering
power-saving mode.
Supports SMART auto save timer.
Error logging capability: (0x01) Error logging supported.
General Purpose Logging supported.
Short self-test routine
recommended polling time: ( 1) minutes.
Extended self-test routine
recommended polling time: ( 105) minutes.
Conveyance self-test routine
recommended polling time: ( 2) minutes.
SCT capabilities: (0x1085) SCT Status supported.
SMART Attributes Data Structure revision number: 10
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE
1 Raw_Read_Error_Rate 0x000f 111 100 006 Pre-fail Always - 39301104
3 Spin_Up_Time 0x0003 097 097 000 Pre-fail Always - 0
4 Start_Stop_Count 0x0032 100 100 020 Old_age Always - 20
5 Reallocated_Sector_Ct 0x0033 100 100 010 Pre-fail Always - 0
7 Seek_Error_Rate 0x000f 063 060 030 Pre-fail Always - 2152462
9 Power_On_Hours 0x0032 098 098 000 Old_age Always - 1872
10 Spin_Retry_Count 0x0013 100 100 097 Pre-fail Always - 0
12 Power_Cycle_Count 0x0032 100 100 020 Old_age Always - 20
183 Runtime_Bad_Block 0x0032 100 100 000 Old_age Always - 0
184 End-to-End_Error 0x0032 100 100 099 Old_age Always - 0
187 Reported_Uncorrect 0x0032 100 100 000 Old_age Always - 0
188 Command_Timeout 0x0032 100 100 000 Old_age Always - 0 0 0
189 High_Fly_Writes 0x003a 100 100 000 Old_age Always - 0
190 Airflow_Temperature_Cel 0x0022 068 064 045 Old_age Always - 32 (Min/Max 26/35)
191 G-Sense_Error_Rate 0x0032 100 100 000 Old_age Always - 0
192 Power-Off_Retract_Count 0x0032 100 100 000 Old_age Always - 0
193 Load_Cycle_Count 0x0032 093 093 000 Old_age Always - 15119
194 Temperature_Celsius 0x0022 032 040 000 Old_age Always - 32 (0 19 0 0 0)
197 Current_Pending_Sector 0x0012 100 100 000 Old_age Always - 0
198 Offline_Uncorrectable 0x0010 100 100 000 Old_age Offline - 0
199 UDMA_CRC_Error_Count 0x003e 200 200 000 Old_age Always - 0
240 Head_Flying_Hours 0x0000 100 253 000 Old_age Offline - 662h+04m+56.474s
241 Total_LBAs_Written 0x0000 100 253 000 Old_age Offline - 2212066311
242 Total_LBAs_Read 0x0000 100 253 000 Old_age Offline - 4204083236
SMART Error Log Version: 1
No Errors Logged
SMART Self-test log structure revision number 1
No self-tests have been logged. [To run self-tests, use: smartctl -t]
SMART Selective self-test log data structure revision number 1
SPAN MIN_LBA MAX_LBA CURRENT_TEST_STATUS
1 0 0 Not_testing
2 0 0 Not_testing
3 0 0 Not_testing
4 0 0 Not_testing
5 0 0 Not_testing
Selective self-test flags (0x0):
After scanning selected spans, do NOT read-scan remainder of disk.
If Selective self-test is pending on power-up, resume after 0 minute delay.
# smartctl -a /dev/sdc
smartctl 6.0 2012-10-10 r3643 [x86_64-linux-3.7.10-1.45-desktop] (SUSE RPM)
Copyright (C) 2002-12, Bruce Allen, Christian Franke, www.smartmontools.org
Smartctl open device: /dev/sdc failed: No such device
On Aug 3, 2015, at 5:48 PM, Adam Goryachev <mailinglists@websitemanagers.com.au> wrote:
> On 04/08/15 08:18, Hans Malissa wrote:
>> Hi everybody,
>>
>> It looks like one of my disks in my RAID1 just failed:
>>
>> [SNIP]
>>
>> Are there any other tests I could run in order to figure out what’s going on? It looks like I will have to replace /dev/sdc1 with a new hard drive. What is the correct procedure to do so without loosing my data?
>>
> Have a look at dmesg or your system kernel logs for details.
> Also, use smartctl to examine what the drive itself thinks.
> Also, try to use dd to read/write the drive.
>
> One common scenario is that you haven't configured the timing for the drive correctly, and the drive is working perfectly, but didn't respond to the kernel quickly enough. Research SCT/ERC on this list
>
> Regards,
> Adam
> --
> Adam Goryachev Website Managers www.websitemanagers.com.au
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: RAID1 degraded
From: Adam Goryachev @ 2015-08-03 23:48 UTC (permalink / raw)
To: Hans Malissa, linux-raid
In-Reply-To: <AA2DC53A-A663-45CE-A8FE-DF6C8C285F37@me.com>
On 04/08/15 08:18, Hans Malissa wrote:
> Hi everybody,
>
> It looks like one of my disks in my RAID1 just failed:
>
> [SNIP]
>
> Are there any other tests I could run in order to figure out what’s going on? It looks like I will have to replace /dev/sdc1 with a new hard drive. What is the correct procedure to do so without loosing my data?
>
Have a look at dmesg or your system kernel logs for details.
Also, use smartctl to examine what the drive itself thinks.
Also, try to use dd to read/write the drive.
One common scenario is that you haven't configured the timing for the
drive correctly, and the drive is working perfectly, but didn't respond
to the kernel quickly enough. Research SCT/ERC on this list
Regards,
Adam
--
Adam Goryachev Website Managers www.websitemanagers.com.au
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: How will mdadm handle a wrongly added drive, when the original comes back on line?
From: Adam Goryachev @ 2015-08-03 23:42 UTC (permalink / raw)
To: Wilson, Jonathan, linux-raid
In-Reply-To: <BLU437-SMTP91911FDCDB54E9FBB43E5BE1770@phx.gbl>
On 03/08/15 23:14, Wilson, Jonathan wrote:
> Due to a bug in the driver for a Marvel chipset 4 port SATA card I think
> I may have added an empty drive partition into a raid6 array and when I
> get a new card I it will end up seeing not only the new drive, but also
> the "missing" drive.
>
> Events:
> Upgraded jessie with latest updates (quite some time since I last did
> it) and re-booted.
>
> A 6 drive raid6 assembled, but all the drives were spare. Stopped the
> array and did a mdadm --assemble /dev/md6.
>
> It assembled with 5 drives, one missing.
>
> Tried re-add, which failed, and then -add which completed ok.
At this point the array should have done a resync to add the 6th drive.
> Some time later I re-booted and the same problem happened.
>
> All drives spare, stopped, assembled, added missing.
At this point the array should have done a resync to add the 6th drive.
Whether this is the same "6th" drive or not doesn't matter.
> Its now working and I have a new card on order due to something going
> badly wrong with the driver and/or card and/or chipset (Marvel 9230).
>
> After some time passed after the second boot, I realised that one of my
> drives was physically missing. I had a drive ready to go as a genuine
> spare but not yet added as a spare to mdadm, so in theory it should have
> been totally empty apart from a partition.
>
> Now my problem is that firstly I can not be sure that when I looked
> at /proc/mdstat/ and saw "all" the drives as spare there might have been
> a missing one. (On either or both occasions.)
>
> In my mdadm.config I don't specify the number of drives in the array,
> just its name and the UUID.
>
> Now my question is: if we call the drives in the array A,B,C,D,E,F and
> the empty one G.
>
> After the first boot I may have added G, so the array would be
> A,B,C,D,E,G. (F missing from system)
>
> After the second boot I may have added F back, so the array would be
> A,B,C,D,E,F (G missing from system)
>
> If after changing the card the system sees A,B,C,D,E,F,G how will mdadm
> work? Will it fail to assemble as one of the drives is "extra" to the
> metadata count (I assume even though I don't specify a count in the
> conf, that internally on the partitions of the disks in the array it
> knows there should be "6" disks.
It should reject the "older" 6th drive because the event count will be
older, and should auto-assemble with all the other drives. The older
"6th" drive will either be spare, or not added to the array at all, and
you would need to add it to the array for it to become a spare.
> Will it see that disk "7" is out of date/wrong count and decide it
> should not be part of the array automagically?
>
> If mdadm refuses to assemble the array, I assume I will need to assemble
> it using a full list of the drives that should be in it? So if I check
> all the disks metadata I should be able to see the current state of the
> devices with --examine and then do
> mdadm --assemble /dev/md6 /dev/sda6 /dev/sdb6 etc...
You should be able to list all 7 drives, and md should work it out
without any issue.
> Then clear the superblock on the drive I know should not be a part of
> the array?
I don't think this should be needed, but if it is, be careful.
> I guess the important bit is the events count?
>
> The version of the array is 1.2
>
> mdadm - v3.3.2 - 21st August 2014
>
> Linux borgCube 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt11-1+deb8u2
> (2015-07-17) x86_64 GNU/Linux
>
> ./lsdrv is: (for the drives in the array, the scsi 6:x:x:x is the
> missing disk)
>
>> PCI [ahci] 03:00.0 SATA controller: Marvell Technology Group Ltd. 88SE9230 PCIe SATA 6Gb/s Controller (rev 10)
>> ├scsi 6:x:x:x [Empty]
>> ├scsi 7:0:0:0 ATA WDC WD30EFRX-68E {WD-WCC4N6XD5SV6}
>> │└sdg 2.73t [8:96] Partitioned (gpt)
>> │ └sdg6 2.64t [8:102] MD raid6 (0/6) (w/ sdh6,sdi6,sdk6,sdl6,sdm6) in_sync 'borgCube:R6Backup' {0e1215fc-1eab-5943-c28d-a7cb399353a3}
>> │ └md6 10.54t [9:6] MD v1.2 raid6 (6) clean, 512k Chunk {0e1215fc:1eab5943:c28da7cb:399353a3}
>> │ │ ext4 'R6Backup' {142323a9-02d5-4fd5-b8a9-309a2cafde2a}
>> │ └Mounted as /dev/md6 @ /mnt/md6R6Backup
>> ├scsi 8:0:0:0 ATA WDC WD30EFRX-68E {WD-WCC4N7TS870E}
>> │└sdh 2.73t [8:112] Partitioned (gpt)
>> │ └sdh6 2.64t [8:118] MD raid6 (2/6) (w/ sdg6,sdi6,sdk6,sdl6,sdm6) in_sync 'borgCube:R6Backup' {0e1215fc-1eab-5943-c28d-a7cb399353a3}
>> │ └md6 10.54t [9:6] MD v1.2 raid6 (6) clean, 512k Chunk {0e1215fc:1eab5943:c28da7cb:399353a3}
>> │ ext4 'R6Backup' {142323a9-02d5-4fd5-b8a9-309a2cafde2a}
>> ├scsi 9:0:0:0 ATA WDC WD30EFRX-68E {WD-WCC4N3UR60ZV}
>> │└sdi 2.73t [8:128] Partitioned (gpt)
>> │ └sdi6 2.64t [8:134] MD raid6 (3/6) (w/ sdg6,sdh6,sdk6,sdl6,sdm6) in_sync 'borgCube:R6Backup' {0e1215fc-1eab-5943-c28d-a7cb399353a3}
>> │ └md6 10.54t [9:6] MD v1.2 raid6 (6) clean, 512k Chunk {0e1215fc:1eab5943:c28da7cb:399353a3}
>> │ ext4 'R6Backup' {142323a9-02d5-4fd5-b8a9-309a2cafde2a}
>> ├scsi 10:x:x:x [Empty]
>> ├scsi 11:x:x:x [Empty]
>> └scsi 12:x:x:x [Empty]
>> PCI [ahci] 05:00.0 SATA controller: ASMedia Technology Inc. ASM1062 Serial ATA Controller (rev 01)
>> ├scsi 14:0:0:0 ATA WDC WD30EFRX-68E {WD-WCC4N3YNA3SN}
>> │└sdj 2.73t [8:144] Partitioned (gpt)
>> │ └sdj5 2.64t [8:149] MD raid6 (4/5) (w/ sdc5,sdd5,sde5,sdf5) in_sync 'BorgCUBE:51' {b1cdd470-a412-bff3-e62d-cac6cafd8762}
>> │ └md51 7.90t [9:51] MD v1.2 raid6 (5) clean, 512k Chunk {b1cdd470:a412bff3:e62dcac6:cafd8762}
>> │ ext4 'md51mnt' {63c25cf7-d1aa-48e5-97d1-25c34819889c}
>> └scsi 15:0:0:0 ATA WDC WD30EFRX-68E {WD-WCC4N4LL7U4E}
>> └sdk 2.73t [8:160] Partitioned (gpt)
>> └sdk6 2.64t [8:166] MD raid6 (1/6) (w/ sdg6,sdh6,sdi6,sdl6,sdm6) in_sync 'borgCube:R6Backup' {0e1215fc-1eab-5943-c28d-a7cb399353a3}
>> └md6 10.54t [9:6] MD v1.2 raid6 (6) clean, 512k Chunk {0e1215fc:1eab5943:c28da7cb:399353a3}
>> ext4 'R6Backup' {142323a9-02d5-4fd5-b8a9-309a2cafde2a}
>> PCI [ahci] 08:00.0 SATA controller: ASMedia Technology Inc. ASM1062 Serial ATA Controller (rev 01)
>> ├scsi 16:0:0:0 ATA WDC WD30EFRX-68E {WD-WCC4N6XD5ZL3}
>> │└sdl 2.73t [8:176] Partitioned (gpt)
>> │ └sdl6 2.64t [8:182] MD raid6 (4/6) (w/ sdg6,sdh6,sdi6,sdk6,sdm6) in_sync 'borgCube:R6Backup' {0e1215fc-1eab-5943-c28d-a7cb399353a3}
>> │ └md6 10.54t [9:6] MD v1.2 raid6 (6) clean, 512k Chunk {0e1215fc:1eab5943:c28da7cb:399353a3}
>> │ ext4 'R6Backup' {142323a9-02d5-4fd5-b8a9-309a2cafde2a}
>> └scsi 17:0:0:0 ATA WDC WD30EFRX-68E {WD-WCC4N3UR625T}
>> └sdm 2.73t [8:192] Partitioned (gpt)
>> └sdm6 2.64t [8:198] MD raid6 (5/6) (w/ sdg6,sdh6,sdi6,sdk6,sdl6) in_sync 'borgCube:R6Backup' {0e1215fc-1eab-5943-c28d-a7cb399353a3}
>> └md6 10.54t [9:6] MD v1.2 raid6 (6) clean, 512k Chunk {0e1215fc:1eab5943:c28da7cb:399353a3}
>> ext4 'R6Backup' {142323a9-02d5-4fd5-b8a9-309a2cafde2a}
>
>> ata7.00: ATA-7: MARVELL VIRTUALL, 1.09, max UDMA/66
>> [ 1.765384] ata7.00: 0 sectors, multi 0: LBA
>> [ 1.765749] ata14.00: failed to IDENTIFY (device reports invalid type, err_mask=0x0)
>> [ 1.766116] ata14.00: revalidation failed (errno=-22)
>> [ 1.766461] ata14: limiting SATA link speed to 1.5 Gbps
>> [ 1.766793] ata14.00: limiting speed to UDMA/66:PIO3
>> [ 1.785901] usb 1-12: new full-speed USB device number 4 using xhci_hcd
>> [ 1.990155] usb 1-12: New USB device found, idVendor=0416, idProduct=e008
>> [ 1.990507] usb 1-12: New USB device strings: Mfr=1, Product=2, SerialNumber=3
>> [ 1.990843] usb 1-12: Product: OLED Display Controller
>> [ 1.991184] usb 1-12: Manufacturer: Nuvoton
>> [ 1.991526] usb 1-12: SerialNumber: B02013031501
>> [ 2.006243] input: Nuvoton OLED Display Controller as /devices/pci0000:00/0000:00:14.0/usb1/1-12/1-12:1.0/0003:0416:E008.0002/input/input2
>> [ 2.007001] hid-generic 0003:0416:E008.0002: input,hidraw1: USB HID v1.10 Device [Nuvoton OLED Display Controller] on usb-0000:00:14.0-12/input0
>> [ 2.117789] usb 4-1: new high-speed USB device number 2 using ehci-pci
>> [ 2.250081] usb 4-1: New USB device found, idVendor=8087, idProduct=8008
>> [ 2.250511] usb 4-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
>> [ 2.251086] hub 4-1:1.0: USB hub found
>> [ 2.251580] hub 4-1:1.0: 6 ports detected
>> [ 2.361715] usb 6-1: new high-speed USB device number 2 using ehci-pci
>> [ 2.494011] usb 6-1: New USB device found, idVendor=8087, idProduct=8000
>> [ 2.494446] usb 6-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
>> [ 2.495038] hub 6-1:1.0: USB hub found
>> [ 2.495516] hub 6-1:1.0: 8 ports detected
>> [ 2.501791] Switched to clocksource tsc
>> [ 6.204677] ata8.00: ATA-9: WDC WD30EFRX-68EUZN0, 82.00A82, max UDMA/133
>> [ 6.205300] ata8.00: 5860533168 sectors, multi 0: LBA48 NCQ (depth 31/32), AA
>> [ 6.205911] ata9.00: ATA-9: WDC WD30EFRX-68EUZN0, 82.00A82, max UDMA/133
>> [ 6.206526] ata9.00: 5860533168 sectors, multi 0: LBA48 NCQ (depth 31/32), AA
>> [ 6.207245] ata10: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
>> [ 6.207966] ata7.00: model number mismatch 'MARVELL VIRTUALL' != 'WDC WD30EFRX-68EUZN0'
>> [ 6.208615] ata7.00: revalidation failed (errno=-19)
>> [ 6.209256] ata7: limiting SATA link speed to 3.0 Gbps
>> [ 6.209896] ata7.00: limiting speed to UDMA/66:PIO3
>> [ 6.376797] ata8.00: configured for UDMA/133
>> [ 6.377453] ata9.00: configured for UDMA/133
>> [ 6.378094] ata10.00: ATA-9: WDC WD30EFRX-68EUZN0, 82.00A82, max UDMA/133
>> [ 6.378738] ata10.00: 5860533168 sectors, multi 0: LBA48 NCQ (depth 31/32), AA
>> [ 6.380308] ata10.00: configured for UDMA/133
>> [ 6.696465] ata14: SATA link up 1.5 Gbps (SStatus 113 SControl 310)
>> [ 6.697195] ata14.00: configured for UDMA/66
>> [ 6.704462] ata7: SATA link up 6.0 Gbps (SStatus 133 SControl 320)
>> [ 6.705538] ata7.00: model number mismatch 'MARVELL VIRTUALL' != 'WDC WD30EFRX-68EUZN0'
>> [ 6.706016] ata7.00: revalidation failed (errno=-19)
>> [ 6.706496] ata7.00: disabled
> ata14 is spurious, even when all was working ok that error would show
> up. (I think its the 4 port sata card)
>
> ata7 is sdg
>
> Annoyingly the ata numbers don't actually correspond to the scsi
> numbers, because ata6 is actually port 6 of the intel on board chipset.
>
> scsi14-17 are 4 additional on board ports, and 6-12 are the four port
> card.
>
> The card allows for 7 drives, 4 of which can be expanded on a single
> port via a multiplier/external esata cable. (only 1 port at a time can
> be expanded) and I think this is what is causing the problem.
>
> Hopefully I wont have to boot the system for a couple of days so can
> take in any replies before either a power cut or the new card arrives.
When referring to drives, try to use UUID or the serial number of the
drive. The "names" sdX can change on each boot.
Regards,
Adam
--
Adam Goryachev Website Managers www.websitemanagers.com.au
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* RAID1 degraded
From: Hans Malissa @ 2015-08-03 22:18 UTC (permalink / raw)
To: linux-raid
Hi everybody,
It looks like one of my disks in my RAID1 just failed:
# cat /proc/mdstat
Personalities : [raid1]
md0 : active raid1 sdc1[1](F) sdb1[0]
976629568 blocks super 1.2 [2/1] [U_]
unused devices: <none>
and
# mdadm --detail /dev/md0
/dev/md0:
Version : 1.2
Creation Time : Sun May 17 15:21:30 2015
Raid Level : raid1
Array Size : 976629568 (931.39 GiB 1000.07 GB)
Used Dev Size : 976629568 (931.39 GiB 1000.07 GB)
Raid Devices : 2
Total Devices : 2
Persistence : Superblock is persistent
Update Time : Mon Aug 3 16:13:56 2015
State : clean, degraded
Active Devices : 1
Working Devices : 1
Failed Devices : 1
Spare Devices : 0
Name : eprb21:0
UUID : 0901fe50:444a29b6:d3caff14:e45ef9cc
Events : 7619
Number Major Minor RaidDevice State
0 8 17 0 active sync /dev/sdb1
1 0 0 1 removed
1 8 33 - faulty /dev/sdc1
Looks like there’s something wrong with /dev/sdc1:
# mdadm --examine /dev/sdb1
/dev/sdb1:
Magic : a92b4efc
Version : 1.2
Feature Map : 0x0
Array UUID : 0901fe50:444a29b6:d3caff14:e45ef9cc
Name : eprb21:0
Creation Time : Sun May 17 15:21:30 2015
Raid Level : raid1
Raid Devices : 2
Avail Dev Size : 1953259520 (931.39 GiB 1000.07 GB)
Array Size : 976629568 (931.39 GiB 1000.07 GB)
Used Dev Size : 1953259136 (931.39 GiB 1000.07 GB)
Data Offset : 262144 sectors
Super Offset : 8 sectors
State : clean
Device UUID : 3e6d5330:3ee6ef06:2acf46ad:44513d37
Update Time : Mon Aug 3 16:14:32 2015
Checksum : d474a441 - correct
Events : 7627
Device Role : Active device 0
Array State : A. ('A' == active, '.' == missing)
and
# mdadm --examine /dev/sdc1
mdadm: No md superblock detected on /dev/sdc1.
The file system seems to be ok for the time being:
# fsck -n /dev/md0
fsck from util-linux 2.21.2
e2fsck 1.42.6 (21-Sep-2012)
Warning! /dev/md0 is mounted.
Warning: skipping journal recovery because doing a read-only filesystem check.
/dev/md0: clean, 218192/61046784 files, 213484777/244157392 blocks
Are there any other tests I could run in order to figure out what’s going on? It looks like I will have to replace /dev/sdc1 with a new hard drive. What is the correct procedure to do so without loosing my data?
Best regards, and thanks a lot,
Hans--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* How will mdadm handle a wrongly added drive, when the original comes back on line?
From: Wilson, Jonathan @ 2015-08-03 13:14 UTC (permalink / raw)
To: linux-raid
Due to a bug in the driver for a Marvel chipset 4 port SATA card I think
I may have added an empty drive partition into a raid6 array and when I
get a new card I it will end up seeing not only the new drive, but also
the "missing" drive.
Events:
Upgraded jessie with latest updates (quite some time since I last did
it) and re-booted.
A 6 drive raid6 assembled, but all the drives were spare. Stopped the
array and did a mdadm --assemble /dev/md6.
It assembled with 5 drives, one missing.
Tried re-add, which failed, and then -add which completed ok.
Some time later I re-booted and the same problem happened.
All drives spare, stopped, assembled, added missing.
Its now working and I have a new card on order due to something going
badly wrong with the driver and/or card and/or chipset (Marvel 9230).
After some time passed after the second boot, I realised that one of my
drives was physically missing. I had a drive ready to go as a genuine
spare but not yet added as a spare to mdadm, so in theory it should have
been totally empty apart from a partition.
Now my problem is that firstly I can not be sure that when I looked
at /proc/mdstat/ and saw "all" the drives as spare there might have been
a missing one. (On either or both occasions.)
In my mdadm.config I don't specify the number of drives in the array,
just its name and the UUID.
Now my question is: if we call the drives in the array A,B,C,D,E,F and
the empty one G.
After the first boot I may have added G, so the array would be
A,B,C,D,E,G. (F missing from system)
After the second boot I may have added F back, so the array would be
A,B,C,D,E,F (G missing from system)
If after changing the card the system sees A,B,C,D,E,F,G how will mdadm
work? Will it fail to assemble as one of the drives is "extra" to the
metadata count (I assume even though I don't specify a count in the
conf, that internally on the partitions of the disks in the array it
knows there should be "6" disks.
Will it see that disk "7" is out of date/wrong count and decide it
should not be part of the array automagically?
If mdadm refuses to assemble the array, I assume I will need to assemble
it using a full list of the drives that should be in it? So if I check
all the disks metadata I should be able to see the current state of the
devices with --examine and then do
mdadm --assemble /dev/md6 /dev/sda6 /dev/sdb6 etc...
Then clear the superblock on the drive I know should not be a part of
the array?
I guess the important bit is the events count?
The version of the array is 1.2
mdadm - v3.3.2 - 21st August 2014
Linux borgCube 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt11-1+deb8u2
(2015-07-17) x86_64 GNU/Linux
./lsdrv is: (for the drives in the array, the scsi 6:x:x:x is the
missing disk)
> PCI [ahci] 03:00.0 SATA controller: Marvell Technology Group Ltd. 88SE9230 PCIe SATA 6Gb/s Controller (rev 10)
> ├scsi 6:x:x:x [Empty]
> ├scsi 7:0:0:0 ATA WDC WD30EFRX-68E {WD-WCC4N6XD5SV6}
> │└sdg 2.73t [8:96] Partitioned (gpt)
> │ └sdg6 2.64t [8:102] MD raid6 (0/6) (w/ sdh6,sdi6,sdk6,sdl6,sdm6) in_sync 'borgCube:R6Backup' {0e1215fc-1eab-5943-c28d-a7cb399353a3}
> │ └md6 10.54t [9:6] MD v1.2 raid6 (6) clean, 512k Chunk {0e1215fc:1eab5943:c28da7cb:399353a3}
> │ │ ext4 'R6Backup' {142323a9-02d5-4fd5-b8a9-309a2cafde2a}
> │ └Mounted as /dev/md6 @ /mnt/md6R6Backup
> ├scsi 8:0:0:0 ATA WDC WD30EFRX-68E {WD-WCC4N7TS870E}
> │└sdh 2.73t [8:112] Partitioned (gpt)
> │ └sdh6 2.64t [8:118] MD raid6 (2/6) (w/ sdg6,sdi6,sdk6,sdl6,sdm6) in_sync 'borgCube:R6Backup' {0e1215fc-1eab-5943-c28d-a7cb399353a3}
> │ └md6 10.54t [9:6] MD v1.2 raid6 (6) clean, 512k Chunk {0e1215fc:1eab5943:c28da7cb:399353a3}
> │ ext4 'R6Backup' {142323a9-02d5-4fd5-b8a9-309a2cafde2a}
> ├scsi 9:0:0:0 ATA WDC WD30EFRX-68E {WD-WCC4N3UR60ZV}
> │└sdi 2.73t [8:128] Partitioned (gpt)
> │ └sdi6 2.64t [8:134] MD raid6 (3/6) (w/ sdg6,sdh6,sdk6,sdl6,sdm6) in_sync 'borgCube:R6Backup' {0e1215fc-1eab-5943-c28d-a7cb399353a3}
> │ └md6 10.54t [9:6] MD v1.2 raid6 (6) clean, 512k Chunk {0e1215fc:1eab5943:c28da7cb:399353a3}
> │ ext4 'R6Backup' {142323a9-02d5-4fd5-b8a9-309a2cafde2a}
> ├scsi 10:x:x:x [Empty]
> ├scsi 11:x:x:x [Empty]
> └scsi 12:x:x:x [Empty]
> PCI [ahci] 05:00.0 SATA controller: ASMedia Technology Inc. ASM1062 Serial ATA Controller (rev 01)
> ├scsi 14:0:0:0 ATA WDC WD30EFRX-68E {WD-WCC4N3YNA3SN}
> │└sdj 2.73t [8:144] Partitioned (gpt)
> │ └sdj5 2.64t [8:149] MD raid6 (4/5) (w/ sdc5,sdd5,sde5,sdf5) in_sync 'BorgCUBE:51' {b1cdd470-a412-bff3-e62d-cac6cafd8762}
> │ └md51 7.90t [9:51] MD v1.2 raid6 (5) clean, 512k Chunk {b1cdd470:a412bff3:e62dcac6:cafd8762}
> │ ext4 'md51mnt' {63c25cf7-d1aa-48e5-97d1-25c34819889c}
> └scsi 15:0:0:0 ATA WDC WD30EFRX-68E {WD-WCC4N4LL7U4E}
> └sdk 2.73t [8:160] Partitioned (gpt)
> └sdk6 2.64t [8:166] MD raid6 (1/6) (w/ sdg6,sdh6,sdi6,sdl6,sdm6) in_sync 'borgCube:R6Backup' {0e1215fc-1eab-5943-c28d-a7cb399353a3}
> └md6 10.54t [9:6] MD v1.2 raid6 (6) clean, 512k Chunk {0e1215fc:1eab5943:c28da7cb:399353a3}
> ext4 'R6Backup' {142323a9-02d5-4fd5-b8a9-309a2cafde2a}
> PCI [ahci] 08:00.0 SATA controller: ASMedia Technology Inc. ASM1062 Serial ATA Controller (rev 01)
> ├scsi 16:0:0:0 ATA WDC WD30EFRX-68E {WD-WCC4N6XD5ZL3}
> │└sdl 2.73t [8:176] Partitioned (gpt)
> │ └sdl6 2.64t [8:182] MD raid6 (4/6) (w/ sdg6,sdh6,sdi6,sdk6,sdm6) in_sync 'borgCube:R6Backup' {0e1215fc-1eab-5943-c28d-a7cb399353a3}
> │ └md6 10.54t [9:6] MD v1.2 raid6 (6) clean, 512k Chunk {0e1215fc:1eab5943:c28da7cb:399353a3}
> │ ext4 'R6Backup' {142323a9-02d5-4fd5-b8a9-309a2cafde2a}
> └scsi 17:0:0:0 ATA WDC WD30EFRX-68E {WD-WCC4N3UR625T}
> └sdm 2.73t [8:192] Partitioned (gpt)
> └sdm6 2.64t [8:198] MD raid6 (5/6) (w/ sdg6,sdh6,sdi6,sdk6,sdl6) in_sync 'borgCube:R6Backup' {0e1215fc-1eab-5943-c28d-a7cb399353a3}
> └md6 10.54t [9:6] MD v1.2 raid6 (6) clean, 512k Chunk {0e1215fc:1eab5943:c28da7cb:399353a3}
> ext4 'R6Backup' {142323a9-02d5-4fd5-b8a9-309a2cafde2a}
> ata7.00: ATA-7: MARVELL VIRTUALL, 1.09, max UDMA/66
> [ 1.765384] ata7.00: 0 sectors, multi 0: LBA
> [ 1.765749] ata14.00: failed to IDENTIFY (device reports invalid type, err_mask=0x0)
> [ 1.766116] ata14.00: revalidation failed (errno=-22)
> [ 1.766461] ata14: limiting SATA link speed to 1.5 Gbps
> [ 1.766793] ata14.00: limiting speed to UDMA/66:PIO3
> [ 1.785901] usb 1-12: new full-speed USB device number 4 using xhci_hcd
> [ 1.990155] usb 1-12: New USB device found, idVendor=0416, idProduct=e008
> [ 1.990507] usb 1-12: New USB device strings: Mfr=1, Product=2, SerialNumber=3
> [ 1.990843] usb 1-12: Product: OLED Display Controller
> [ 1.991184] usb 1-12: Manufacturer: Nuvoton
> [ 1.991526] usb 1-12: SerialNumber: B02013031501
> [ 2.006243] input: Nuvoton OLED Display Controller as /devices/pci0000:00/0000:00:14.0/usb1/1-12/1-12:1.0/0003:0416:E008.0002/input/input2
> [ 2.007001] hid-generic 0003:0416:E008.0002: input,hidraw1: USB HID v1.10 Device [Nuvoton OLED Display Controller] on usb-0000:00:14.0-12/input0
> [ 2.117789] usb 4-1: new high-speed USB device number 2 using ehci-pci
> [ 2.250081] usb 4-1: New USB device found, idVendor=8087, idProduct=8008
> [ 2.250511] usb 4-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
> [ 2.251086] hub 4-1:1.0: USB hub found
> [ 2.251580] hub 4-1:1.0: 6 ports detected
> [ 2.361715] usb 6-1: new high-speed USB device number 2 using ehci-pci
> [ 2.494011] usb 6-1: New USB device found, idVendor=8087, idProduct=8000
> [ 2.494446] usb 6-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
> [ 2.495038] hub 6-1:1.0: USB hub found
> [ 2.495516] hub 6-1:1.0: 8 ports detected
> [ 2.501791] Switched to clocksource tsc
> [ 6.204677] ata8.00: ATA-9: WDC WD30EFRX-68EUZN0, 82.00A82, max UDMA/133
> [ 6.205300] ata8.00: 5860533168 sectors, multi 0: LBA48 NCQ (depth 31/32), AA
> [ 6.205911] ata9.00: ATA-9: WDC WD30EFRX-68EUZN0, 82.00A82, max UDMA/133
> [ 6.206526] ata9.00: 5860533168 sectors, multi 0: LBA48 NCQ (depth 31/32), AA
> [ 6.207245] ata10: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
> [ 6.207966] ata7.00: model number mismatch 'MARVELL VIRTUALL' != 'WDC WD30EFRX-68EUZN0'
> [ 6.208615] ata7.00: revalidation failed (errno=-19)
> [ 6.209256] ata7: limiting SATA link speed to 3.0 Gbps
> [ 6.209896] ata7.00: limiting speed to UDMA/66:PIO3
> [ 6.376797] ata8.00: configured for UDMA/133
> [ 6.377453] ata9.00: configured for UDMA/133
> [ 6.378094] ata10.00: ATA-9: WDC WD30EFRX-68EUZN0, 82.00A82, max UDMA/133
> [ 6.378738] ata10.00: 5860533168 sectors, multi 0: LBA48 NCQ (depth 31/32), AA
> [ 6.380308] ata10.00: configured for UDMA/133
> [ 6.696465] ata14: SATA link up 1.5 Gbps (SStatus 113 SControl 310)
> [ 6.697195] ata14.00: configured for UDMA/66
> [ 6.704462] ata7: SATA link up 6.0 Gbps (SStatus 133 SControl 320)
> [ 6.705538] ata7.00: model number mismatch 'MARVELL VIRTUALL' != 'WDC WD30EFRX-68EUZN0'
> [ 6.706016] ata7.00: revalidation failed (errno=-19)
> [ 6.706496] ata7.00: disabled
ata14 is spurious, even when all was working ok that error would show
up. (I think its the 4 port sata card)
ata7 is sdg
Annoyingly the ata numbers don't actually correspond to the scsi
numbers, because ata6 is actually port 6 of the intel on board chipset.
scsi14-17 are 4 additional on board ports, and 6-12 are the four port
card.
The card allows for 7 drives, 4 of which can be expanded on a single
port via a multiplier/external esata cable. (only 1 port at a time can
be expanded) and I think this is what is causing the problem.
Hopefully I wont have to boot the system for a couple of days so can
take in any replies before either a power cut or the new card arrives.
Thanks in advance.
Jon
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH 2/2] Make cmap_* also has same policy as dlm_*
From: Goldwyn Rodrigues @ 2015-08-03 11:58 UTC (permalink / raw)
To: Guoqing Jiang, neilb; +Cc: linux-raid
In-Reply-To: <1438601519-17919-2-git-send-email-gqjiang@suse.com>
On 08/03/2015 06:31 AM, Guoqing Jiang wrote:
> Let libcmap lib and related funs also only need one-time
> setup during mdadm running period.
>
> Signed-off-by: Guoqing Jiang <gqjiang@suse.com>
> ---
> mdadm.c | 23 +++++++++++--------
> mdadm.h | 20 ++++++++++++++++
> util.c | 81 +++++++++++++++++++++++++++++++++++++++--------------------------
> 3 files changed, 82 insertions(+), 42 deletions(-)
>
> diff --git a/mdadm.c b/mdadm.c
> index d8032c1..4812fc5 100644
> --- a/mdadm.c
> +++ b/mdadm.c
> @@ -1293,18 +1293,22 @@ int main(int argc, char *argv[])
> c.require_homehost = 0;
> }
>
> + set_hookers(); /* set hookers from libs */
> +
> if (c.homecluster == NULL && (c.nodes > 0)) {
> c.homecluster = conf_get_homecluster();
> if (c.homecluster == NULL)
> rv = get_cluster_name(&c.homecluster);
> if (rv != 0) {
> pr_err("The md can't get cluster name\n");
> + free_hookers();
> exit(1);
> }
> }
>
> if (c.backup_file && data_offset != INVALID_SECTORS) {
> pr_err("--backup-file and --data-offset are incompatible\n");
> + free_hookers();
> exit(2);
> }
>
> @@ -1313,6 +1317,7 @@ int main(int argc, char *argv[])
> /* Anyone may try this */;
> else if (geteuid() != 0) {
> pr_err("must be super-user to perform this action\n");
> + free_hookers();
> exit(1);
> }
>
> @@ -1322,8 +1327,6 @@ int main(int argc, char *argv[])
> /* --scan implied --brief unless -vv */
> c.brief = 1;
>
> - set_dlm_hookers(); /* get dlm funcs from libdlm_lt.so.3 */
> -
> rv = 0;
> switch(mode) {
> case MANAGE:
> @@ -1364,12 +1367,12 @@ int main(int argc, char *argv[])
> else if (devs_found > 0) {
> if (c.update && devs_found > 1) {
> pr_err("can only update a single array at a time\n");
> - free_dlm_hookers(); /* close dlm stuffs */
> + free_hookers(); /* close dlm stuffs */
> exit(1);
> }
> if (c.backup_file && devs_found > 1) {
> pr_err("can only assemble a single array when providing a backup file.\n");
> - free_dlm_hookers(); /* close dlm stuffs */
> + free_hookers(); /* close dlm stuffs */
> exit(1);
> }
> for (dv = devlist ; dv ; dv=dv->next) {
> @@ -1388,12 +1391,12 @@ int main(int argc, char *argv[])
> } else {
> if (c.update) {
> pr_err("--update not meaningful with a --scan assembly.\n");
> - free_dlm_hookers(); /* close dlm stuffs */
> + free_hookers(); /* close dlm stuffs */
> exit(1);
> }
> if (c.backup_file) {
> pr_err("--backup_file not meaningful with a --scan assembly.\n");
> - free_dlm_hookers(); /* close dlm stuffs */
> + free_hookers(); /* close dlm stuffs */
> exit(1);
> }
> rv = scan_assemble(ss, &c, &ident);
> @@ -1461,14 +1464,14 @@ int main(int argc, char *argv[])
> if (devmode == 'E') {
> if (devlist == NULL && !c.scan) {
> pr_err("No devices to examine\n");
> - free_dlm_hookers(); /* close dlm stuffs */
> + free_hookers(); /* close dlm stuffs */
> exit(2);
> }
> if (devlist == NULL)
> devlist = conf_get_devs();
> if (devlist == NULL) {
> pr_err("No devices listed in %s\n", configfile?configfile:DefaultConfFile);
> - free_dlm_hookers(); /* close dlm stuffs */
> + free_hookers(); /* close dlm stuffs */
> exit(1);
> }
> rv = Examine(devlist, &c, ss);
> @@ -1485,7 +1488,7 @@ int main(int argc, char *argv[])
> rv = Write_rules(udev_filename);
> else {
> pr_err("No devices given.\n");
> - free_dlm_hookers(); /* close dlm stuffs */
> + free_hookers(); /* close dlm stuffs */
> exit(2);
> }
> } else
> @@ -1625,7 +1628,7 @@ int main(int argc, char *argv[])
> break;
> }
>
> - free_dlm_hookers(); /* close dlm stuffs */
> + free_hookers(); /* close dlm stuffs */
> exit(rv);
> }
>
> diff --git a/mdadm.h b/mdadm.h
> index c53adc5..dd7fef4 100644
> --- a/mdadm.h
> +++ b/mdadm.h
> @@ -52,6 +52,12 @@ extern __off64_t lseek64 __P ((int __fd, __off64_t __offset, int __whence));
> #define srandom srand
> #endif
>
> +#ifdef NO_COROSYNC
> +#define CS_OK 1
> +#else
> +#include <corosync/cmap.h>
> +#endif
> +
> #ifndef NO_DLM
> #include <libdlm.h>
> #include <errno.h>
> @@ -1449,6 +1455,16 @@ extern char *fd2devnm(int fd);
>
> extern int in_initrd(void);
>
> +struct cmap_hookers {
> + void *cmap_handle; /* corosync lib related */
> +
> + int (*initialize)(cmap_handle_t *handle);
> + int (*get_string)(cmap_handle_t handle,
> + const char *string,
> + char **name);
> + int (*finalize)(cmap_handle_t handle);
> +};
> +
> struct dlm_hookers {
> void *dlm_handle; /* dlm lib related */
>
> @@ -1475,6 +1491,10 @@ extern int cluster_get_dlmlock(struct supertype *st, int *lockid);
> extern int cluster_release_dlmlock(struct supertype *st, int lockid);
> extern void set_dlm_hookers(void);
> extern void free_dlm_hookers(void);
> +extern void set_cmap_hookers(void);
> +extern void free_cmap_hookers(void);
> +extern void set_hookers(void);
> +extern void free_hookers(void);
>
> #define _ROUND_UP(val, base) (((val) + (base) - 1) & ~(base - 1))
> #define ROUND_UP(val, base) _ROUND_UP(val, (typeof(val))(base))
> diff --git a/util.c b/util.c
> index 19ecf9f..1c87eb5 100644
> --- a/util.c
> +++ b/util.c
> @@ -36,13 +36,6 @@
> #include <dirent.h>
> #include <signal.h>
> #include <dlfcn.h>
> -#include <stdint.h>
> -#ifdef NO_COROSYNC
> - typedef uint64_t cmap_handle_t;
> - #define CS_OK 1
> -#else
> - #include <corosync/cmap.h>
> -#endif
>
>
> /*
> @@ -2126,40 +2119,53 @@ void reopen_mddev(int mdfd)
> dup2(fd, mdfd);
> }
>
> -int get_cluster_name(char **cluster_name)
> +static struct cmap_hookers *cmap_hookers = NULL;
> +static int is_cmap_hookers_ready = 0;
> +
> +void set_cmap_hookers(void)
> {
> - void *lib_handle = NULL;
> - int rv = -1;
> + cmap_hookers = xmalloc(sizeof(struct cmap_hookers));
> + if (!cmap_hookers)
> + return;
>
> - cmap_handle_t handle;
> - static int (*initialize)(cmap_handle_t *handle);
> - static int (*get_string)(cmap_handle_t handle,
> - const char *string,
> - char **name);
> - static int (*finalize)(cmap_handle_t handle);
> + cmap_hookers->cmap_handle = dlopen("libcmap.so.4", RTLD_NOW | RTLD_LOCAL);
> + if (!cmap_hookers->cmap_handle)
> + return;
>
> + cmap_hookers->initialize = dlsym(cmap_hookers->cmap_handle, "cmap_initialize");
> + cmap_hookers->get_string = dlsym(cmap_hookers->cmap_handle, "cmap_get_string");
> + cmap_hookers->finalize = dlsym(cmap_hookers->cmap_handle, "cmap_finalize");
>
> - lib_handle = dlopen("libcmap.so.4", RTLD_NOW | RTLD_LOCAL);
> - if (!lib_handle)
> - return rv;
> + if (!cmap_hookers->initialize || !cmap_hookers->get_string ||
> + !cmap_hookers->finalize)
> + dlclose(cmap_hookers->cmap_handle);
> + else
> + is_cmap_hookers_ready = 1;
> +}
>
> - initialize = dlsym(lib_handle, "cmap_initialize");
> - if (!initialize)
> - goto out;
> +void free_cmap_hookers(void)
> +{
> + if (is_cmap_hookers_ready) {
> + dlclose(cmap_hookers->cmap_handle);
> + is_cmap_hookers_ready = 0;
> + }
> + if (cmap_hookers)
> + free(cmap_hookers);
> +}
>
> - get_string = dlsym(lib_handle, "cmap_get_string");
> - if (!get_string)
> - goto out;
> +int get_cluster_name(char **cluster_name)
> +{
> + int rv = -1;
> + cmap_handle_t handle;
>
> - finalize = dlsym(lib_handle, "cmap_finalize");
> - if (!finalize)
> - goto out;
> + if (!is_cmap_hookers_ready)
> + return rv;
>
> - rv = initialize(&handle);
> + rv = cmap_hookers->initialize(&handle);
> if (rv != CS_OK)
> goto out;
>
> - rv = get_string(handle, "totem.cluster_name", cluster_name);
> + rv = cmap_hookers->get_string(handle, "totem.cluster_name", cluster_name);
> if (rv != CS_OK) {
> free(*cluster_name);
> rv = -1;
> @@ -2168,9 +2174,8 @@ int get_cluster_name(char **cluster_name)
>
> rv = 0;
> name_err:
> - finalize(handle);
> + cmap_hookers->finalize(handle);
> out:
> - dlclose(lib_handle);
> return rv;
> }
>
> @@ -2208,3 +2213,15 @@ void free_dlm_hookers(void)
> if (dlm_hookers)
> free(dlm_hookers);
> }
> +
> +void set_hookers(void)
> +{
> + set_dlm_hookers();
> + set_cmap_hookers();
> +}
> +
> +void free_hookers(void)
> +{
> + free_dlm_hookers();
> + free_cmap_hookers();
> +}
>
You could put both functions in a single structure called cluster_hooks.
--
Goldwyn
^ permalink raw reply
* Re: [PATCH 1/2] Safeguard against writing to an active device of another node
From: Goldwyn Rodrigues @ 2015-08-03 11:56 UTC (permalink / raw)
To: Guoqing Jiang, neilb; +Cc: linux-raid
In-Reply-To: <1438601519-17919-1-git-send-email-gqjiang@suse.com>
On 08/03/2015 06:31 AM, Guoqing Jiang wrote:
> Modifying an exiting device's superblock or creating a new superblock
> on an existing device needs to be checked because the device could be
> in use by another node in another array. So, we check this by taking
> all superblock locks in userspace so that we don't step onto an active
> device used by another node and safeguard against accidental edits.
> After the edit is complete, we release all locks and the lockspace so
> that it can be used by the kernel space.
>
> Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
> Signed-off-by: Guoqing Jiang <gqjiang@suse.com>
> ---
> Makefile | 3 +-
> mdadm.c | 11 +++++
> mdadm.h | 46 ++++++++++++++++++
> super1.c | 51 ++++++++++++++++++++
> util.c | 165 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 5 files changed, 275 insertions(+), 1 deletion(-)
>
> diff --git a/Makefile b/Makefile
> index c189279..370ef75 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -81,11 +81,12 @@ FAILED_SLOTS_DIR = $(RUN_DIR)/failed-slots
> SYSTEMD_DIR=/lib/systemd/system
>
> COROSYNC:=$(shell [ -d /usr/include/corosync ] || echo -DNO_COROSYNC)
> +DLM:=$(shell [ -f /usr/include/libdlm.h ] || echo -DNO_DLM)
>
> DIRFLAGS = -DMAP_DIR=\"$(MAP_DIR)\" -DMAP_FILE=\"$(MAP_FILE)\"
> DIRFLAGS += -DMDMON_DIR=\"$(MDMON_DIR)\"
> DIRFLAGS += -DFAILED_SLOTS_DIR=\"$(FAILED_SLOTS_DIR)\"
> -CFLAGS = $(CWFLAGS) $(CXFLAGS) -DSendmail=\""$(MAILCMD)"\" $(CONFFILEFLAGS) $(DIRFLAGS) $(COROSYNC)
> +CFLAGS = $(CWFLAGS) $(CXFLAGS) -DSendmail=\""$(MAILCMD)"\" $(CONFFILEFLAGS) $(DIRFLAGS) $(COROSYNC) $(DLM)
>
> VERSION = $(shell [ -d .git ] && git describe HEAD | sed 's/mdadm-//')
> VERS_DATE = $(shell [ -d .git ] && date --date="`git log -n1 --format=format:%cd --date=short`" '+%0dth %B %Y' | sed -e 's/1th/1st/' -e 's/2th/2nd/' -e 's/11st/11th/' -e 's/12nd/12th/')
> diff --git a/mdadm.c b/mdadm.c
> index c4daf25..d8032c1 100644
> --- a/mdadm.c
> +++ b/mdadm.c
> @@ -1322,6 +1322,8 @@ int main(int argc, char *argv[])
> /* --scan implied --brief unless -vv */
> c.brief = 1;
>
> + set_dlm_hookers(); /* get dlm funcs from libdlm_lt.so.3 */
> +
Universal Comment: Let call it set_dlm_hooks as opposed to hookers.
> rv = 0;
> switch(mode) {
> case MANAGE:
> @@ -1362,10 +1364,12 @@ int main(int argc, char *argv[])
> else if (devs_found > 0) {
> if (c.update && devs_found > 1) {
> pr_err("can only update a single array at a time\n");
> + free_dlm_hookers(); /* close dlm stuffs */
> exit(1);
> }
> if (c.backup_file && devs_found > 1) {
> pr_err("can only assemble a single array when providing a backup file.\n");
> + free_dlm_hookers(); /* close dlm stuffs */
> exit(1);
> }
> for (dv = devlist ; dv ; dv=dv->next) {
> @@ -1384,10 +1388,12 @@ int main(int argc, char *argv[])
> } else {
> if (c.update) {
> pr_err("--update not meaningful with a --scan assembly.\n");
> + free_dlm_hookers(); /* close dlm stuffs */
> exit(1);
> }
> if (c.backup_file) {
> pr_err("--backup_file not meaningful with a --scan assembly.\n");
> + free_dlm_hookers(); /* close dlm stuffs */
> exit(1);
> }
> rv = scan_assemble(ss, &c, &ident);
> @@ -1455,12 +1461,14 @@ int main(int argc, char *argv[])
> if (devmode == 'E') {
> if (devlist == NULL && !c.scan) {
> pr_err("No devices to examine\n");
> + free_dlm_hookers(); /* close dlm stuffs */
> exit(2);
> }
> if (devlist == NULL)
> devlist = conf_get_devs();
> if (devlist == NULL) {
> pr_err("No devices listed in %s\n", configfile?configfile:DefaultConfFile);
> + free_dlm_hookers(); /* close dlm stuffs */
> exit(1);
> }
> rv = Examine(devlist, &c, ss);
> @@ -1477,6 +1485,7 @@ int main(int argc, char *argv[])
> rv = Write_rules(udev_filename);
> else {
> pr_err("No devices given.\n");
> + free_dlm_hookers(); /* close dlm stuffs */
> exit(2);
> }
> } else
> @@ -1615,6 +1624,8 @@ int main(int argc, char *argv[])
> autodetect();
> break;
> }
> +
> + free_dlm_hookers(); /* close dlm stuffs */
> exit(rv);
> }
>
> diff --git a/mdadm.h b/mdadm.h
> index 97892e6..c53adc5 100644
> --- a/mdadm.h
> +++ b/mdadm.h
> @@ -35,6 +35,7 @@ extern __off64_t lseek64 __P ((int __fd, __off64_t __offset, int __whence));
>
> #include <sys/types.h>
> #include <sys/stat.h>
> +#include <stdint.h>
> #include <stdlib.h>
> #include <time.h>
> #include <sys/time.h>
> @@ -51,6 +52,25 @@ extern __off64_t lseek64 __P ((int __fd, __off64_t __offset, int __whence));
> #define srandom srand
> #endif
>
> +#ifndef NO_DLM
> +#include <libdlm.h>
> +#include <errno.h>
> +#else
> +#define LKF_NOQUEUE 0x00000001
> +#define LKF_CONVERT 0x00000004
> +#define LKM_PWMODE 4
> +#define EUNLOCK 0x10002
> +
> +typedef void *dlm_lshandle_t;
> +
> +struct dlm_lksb {
> + int sb_status;
> + uint32_t sb_lkid;
> + char sb_flags;
> + char *sb_lvbptr;
> +};
> +#endif
> +
> #include <linux/kdev_t.h>
> /*#include <linux/fs.h> */
> #include <sys/mount.h>
> @@ -1428,7 +1448,33 @@ extern char *stat2devnm(struct stat *st);
> extern char *fd2devnm(int fd);
>
> extern int in_initrd(void);
> +
> +struct dlm_hookers {
> + void *dlm_handle; /* dlm lib related */
> +
> + dlm_lshandle_t (*create_lockspace)(const char *name,
> + unsigned int mode);
> + int (*release_lockspace)(const char *name, dlm_lshandle_t ls,
> + int force);
> + int (*ls_lock)(dlm_lshandle_t lockspace, uint32_t mode,
> + struct dlm_lksb *lksb, uint32_t flags,
> + const void *name, unsigned int namelen,
> + uint32_t parent, void (*astaddr) (void *astarg),
> + void *astarg, void (*bastaddr) (void *astarg),
> + void *range);
> + int (*ls_unlock)(dlm_lshandle_t lockspace, uint32_t lkid,
> + uint32_t flags, struct dlm_lksb *lksb,
> + void *astarg);
> + int (*ls_get_fd)(dlm_lshandle_t ls);
> + int (*dispatch)(int fd);
> +};
> +
> extern int get_cluster_name(char **name);
> +extern int is_clustered(struct supertype *st);
> +extern int cluster_get_dlmlock(struct supertype *st, int *lockid);
> +extern int cluster_release_dlmlock(struct supertype *st, int lockid);
> +extern void set_dlm_hookers(void);
> +extern void free_dlm_hookers(void);
>
> #define _ROUND_UP(val, base) (((val) + (base) - 1) & ~(base - 1))
> #define ROUND_UP(val, base) _ROUND_UP(val, (typeof(val))(base))
> diff --git a/super1.c b/super1.c
> index fda71e3..bd88c36 100644
> --- a/super1.c
> +++ b/super1.c
> @@ -1072,8 +1072,18 @@ static int update_super1(struct supertype *st, struct mdinfo *info,
> * ignored.
> */
> int rv = 0;
> + int lockid;
> struct mdp_superblock_1 *sb = st->sb;
>
> + if (is_clustered(st)) {
> + rv = cluster_get_dlmlock(st, &lockid);
> + if (rv) {
> + pr_err("Cannot get dlmlock in %s return %d\n", __func__, rv);
> + cluster_release_dlmlock(st, lockid);
> + return rv;
> + }
> + }
> +
> if (strcmp(update, "homehost") == 0 &&
> homehost) {
> /* Note that 'homehost' is special as it is really
> @@ -1330,6 +1340,9 @@ static int update_super1(struct supertype *st, struct mdinfo *info,
> rv = -1;
>
> sb->sb_csum = calc_sb_1_csum(sb);
> + if (is_clustered(st))
> + cluster_release_dlmlock(st, lockid);
> +
> return rv;
> }
>
> @@ -1433,6 +1446,16 @@ static int add_to_super1(struct supertype *st, mdu_disk_info_t *dk,
> struct mdp_superblock_1 *sb = st->sb;
> __u16 *rp = sb->dev_roles + dk->number;
> struct devinfo *di, **dip;
> + int rv, lockid;
> +
> + if (is_clustered(st)) {
> + rv = cluster_get_dlmlock(st, &lockid);
> + if (rv) {
> + pr_err("Cannot get dlmlock in %s return %d\n", __func__, rv);
> + cluster_release_dlmlock(st, lockid);
> + return rv;
> + }
> + }
>
> if ((dk->state & 6) == 6) /* active, sync */
> *rp = __cpu_to_le16(dk->raid_disk);
> @@ -1460,6 +1483,9 @@ static int add_to_super1(struct supertype *st, mdu_disk_info_t *dk,
> di->next = NULL;
> *dip = di;
>
> + if (is_clustered(st))
> + cluster_release_dlmlock(st, lockid);
> +
> return 0;
> }
> #endif
> @@ -1473,6 +1499,16 @@ static int store_super1(struct supertype *st, int fd)
> struct align_fd afd;
> int sbsize;
> unsigned long long dsize;
> + int rv, lockid;
> +
> + if (is_clustered(st)) {
> + rv = cluster_get_dlmlock(st, &lockid);
> + if (rv) {
> + pr_err("Cannot get dlmlock in %s return %d\n", __func__, rv);
> + cluster_release_dlmlock(st, lockid);
> + return rv;
> + }
> + }
>
> if (!get_dev_size(fd, NULL, &dsize))
> return 1;
> @@ -1533,6 +1569,9 @@ static int store_super1(struct supertype *st, int fd)
> }
> }
> fsync(fd);
> + if (is_clustered(st))
> + cluster_release_dlmlock(st, lockid);
> +
> return 0;
> }
>
> @@ -2282,6 +2321,16 @@ static int write_bitmap1(struct supertype *st, int fd, enum bitmap_update update
>
> static void free_super1(struct supertype *st)
> {
> + int rv, lockid;
> + if (is_clustered(st)) {
> + rv = cluster_get_dlmlock(st, &lockid);
> + if (rv) {
> + pr_err("Cannot get dlmlock in %s return %d\n", __func__, rv);
> + cluster_release_dlmlock(st, lockid);
> + return;
> + }
> + }
> +
> if (st->sb)
> free(st->sb);
> while (st->info) {
> @@ -2292,6 +2341,8 @@ static void free_super1(struct supertype *st)
> free(di);
> }
> st->sb = NULL;
> + if (is_clustered(st))
> + cluster_release_dlmlock(st, lockid);
> }
>
> #ifndef MDASSEMBLE
> diff --git a/util.c b/util.c
> index ea6e688..19ecf9f 100644
> --- a/util.c
> +++ b/util.c
> @@ -24,6 +24,7 @@
>
> #include "mdadm.h"
> #include "md_p.h"
> +#include <sys/poll.h>
> #include <sys/socket.h>
> #include <sys/utsname.h>
> #include <sys/wait.h>
> @@ -88,6 +89,135 @@ struct blkpg_partition {
> aren't permitted). */
> #define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
>
> +static struct dlm_hookers *dlm_hookers = NULL;
> +static int is_dlm_hookers_ready = 0;
This should not be required, just checking for dlm_hooks == NULL should
be enough. This needs to be set accordingly in set_dlm_hooks.
> +static struct dlm_lock_resource *dlm_lock_res = NULL;
> +static int ast_called = 0;
> +
> +struct dlm_lock_resource {
> + dlm_lshandle_t *ls;
> + struct dlm_lksb lksb;
> +};
> +
> +int is_clustered(struct supertype *st)
> +{
> + /* is it a cluster md or not */
> + if (is_dlm_hookers_ready && st->cluster_name)
> + return 1;
> + else
> + return 0;
> +}
> +
> +/* Using poll(2) to wait for and dispatch ASTs */
> +static int poll_for_ast(dlm_lshandle_t ls)
> +{
> + struct pollfd pfd;
Shouldn't you check dlm_hooks is NULL here? and starting of every
function which requires dlm_hooks.
Also, a return value from these functions do not mean an error, it means
the library is not present.
> +
> + pfd.fd = dlm_hookers->ls_get_fd(ls);
> + pfd.events = POLLIN;
> +
> + while (!ast_called)
> + {
> + if (poll(&pfd, 1, 0) < 0)
> + {
> + perror("poll");
> + return -1;
> + }
> + dlm_hookers->dispatch(dlm_hookers->ls_get_fd(ls));
> + }
> + ast_called = 0;
> +
> + return 0;
> +}
> +
> +static void dlm_ast(void *arg)
> +{
> + ast_called = 1;
> +}
> +
> +/* Create the lockspace, take bitmapXXX locks on all the bitmaps. */
> +int cluster_get_dlmlock(struct supertype *st, int *lockid)
> +{
> + int ret = -1;
> + char str[64];
> + int flags = LKF_NOQUEUE;
> +
> + dlm_lock_res = xmalloc(sizeof(struct dlm_lock_resource));
> + if (!dlm_lock_res)
> + goto out;
> +
> + dlm_lock_res->ls = dlm_hookers->create_lockspace(st->cluster_name, O_RDWR);
> + if (!dlm_lock_res->ls) {
> + pr_err("%s failed to create lockspace\n", st->cluster_name);
> + goto out;
> + }
> +
> + /* Conversions need the lockid in the LKSB */
> + if (flags & LKF_CONVERT)
> + dlm_lock_res->lksb.sb_lkid = *lockid;
> +
> + snprintf(str, 64, "bitmap%04d", st->nodes);
> + /* if flags with LKF_CONVERT causes below return ENOENT which means
> + * "No such file or directory" */
> + ret = dlm_hookers->ls_lock(dlm_lock_res->ls, LKM_PWMODE, &dlm_lock_res->lksb,
> + flags, str, strlen(str), 0, dlm_ast,
> + dlm_lock_res, NULL, NULL);
> + if (ret) {
> + pr_err("error %d when get PW mode on lock %s\n", errno, str);
> + goto out;
> + }
> +
> + /* Wait for it to complete */
> + poll_for_ast(dlm_lock_res->ls);
> + *lockid = dlm_lock_res->lksb.sb_lkid;
> +
> + errno = dlm_lock_res->lksb.sb_status;
> + if (errno) {
> + pr_err("error %d happened in ast with lock %s\n", errno, str);
> + goto out;
> + }
> +
> +out:
> + return ret;
> +}
> +
> +int cluster_release_dlmlock(struct supertype *st, int lockid)
> +{
> + int ret = -1;
> +
> + /* if flags with LKF_CONVERT causes below return EINVAL which means
> + * "Invalid argument" */
> + ret = dlm_hookers->ls_unlock(dlm_lock_res->ls, lockid, 0,
> + &dlm_lock_res->lksb, dlm_lock_res);
> + if (ret) {
> + pr_err("error %d happened when unlock\n", errno);
> + /* XXX make sure the lock is unlocked eventually */
> + goto out;
> + }
> +
> + /* Wait for it to complete */
> + poll_for_ast(dlm_lock_res->ls);
> +
> + errno = dlm_lock_res->lksb.sb_status;
> + if (errno != EUNLOCK) {
> + pr_err("error %d happened in ast when unlock lockspace\n", errno);
> + /* XXX make sure the lockspace is unlocked eventually */
> + goto out;
> + }
> +
> + ret = dlm_hookers->release_lockspace(st->cluster_name, dlm_lock_res->ls, 1);
> + if (ret) {
> + pr_err("error %d happened when release lockspace\n", errno);
> + /* XXX make sure the lockspace is released eventually */
> + goto out;
> + }
> + free(dlm_lock_res);
> +
> +out:
> + return ret;
> +}
> +
> +
> /*
> * Parse a 128 bit uuid in 4 integers
> * format is 32 hexx nibbles with options :.<space> separator
> @@ -2043,3 +2173,38 @@ out:
> dlclose(lib_handle);
> return rv;
> }
> +
> +void set_dlm_hookers(void)
> +{
> + dlm_hookers = xmalloc(sizeof(struct dlm_hookers));
> + if (!dlm_hookers)
> + return;
> +
> + dlm_hookers->dlm_handle = dlopen("libdlm_lt.so.3", RTLD_NOW | RTLD_LOCAL);
> + if (!dlm_hookers->dlm_handle)
> + return;
> +
> + dlm_hookers->create_lockspace = dlsym(dlm_hookers->dlm_handle, "dlm_create_lockspace");
> + dlm_hookers->release_lockspace = dlsym(dlm_hookers->dlm_handle, "dlm_release_lockspace");
> + dlm_hookers->ls_lock = dlsym(dlm_hookers->dlm_handle, "dlm_ls_lock");
> + dlm_hookers->ls_unlock = dlsym(dlm_hookers->dlm_handle, "dlm_ls_unlock");
> + dlm_hookers->ls_get_fd = dlsym(dlm_hookers->dlm_handle, "dlm_ls_get_fd");
> + dlm_hookers->dispatch = dlsym(dlm_hookers->dlm_handle, "dlm_dispatch");
> +
> + if (!dlm_hookers->create_lockspace || !dlm_hookers->ls_lock ||
> + !dlm_hookers->ls_unlock || !dlm_hookers->release_lockspace ||
> + !dlm_hookers->ls_get_fd || !dlm_hookers->dispatch)
> + dlclose(dlm_hookers->dlm_handle);
> + else
> + is_dlm_hookers_ready = 1;
> +}
> +
> +void free_dlm_hookers(void)
> +{
> + if (is_dlm_hookers_ready) {
> + dlclose(dlm_hookers->dlm_handle);
> + is_dlm_hookers_ready = 0;
> + }
> + if (dlm_hookers)
> + free(dlm_hookers);
> +}
>
--
Goldwyn
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox