aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/md/md.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/md/md.c')
-rw-r--r--sys/dev/md/md.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/dev/md/md.c b/sys/dev/md/md.c
index bb9e64b201a4..99b18b186fb9 100644
--- a/sys/dev/md/md.c
+++ b/sys/dev/md/md.c
@@ -1133,13 +1133,15 @@ xmdctlioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread
mdinit(sc);
return (0);
case MDIOCDETACH:
- if (mdio->md_mediasize != 0 || mdio->md_options != 0)
+ if (mdio->md_mediasize != 0 ||
+ (mdio->md_options & ~MD_FORCE) != 0)
return (EINVAL);
sc = mdfind(mdio->md_unit);
if (sc == NULL)
return (ENOENT);
- if (sc->opencount != 0 && !(sc->flags & MD_FORCE))
+ if (sc->opencount != 0 && !(sc->flags & MD_FORCE) &&
+ !(mdio->md_options & MD_FORCE))
return (EBUSY);
return (mddestroy(sc, td));
case MDIOCQUERY: