1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

s3:smb2_lock: iterate over all sconn->client->connections

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
This commit is contained in:
Stefan Metzmacher 2014-09-16 09:03:39 +02:00 committed by Michael Adam
parent 1d53557df5
commit 0944797fef

View File

@ -468,34 +468,48 @@ struct blocking_lock_record *get_pending_smb2req_blr(struct smbd_smb2_request *s
static bool recalc_smb2_brl_timeout(struct smbd_server_connection *sconn)
{
struct smbXsrv_connection *xconn = sconn->conn;
struct smbd_smb2_request *smb2req;
struct smbXsrv_connection *xconn = NULL;
struct timeval next_timeout = timeval_zero();
int max_brl_timeout = lp_parm_int(-1, "brl", "recalctime", 5);
TALLOC_FREE(sconn->smb2.locks.brl_timeout);
for (smb2req = xconn->smb2.requests; smb2req; smb2req = smb2req->next) {
if (sconn != NULL && sconn->client != NULL) {
xconn = sconn->client->connections;
}
for (; xconn != NULL; xconn = xconn->next) {
struct smbd_smb2_request *smb2req, *nextreq;
for (smb2req = xconn->smb2.requests; smb2req; smb2req = nextreq) {
struct blocking_lock_record *blr =
get_pending_smb2req_blr(smb2req);
if (!blr) {
nextreq = smb2req->next;
if (blr == NULL) {
continue;
}
if (timeval_is_zero(&blr->expire_time)) {
if (!timeval_is_zero(&blr->expire_time)) {
next_timeout = timeval_brl_min(&next_timeout,
&blr->expire_time);
continue;
}
/*
* If we're blocked on pid 0xFFFFFFFFFFFFFFFFLL this is
* a POSIX lock, so calculate a timeout of
* 10 seconds into the future.
*/
if (blr->blocking_smblctx == 0xFFFFFFFFFFFFFFFFLL) {
struct timeval psx_to = timeval_current_ofs(10, 0);
next_timeout = timeval_brl_min(&next_timeout, &psx_to);
}
struct timeval psx_to;
continue;
psx_to = timeval_current_ofs(10, 0);
next_timeout = timeval_brl_min(&next_timeout,
&psx_to);
}
}
next_timeout = timeval_brl_min(&next_timeout, &blr->expire_time);
}
if (timeval_is_zero(&next_timeout)) {
@ -775,7 +789,13 @@ static void reprocess_blocked_smb2_lock(struct smbd_smb2_request *smb2req,
void process_blocking_lock_queue_smb2(
struct smbd_server_connection *sconn, struct timeval tv_curr)
{
struct smbXsrv_connection *xconn = sconn->conn;
struct smbXsrv_connection *xconn = NULL;
if (sconn != NULL && sconn->client != NULL) {
xconn = sconn->client->connections;
}
for (; xconn != NULL; xconn = xconn->next) {
struct smbd_smb2_request *smb2req, *nextreq;
for (smb2req = xconn->smb2.requests; smb2req; smb2req = nextreq) {
@ -797,6 +817,7 @@ void process_blocking_lock_queue_smb2(
reprocess_blocked_smb2_lock(smb2req, tv_curr);
}
}
}
recalc_smb2_brl_timeout(sconn);
}
@ -810,7 +831,13 @@ void cancel_pending_lock_requests_by_fid_smb2(files_struct *fsp,
enum file_close_type close_type)
{
struct smbd_server_connection *sconn = fsp->conn->sconn;
struct smbXsrv_connection *xconn = sconn->conn;
struct smbXsrv_connection *xconn = NULL;
if (sconn != NULL && sconn->client != NULL) {
xconn = sconn->client->connections;
}
for (; xconn != NULL; xconn = xconn->next) {
struct smbd_smb2_request *smb2req, *nextreq;
for (smb2req = xconn->smb2.requests; smb2req; smb2req = nextreq) {
@ -872,4 +899,5 @@ void cancel_pending_lock_requests_by_fid_smb2(files_struct *fsp,
NT_STATUS_RANGE_NOT_LOCKED);
}
}
}
}