Sachin Punadikar has uploaded this change for review.

View Change

FSAL_MEM : Fix crash in readdir

Due to non-allocation of new object handle while collecting attrs,
existing FD and related mutex were getting used and destroyed after
usage. This was leading to crash due to non-availability of mutex.
'''
[psachin@rhs-srv-03 ~]$ grep 0x7f69d02ce228 /var/log/ganesha.log.broken
11/10/2024 08:05:39 : epoch 67091434 : rhs-srv-03.gdev.lab.eng.rdu2.redhat.com : ganesha.nfsd-714666[svc_6] init_fsal_fd :RW LOCK :F_DBG :Init mutex 0x7f69d02ce228 (&fsal_fd->work_mutex) at /home/psachin/downstream/nfs/nfs-ganesha/src/include/fsal_types.h:987
11/10/2024 08:05:44 : epoch 67091434 : rhs-srv-03.gdev.lab.eng.rdu2.redhat.com : ganesha.nfsd-714666[Gen_Fridge] fsal_start_fd_work :RW LOCK :F_DBG :Acquired mutex 0x7f69d02ce228 (&fsal_fd->work_mutex) at /home/psachin/downstream/nfs/nfs-ganesha/src/FSAL/commonlib.c:2890
11/10/2024 08:05:44 : epoch 67091434 : rhs-srv-03.gdev.lab.eng.rdu2.redhat.com : ganesha.nfsd-714666[Gen_Fridge] fsal_complete_fd_work :RW LOCK :F_DBG :Released mutex 0x7f69d02ce228 (&fsal_fd->work_mutex) at /home/psachin/downstream/nfs/nfs-ganesha/src/FSAL/commonlib.c:2967
11/10/2024 08:06:04 : epoch 67091434 : rhs-srv-03.gdev.lab.eng.rdu2.redhat.com : ganesha.nfsd-714666[Gen_Fridge] fsal_start_fd_work :RW LOCK :F_DBG :Acquired mutex 0x7f69d02ce228 (&fsal_fd->work_mutex) at /home/psachin/downstream/nfs/nfs-ganesha/src/FSAL/commonlib.c:2890
11/10/2024 08:06:04 : epoch 67091434 : rhs-srv-03.gdev.lab.eng.rdu2.redhat.com : ganesha.nfsd-714666[Gen_Fridge] fsal_complete_fd_work :RW LOCK :F_DBG :Released mutex 0x7f69d02ce228 (&fsal_fd->work_mutex) at /home/psachin/downstream/nfs/nfs-ganesha/src/FSAL/commonlib.c:2967
11/10/2024 08:06:48 : epoch 67091434 : rhs-srv-03.gdev.lab.eng.rdu2.redhat.com : ganesha.nfsd-714666[svc_6] fsal_start_fd_work :RW LOCK :F_DBG :Acquired mutex 0x7f69d02ce228 (&fsal_fd->work_mutex) at /home/psachin/downstream/nfs/nfs-ganesha/src/FSAL/commonlib.c:2890
11/10/2024 08:06:48 : epoch 67091434 : rhs-srv-03.gdev.lab.eng.rdu2.redhat.com : ganesha.nfsd-714666[svc_6] fsal_complete_fd_work :RW LOCK :F_DBG :Released mutex 0x7f69d02ce228 (&fsal_fd->work_mutex) at /home/psachin/downstream/nfs/nfs-ganesha/src/FSAL/commonlib.c:2967
11/10/2024 08:06:48 : epoch 67091434 : rhs-srv-03.gdev.lab.eng.rdu2.redhat.com : ganesha.nfsd-714666[svc_6] destroy_fsal_fd :RW LOCK :F_DBG :Destroy mutex 0x7f69d02ce228 (&fsal_fd->work_mutex) at /home/psachin/downstream/nfs/nfs-ganesha/src/include/fsal_types.h:1002
11/10/2024 08:07:04 : epoch 67091434 : rhs-srv-03.gdev.lab.eng.rdu2.redhat.com : ganesha.nfsd-714666[Gen_Fridge] fsal_start_fd_work :RW LOCK :CRIT :Error 22, acquiring mutex 0x7f69d02ce228 (&fsal_fd->work_mutex) at /home/psachin/downstream/nfs/nfs-ganesha/src/FSAL/commonlib.c:2890
'''

Change-Id: Id4c676e5b7e3ec4eb9233a4706a4ea0ebfb6f532
Signed-off-by: Sachin Punadikar <sachin.punadikar@ibm.com>
---
M src/FSAL/FSAL_MEM/mem_handle.c
1 file changed, 34 insertions(+), 17 deletions(-)

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

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

Gerrit-MessageType: newchange
Gerrit-Project: ffilz/nfs-ganesha
Gerrit-Branch: next
Gerrit-Change-Id: Id4c676e5b7e3ec4eb9233a4706a4ea0ebfb6f532
Gerrit-Change-Number: 1202653
Gerrit-PatchSet: 1
Gerrit-Owner: Sachin Punadikar <sachin.punadikar@ibm.com>