Deleted Added
full compact
geom_subr.c (110541) geom_subr.c (110759)
1/*-
2 * Copyright (c) 2002 Poul-Henning Kamp
3 * Copyright (c) 2002 Networks Associates Technology, Inc.
4 * All rights reserved.
5 *
6 * This software was developed for the FreeBSD Project by Poul-Henning Kamp
7 * and NAI Labs, the Security Research Division of Network Associates, Inc.
8 * under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the

--- 18 unchanged lines hidden (view full) ---

27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE.
34 *
1/*-
2 * Copyright (c) 2002 Poul-Henning Kamp
3 * Copyright (c) 2002 Networks Associates Technology, Inc.
4 * All rights reserved.
5 *
6 * This software was developed for the FreeBSD Project by Poul-Henning Kamp
7 * and NAI Labs, the Security Research Division of Network Associates, Inc.
8 * under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the

--- 18 unchanged lines hidden (view full) ---

27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE.
34 *
35 * $FreeBSD: head/sys/geom/geom_subr.c 110541 2003-02-08 13:03:57Z phk $
35 * $FreeBSD: head/sys/geom/geom_subr.c 110759 2003-02-12 09:48:27Z phk $
36 */
37
38
39#include <sys/param.h>
40#include <sys/stdint.h>
41#ifndef _KERNEL
42#include <stdio.h>
43#include <unistd.h>

--- 369 unchanged lines hidden (view full) ---

413
414 g_trace(G_T_ACCESS,
415 "open delta:[r%dw%de%d] old:[r%dw%de%d] provider:[r%dw%de%d] %p(%s)",
416 dcr, dcw, dce,
417 cp->acr, cp->acw, cp->ace,
418 pp->acr, pp->acw, pp->ace,
419 pp, pp->name);
420
36 */
37
38
39#include <sys/param.h>
40#include <sys/stdint.h>
41#ifndef _KERNEL
42#include <stdio.h>
43#include <unistd.h>

--- 369 unchanged lines hidden (view full) ---

413
414 g_trace(G_T_ACCESS,
415 "open delta:[r%dw%de%d] old:[r%dw%de%d] provider:[r%dw%de%d] %p(%s)",
416 dcr, dcw, dce,
417 cp->acr, cp->acw, cp->ace,
418 pp->acr, pp->acw, pp->ace,
419 pp, pp->name);
420
421 /* If foot-shooting is enabled, any open on rank#1 is OK */
422 if ((g_debugflags & 16) && pp->geom->rank == 1)
423 ;
421 /* If we try exclusive but already write: fail */
424 /* If we try exclusive but already write: fail */
422 if (dce > 0 && pw > 0)
425 else if (dce > 0 && pw > 0)
423 return (EPERM);
424 /* If we try write but already exclusive: fail */
426 return (EPERM);
427 /* If we try write but already exclusive: fail */
425 if (dcw > 0 && pe > 0)
428 else if (dcw > 0 && pe > 0)
426 return (EPERM);
427 /* If we try to open more but provider is error'ed: fail */
429 return (EPERM);
430 /* If we try to open more but provider is error'ed: fail */
428 if ((dcr > 0 || dcw > 0 || dce > 0) && pp->error != 0)
431 else if ((dcr > 0 || dcw > 0 || dce > 0) && pp->error != 0)
429 return (pp->error);
430
431 /* Ok then... */
432
433 /*
434 * If we open first write, spoil any partner consumers.
435 * If we close last write, trigger re-taste.
436 */

--- 319 unchanged lines hidden ---
432 return (pp->error);
433
434 /* Ok then... */
435
436 /*
437 * If we open first write, spoil any partner consumers.
438 * If we close last write, trigger re-taste.
439 */

--- 319 unchanged lines hidden ---