]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Grow: give useful message when adding bitmap gives EBUSY.
authorNeilBrown <neilb@suse.de>
Tue, 30 Nov 2010 05:34:25 +0000 (16:34 +1100)
committerNeilBrown <neilb@suse.de>
Tue, 30 Nov 2010 05:34:25 +0000 (16:34 +1100)
If adding a bitmap fails with EBUSY, then it is because the array is
currently resyncing/recovering/reshaping.
As this is non-obvious, give a message explaining the fact.

Signed-off-by: NeilBrown <neilb@suse.de>
Grow.c

diff --git a/Grow.c b/Grow.c
index 8ce4d32e12b2343a93a47c626ee29f8afdb217e1..13c60288112c57a91956dff9a4ad74b62e78f8b1 100644 (file)
--- a/Grow.c
+++ b/Grow.c
@@ -353,6 +353,10 @@ int Grow_addbitmap(char *devname, int fd, char *file, int chunk, int delay, int
                }
                array.state |= (1<<MD_SB_BITMAP_PRESENT);
                if (ioctl(fd, SET_ARRAY_INFO, &array)!= 0) {
+                       if (errno == EBUSY)
+                               fprintf(stderr, Name
+                                       ": Cannot add bitmap while array is"
+                                       " resyncing or reshaping etc.\n");
                        fprintf(stderr, Name ": failed to set internal bitmap.\n");
                        return 1;
                }
@@ -399,8 +403,13 @@ int Grow_addbitmap(char *devname, int fd, char *file, int chunk, int delay, int
                        return 1;
                }
                if (ioctl(fd, SET_BITMAP_FILE, bitmap_fd) < 0) {
+                       int err = errno;
+                       if (errno == EBUSY)
+                               fprintf(stderr, Name
+                                       ": Cannot add bitmap while array is"
+                                       " resyncing or reshaping etc.\n");
                        fprintf(stderr, Name ": Cannot set bitmap file for %s: %s\n",
-                               devname, strerror(errno));
+                               devname, strerror(err));
                        return 1;
                }
        }