[PATCH 0/2] xfs: kill lockdep false positives from readdir

Dave Chinner
2015-08-11T22:04:45Z

Hi Folks,

These two patches change the XFS directory locking to shut up
lockdep. Ever since we changed the locking to serialise readdir via
the ILOCK for CXFS, lockdep has been producing false positive
warnings because filldir can trigger page faults and lockdep can't
be easily told that you can't take page faults on directory inodes
so it warns about all sorts of stuff that just can't deadlock.

To fix this, we need to change the directory locking (again!)
to use a different structure that separates the page fault path out
from underneath the ILOCK. TO do this, we have to treat the
directory data the same way we treat file data: The IOLOCK
serialises access to the data sections of the inode, the ILOCK
serialises access to the metadata sections of the inode.

This means that we need to take the IOLOCK in operations that modify
the directory data, which means we need nested PARENT lockdep
annotations because we need to lock two inodes at a time, so the
inode subclass lockdep annotations need a complete rework to support
this. This annotation rework is the first patch in the series.

THe second patch in the series is the directory locking rework. It's
all relatively straight forward - on modification the IOLOCK is
taken EXCL before we start transactions, the transaction join is modified
to understand the IOLOCK is also held, and the transaction commit
releases the IOLOCK. On readdir, we hold the IOLOCK in SHARED mode
across the readdir operation, and only hold the ILOCK when doing
operations that walk the extent tree and map directory buffers.

Oleg and Jan, this patchset should fix the lockdep issues that have
been seen with the freeze rework. Oleg, can you you try it with your
current patchset and testing and let me know if there are any issues
that you see?

Cheers,

Dave.