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.
This commit is contained in:
parent
9169e8004d
commit
d4c4a6f165
@ -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));
|
||||
|
Loading…
Reference in New Issue
Block a user