aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArjan van de Ven <arjan@linux.intel.com>2006-07-03 03:25:21 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-07-03 18:27:08 -0400
commit8e7795ef6b5fd117b22b87ea7d501de2526a25f7 (patch)
tree2054071ac762b7d822366390d8a3e6dc229ac85f
parent5c81a4197de38411fe3e27f8593fff73a5d6b868 (diff)
[PATCH] lockdep: annotate USBFS
In usbfs's fs_remove_file() function, the aim is to remove a file or directory from usbfs. This is done by first taking the i_mutex of the parent directory of this file/dir via mutex_lock(&parent->d_inode->i_mutex); and then to call either usbfs_rmdir() for a directory or usbfs_unlink() for a file. Both these functions then take the i_mutex for the to-be-removed object themselves: mutex_lock(&inode->i_mutex); This is a classical parent->child locking order relationship that the VFS uses all over the place; the VFS locking rule is "you need to take the parent first". This patch annotates the usbfs code to make this explicit and thus informs the lockdep code that those two locks indeed have this relationship. The rules for unlink that we already use in the VFS for unlink are to use I_MUTEX_PARENT for the parent directory, and a normal mutex for the file itself; this patch follows that convention. Has no effect on non-lockdep kernels. Signed-off-by: Arjan van de Ven <arjan@linux.intel.com> Signed-off-by: Ingo Molnar <mingo@elte.hu> Cc: Greg KH <greg@kroah.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--drivers/usb/core/inode.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/usb/core/inode.c b/drivers/usb/core/inode.c
index cf11196e012d..f48c3dbc367a 100644
--- a/drivers/usb/core/inode.c
+++ b/drivers/usb/core/inode.c
@@ -527,7 +527,7 @@ static void fs_remove_file (struct dentry *dentry)
527 if (!parent || !parent->d_inode) 527 if (!parent || !parent->d_inode)
528 return; 528 return;
529 529
530 mutex_lock(&parent->d_inode->i_mutex); 530 mutex_lock_nested(&parent->d_inode->i_mutex, I_MUTEX_PARENT);
531 if (usbfs_positive(dentry)) { 531 if (usbfs_positive(dentry)) {
532 if (dentry->d_inode) { 532 if (dentry->d_inode) {
533 if (S_ISDIR(dentry->d_inode->i_mode)) 533 if (S_ISDIR(dentry->d_inode->i_mode))