Frank Filz has uploaded this change for review.

View Change

Fix stall when readdir races with I/O and a new mdcache entry created

If readdir causes a new mdcache entry to be created and that races
with I/O on another instance of the cache entry, which thus requires
merge_share to resolve the share reservation, the need to take the
obj_lock for write blocks while the I/O completes while holding the
lock for read.

In this case, there's actually no need to do anything in merge_share
because all the counters in the readdir's copy of the obj handle are
0. Since that copy of the obj handle MUST not accessible to any other
thread, it can be accessed without holding the lock.

So we move acquiring and releasing the lock into merge_share and
check that the dupe_share has non-zero counters before taking the
lock.

Change-Id: I372713360a5c795f77b1365c263c66302ec2490a
Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
---
M src/FSAL/FSAL_CEPH/handle.c
M src/FSAL/FSAL_GLUSTER/handle.c
M src/FSAL/FSAL_GPFS/file.c
M src/FSAL/FSAL_KVSFS/kvsfs_handle.c
M src/FSAL/FSAL_LIZARDFS/handle.c
M src/FSAL/FSAL_MEM/mem_handle.c
M src/FSAL/FSAL_RGW/handle.c
M src/FSAL/FSAL_VFS/file.c
M src/FSAL/Stackable_FSALs/FSAL_MDCACHE/mdcache_helpers.c
M src/FSAL/commonlib.c
M src/include/FSAL/fsal_commonlib.h
11 files changed, 53 insertions(+), 53 deletions(-)

git pull ssh://review.gerrithub.io:29418/ffilz/nfs-ganesha refs/changes/64/514964/1

To view, visit change 514964. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: ffilz/nfs-ganesha
Gerrit-Branch: next
Gerrit-Change-Id: I372713360a5c795f77b1365c263c66302ec2490a
Gerrit-Change-Number: 514964
Gerrit-PatchSet: 1
Gerrit-Owner: Frank Filz <ffilzlnx@mindspring.com>
Gerrit-MessageType: newchange