nfsd and lockd call vfs_lock_file() to lock/unlock the inode
returned by locks_inode(file).
Many places in nfsd/lockd code use the inode returned by
file_inode(file) for lock manipulation. With Overlayfs, file_inode()
(the underlying inode) is not the same object as locks_inode() (the
overlay inode). This can result in "Leaked POSIX lock" messages
and eventually to a kernel crash as reported by Eddie Horng:
Fix all the call sites in nfsd/lockd that should use locks_inode().
This is a correctness bug that manifested when overlayfs gained
NFS export support in v4.16.
Reported-by: Eddie Horng <email@example.com>
Tested-by: Eddie Horng <firstname.lastname@example.org>
Cc: Jeff Layton <email@example.com>
Fixes: 8383f174 ("ovl: wire up NFS export operations")
Signed-off-by: Amir Goldstein <firstname.lastname@example.org>
Signed-off-by: J. Bruce Fields <email@example.com>