flexnbd: Remove the server I/O lock as it no longer has any consumers

This commit is contained in:
nick
2013-09-23 10:29:06 +01:00
parent 9a3106f946
commit 150e506780
4 changed files with 4 additions and 39 deletions

View File

@@ -569,7 +569,6 @@ void control_client_cleanup(struct control_client* client,
if (client->socket) { close(client->socket); }
/* This is wrongness */
if ( server_io_locked( client->flexnbd->serve ) ) { server_unlock_io( client->flexnbd->serve ); }
if ( server_acl_locked( client->flexnbd->serve ) ) { server_unlock_acl( client->flexnbd->serve ); }
control_client_destroy( client );

View File

@@ -231,8 +231,9 @@ static const int mirror_maximum_passes = 7;
/* This must not be called if there's any chance of further I/O. Methods to
* ensure this include:
* - call server_lock_io()
* - call server_forbid_new_clients() followed by a successful server_close_clients() ; server_join_clients()
* - Ensure image size is 0
* - call server_forbid_new_clients() followed by a successful
* server_close_clients() ; server_join_clients()
*/
void mirror_on_exit( struct server * serve )
{
@@ -281,8 +282,6 @@ void mirror_cleanup( struct server * serve,
close( mirror->client );
}
mirror->client = -1;
if( server_io_locked( serve ) ){ server_unlock_io( serve ); }
}

View File

@@ -69,7 +69,6 @@ struct server * server_create (
strcpy(out->filename_incomplete, s_file);
strcpy(out->filename_incomplete + strlen(s_file), ".INCOMPLETE");
out->l_io = flexthread_mutex_create();
out->l_acl = flexthread_mutex_create();
out->l_start_mirror = flexthread_mutex_create();
@@ -93,7 +92,6 @@ void server_destroy( struct server * serve )
flexthread_mutex_destroy( serve->l_start_mirror );
flexthread_mutex_destroy( serve->l_acl );
flexthread_mutex_destroy( serve->l_io );
if ( serve->acl ) {
acl_destroy( serve->acl );
@@ -126,30 +124,6 @@ void server_unlink( struct server * serve )
do { NULLCHECK( s ); \
FATAL_IF( 0 != flexthread_mutex_unlock( s->f ), msg ); } while (0)
void server_lock_io( struct server * serve)
{
debug("IO locking");
SERVER_LOCK( serve, l_io, "Problem with I/O lock" );
}
void server_unlock_io( struct server* serve )
{
debug("IO unlocking");
SERVER_UNLOCK( serve, l_io, "Problem with I/O unlock" );
}
/* This is only to be called from error handlers. */
int server_io_locked( struct server * serve )
{
NULLCHECK( serve );
return flexthread_mutex_held( serve->l_io );
}
void server_lock_acl( struct server *serve )
{
debug("ACL locking");

View File

@@ -38,9 +38,6 @@ struct server {
/** size of file */
uint64_t size;
/** Claims around any I/O to this file */
struct flexthread_mutex * l_io;
/** to interrupt accept loop and clients, write() to close_signal[1] */
struct self_pipe * close_signal;
@@ -93,7 +90,6 @@ struct server {
/** If this isn't set, newly accepted clients will be closed immediately */
int allow_new_clients;
/* Marker for whether this server has control over the data in
* the file, or if we're waiting to receive it from an inbound
* migration which hasn't yet finished.
@@ -117,15 +113,12 @@ struct server * server_create(
int success );
void server_destroy( struct server * );
int server_is_closed(struct server* serve);
void server_lock_io( struct server * serve);
void server_unlock_io( struct server* serve );
void serve_signal_close( struct server *serve );
void serve_wait_for_close( struct server * serve );
void server_replace_acl( struct server *serve, struct acl * acl);
void server_control_arrived( struct server *serve );
int server_is_in_control( struct server *serve );
int server_default_deny( struct server * serve );
int server_io_locked( struct server * serve );
int server_acl_locked( struct server * serve );
void server_lock_acl( struct server *serve );
void server_unlock_acl( struct server *serve );