It's definitely not okay to drop the content lock around the refresh_attrs, since the order of getting the content locks is important. However, maybe we can re-arrange the code to drop both locks before doing the refresh. I'll look into it.
On Fri, Jul 28, 2017 at 10:06 AM, Pradeep <pradeep.tho...@gmail.com> wrote: > Hello, > > I seem to be hitting a deadlock in Ganesha mdcache. I have debugged it > and here is what I see on the hung process: > > Thread1 is doing a rename operation. Lets say file1 being moved from > 'dir0' to 'dir1'. This calls mdcache_rename() > - Holds content_lock for both parents - dir0 and dir1 > - In mdcache_refresh_attrs_no_invalidate() on 'dir1' > o Tries to hold attr_lock in write mode [ attr_lock is needed when > calling mdcache_refresh_attrs() ] > > Thread2 is doing a getattr on 'dir1' [ the destination diretory of the > rename]. This calls mdcache_getattrs(). > - Holds attr_lock in write mode. > - Calls mdcache_refresh_attrs( invalidate=true) > o Tries to hold content_lock in write mode if ‘invalidate’ is needed. > > These two threads ends up in a deadlock and all other threads waiting > for attr_lock in READ mode also are hung. > > To fix this, is it ok to drop content_lock before calling > mdcache_refresh_attrs() in mdcache_rename(). From the locking > guidelines, it appears that mdcache_refresh_attrs() doesn't require > content_lock. > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > _______________________________________________ > Nfs-ganesha-devel mailing list > Nfs-ganesha-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/nfs-ganesha-devel ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Nfs-ganesha-devel mailing list Nfs-ganesha-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nfs-ganesha-devel