diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2019-08-28 22:22:44 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2019-08-28 22:22:44 +0000 |
commit | e70ceda132f2fc4e2936ccc207fa6b5a547df82e (patch) | |
tree | bb988a0d7af90e38d67c8a8f00048f113f8f288a /sys/kern/subr_extent.c | |
parent | 3505449c62185c3b58496d4951774bd5d4535e0a (diff) |
If the EX_CONFLICTOK flag is given, allow operations that (partly)
free space that is already free.
ok patrick@
Diffstat (limited to 'sys/kern/subr_extent.c')
-rw-r--r-- | sys/kern/subr_extent.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/sys/kern/subr_extent.c b/sys/kern/subr_extent.c index 03fe2abe42c..09132e69dd5 100644 --- a/sys/kern/subr_extent.c +++ b/sys/kern/subr_extent.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_extent.c,v 1.60 2018/11/14 17:52:48 mpi Exp $ */ +/* $OpenBSD: subr_extent.c,v 1.61 2019/08/28 22:22:43 kettenis Exp $ */ /* $NetBSD: subr_extent.c,v 1.7 1996/11/21 18:46:34 cgd Exp $ */ /*- @@ -964,6 +964,7 @@ extent_free(struct extent *ex, u_long start, u_long size, int flags) struct extent_region *rp, *nrp = NULL; u_long end = start + (size - 1); int exflags; + int error = 0; #ifdef DIAGNOSTIC /* Check arguments. */ @@ -1081,6 +1082,11 @@ extent_free(struct extent *ex, u_long start, u_long size, int flags) } } + if (flags & EX_CONFLICTOK) { + error = EINVAL; + goto done; + } + /* Region not found, or request otherwise invalid. */ #if defined(DIAGNOSTIC) || defined(DDB) extent_print(ex); @@ -1095,7 +1101,7 @@ extent_free(struct extent *ex, u_long start, u_long size, int flags) ex->ex_flags &= ~EXF_WANTED; wakeup(ex); } - return (0); + return (error); } static struct extent_region * |