Project

General

Profile

Bug #3608

No need to protect a write to p_qoverflow in svc_xprt_qput() using p_qend_lock

Added by Marcel Telka over 7 years ago. Updated over 7 years ago.

Status:
New
Priority:
Low
Assignee:
Category:
nfs - NFS server and client
Start date:
2013-03-05
Due date:
% Done:

0%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage
Gerrit CR:

Description

Here:

917static void
918svc_xprt_qput(SVCPOOL *pool, SVCMASTERXPRT *xprt)
919{
920    ASSERT(MUTEX_HELD(&pool->p_req_lock));
921
922    /* If the overflow flag is there is nothing we can do */
923    if (pool->p_qoverflow)
924        return;
925
926    /* If the queue is full turn the overflow flag on and exit */
927    if (pool->p_qtop->q_next == pool->p_qend) {
928        mutex_enter(&pool->p_qend_lock);
929        if (pool->p_qtop->q_next == pool->p_qend) {
930            pool->p_qoverflow = TRUE;
931            mutex_exit(&pool->p_qend_lock);
932            return;
933        }
934        mutex_exit(&pool->p_qend_lock);
935    }
936
937    /* Insert a hint and move pool->p_qtop */
938    pool->p_qtop->q_xprt = xprt;
939    pool->p_qtop = pool->p_qtop->q_next;
940}

the write to p_qoverflow at line 930 is protected by two mutexes: p_req_lock and p_qend_lock. The protection using only the p_req_lock should be enough here.

Lines 930 and 931 could be safely swapped.

Also available in: Atom PDF