From: yoe Date: Mon, 17 Mar 2008 10:20:01 +0000 (+0000) Subject: r326: Don't require read-write access to base file when doing copy on write X-Git-Url: http://git.alex.org.uk r326: Don't require read-write access to base file when doing copy on write --- diff --git a/nbd-server.c b/nbd-server.c index 1606d5d..315d44e 100644 --- a/nbd-server.c +++ b/nbd-server.c @@ -1220,8 +1220,12 @@ void setupexport(CLIENT* client) { /* Try again because maybe media was read-only */ fi.fhandle = open(tmpname, O_RDONLY); if(fi.fhandle != -1) { - client->server->flags |= F_AUTOREADONLY; - client->server->flags |= F_READONLY; + /* Opening the base file in copyonwrite mode is + * okay */ + if(!(client->server->flags & F_COPYONWRITE)) { + client->server->flags |= F_AUTOREADONLY; + client->server->flags |= F_READONLY; + } } } if(fi.fhandle == -1) {