configfs: Rework configfs_depend_item() locking and make lockdep happy
authorLouis Rilling <louis.rilling@kerlabs.com>
Wed, 28 Jan 2009 18:18:33 +0000 (19:18 +0100)
committerJoel Becker <joel.becker@oracle.com>
Thu, 30 Apr 2009 17:48:26 +0000 (10:48 -0700)
commit420118caa32c8ccdf9fce5a623b9de3f951573c5
treee497cfb33e8491ddba3105c4545d11e95aa3d18c
parente74cc06df3b05e2b2c1611a043f6e6dcadaab1eb
configfs: Rework configfs_depend_item() locking and make lockdep happy

configfs_depend_item() recursively locks all inodes mutex from configfs root to
the target item, which makes lockdep unhappy. The purpose of this recursive
locking is to ensure that the item tree can be safely parsed and that the target
item, if found, is not about to leave.

This patch reworks configfs_depend_item() locking using configfs_dirent_lock.
Since configfs_dirent_lock protects all changes to the configfs_dirent tree, and
protects tagging of items to be removed, this lock can be used instead of the
inodes mutex lock chain.
This needs that the check for dependents be done atomically with
CONFIGFS_USET_DROPPING tagging.

Now lockdep looks happy with configfs.

[ Lifted the setting of s_type into configfs_new_dirent() to satisfy the
  atomic setting of CONFIGFS_USET_CREATING  -- Joel ]

Signed-off-by: Louis Rilling <louis.rilling@kerlabs.com>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
fs/configfs/dir.c