On Wed, 10 Jul 2013 19:54:09 +0200 Martin Wilck [off-list ref] wrote:
Hi Neil, hi all,
I discovered a weird behavior of mdadm -Db - it will switch a RAID array
from read-auto state to write-pending. For DDF (and possibly other
formats) this will cause metadata writes.
If I read the code correctly, the reason is that mdadm -Db will use the
GET_BITMAP_FILE ioctl, which calls md_allow_write(). I saw this on a
CentOS 6.3 kernel but comparing the code I didn't see a difference in
recent kernels.
I am wondering if this is intentional, and if no, if anything could be
done about it. It is certainly surprising behavior.
Regards
Martin
I hadn't thought of that consequence.
Probably the best thing to do is:
diff --git a/drivers/md/md.c b/drivers/md/md.c
index d059af5..b19a1c8 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -5629,10 +5629,7 @@ static int get_bitmap_file(struct mddev * mddev, void __user * arg)
char *ptr, *buf = NULL;
int err = -ENOMEM;
- if (md_allow_write(mddev))
- file = kmalloc(sizeof(*file), GFP_NOIO);
- else
- file = kmalloc(sizeof(*file), GFP_KERNEL);
+ file = kmalloc(sizeof(*file), GFP_NOIO);
if (!file)
goto out;
A failure here is not likely and not catastrophic.
Does it fix the situation for you?
NeilBrown