From 3a17cc7881e25a35f83573bd5088037483956909 Mon Sep 17 00:00:00 2001 From: phk Date: Fri, 27 Sep 2002 21:12:47 +0000 Subject: Setattr should not retry on EBUSY, we could get EBUSY back because a disklabel modification tries to change an open device, and no counter-examples exists. Be less facist about when we can do Setattr, the openmodes of devices are so loosely managed that the "exclusive" count is almost useless. Sponsored by: DARPA & NAI Labs. --- sys/geom/geom_io.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'sys/geom/geom_io.c') diff --git a/sys/geom/geom_io.c b/sys/geom/geom_io.c index ac71f66..8489a70 100644 --- a/sys/geom/geom_io.c +++ b/sys/geom/geom_io.c @@ -172,19 +172,15 @@ g_io_setattr(const char *attr, struct g_consumer *cp, int len, void *ptr) int error; g_trace(G_T_BIO, "bio_setattr(%s)", attr); - do { - bp = g_new_bio(); - bp->bio_cmd = BIO_SETATTR; - bp->bio_done = NULL; - bp->bio_attribute = attr; - bp->bio_length = len; - bp->bio_data = ptr; - g_io_request(bp, cp); - error = biowait(bp, "gsetattr"); - g_destroy_bio(bp); - if (error == EBUSY) - tsleep(&error, 0, "setattr_busy", hz); - } while(error == EBUSY); + bp = g_new_bio(); + bp->bio_cmd = BIO_SETATTR; + bp->bio_done = NULL; + bp->bio_attribute = attr; + bp->bio_length = len; + bp->bio_data = ptr; + g_io_request(bp, cp); + error = biowait(bp, "gsetattr"); + g_destroy_bio(bp); return (error); } @@ -260,8 +256,13 @@ g_io_request(struct bio *bp, struct g_consumer *cp) return (g_io_fail(bp, EPERM)); break; case BIO_SETATTR: - if ((cp->acw == 0) || (cp->ace == 0)) + /* XXX: Should ideally check for (cp->ace == 0) */ + if ((cp->acw == 0)) { + printf("setattr on %s mode (%d,%d,%d)\n", + cp->provider->name, + cp->acr, cp->acw, cp->ace); return (g_io_fail(bp, EPERM)); + } break; default: return (g_io_fail(bp, EPERM)); -- cgit v1.1