]> 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>
Thu, 10 Mar 2011 06:21:57 +0000 (17:21 +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 61e7ab89425699bb4dbdc8d69dd742a7a1345795..8294f40d4ee82bf11a985b8e0f61d3a6e1182cf8 100644 (file)
--- a/Grow.c
+++ b/Grow.c
@@ -327,6 +327,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;
                }
@@ -373,8 +377,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;
                }
        }