diff options
author | NeilBrown <neilb@suse.de> | 2011-03-10 07:07:04 +0100 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2011-03-10 07:07:04 +0100 |
commit | abe7250bc70d938f21ccdf0d7686feb39561fe7f (patch) | |
tree | 7807d4e7ba3c938581c0e8e086eaa3b995894b39 /mdopen.c | |
parent | Initialise all of file when opening backup file for reshape. (diff) | |
download | mdadm-abe7250bc70d938f21ccdf0d7686feb39561fe7f.tar.xz mdadm-abe7250bc70d938f21ccdf0d7686feb39561fe7f.zip |
open_mddev: open RDONLY if RDWR doesn't work.
If an array is read-only then "mdadm -S"
cannot open it to stop it without this fix.
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to '')
-rw-r--r-- | mdopen.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -390,6 +390,8 @@ int create_mddev(char *dev, char *name, int autof, int trustworthy, int open_mddev(char *dev, int report_errors) { int mdfd = open(dev, O_RDWR); + if (mdfd < 0 && errno == EACCES) + mdfd = open(dev, O_RDONLY); if (mdfd < 0) { if (report_errors) fprintf(stderr, Name ": error opening %s: %s\n", |