[ovs-dev] [PATCH v2] fat-rwlock: fat_rwlock_tryrdlock() should never block

Ben Pfaff blp at nicira.com
Mon Aug 18 20:23:26 UTC 2014


On Mon, Aug 18, 2014 at 12:57:42PM -0700, Daniele Di Proietto wrote:
> fat_rwlock_tryrdlock() used to call fat_rwlock_get_slot__() which could block
> in the "slow path" case. This commit adds fat_rwlock_try_get_slot__() which
> does not block, even in the "slow path" case.
> 
> This fixes a minor issue in dpif-netdev: when the datapath has no registered
> upcall handler (e.g. if it is created with dpctl commands), dp_netdev_input()
> hangs if it does not find a packet's flow in the classifier.
> 
> Signed-off-by: Daniele Di Proietto <ddiproietto at vmware.com>

I applied this to master.  I made the commit message even more
descriptive:

commit 1ef49150ab78f1f859bd875ce3ce7fcec778554c
Author: Daniele Di Proietto <ddiproietto at vmware.com>
Date:   Mon Aug 18 12:57:42 2014 -0700

    fat-rwlock: fat_rwlock_tryrdlock() should never block
    
    fat_rwlock_tryrdlock() used to call fat_rwlock_get_slot__() which could blo
    in the "slow path" case. This commit adds fat_rwlock_try_get_slot__() which
    does not block, even in the "slow path" case.
    
    This fixes a minor issue in dpif-netdev: when the datapath has no registere
    upcall handler (e.g. if it is created with dpctl commands), dp_netdev_input
    hangs if it does not find a packet's flow in the classifier.  This is
    because dpif-netdev uses its upcall_rwlock as a way to enable and disable
    upcalls and thus holds the upcall_rwlock write lock as long as upcalls are
    disabled.  Both holding the write lock and creating a slot require the
    fat_rwlock's mutex, causing the hang.
    
    Signed-off-by: Daniele Di Proietto <ddiproietto at vmware.com>
    Signed-off-by: Ben Pfaff <blp at nicira.com>



More information about the dev mailing list