aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/core/inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/core/inode.c')
-rw-r--r--drivers/usb/core/inode.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/usb/core/inode.c b/drivers/usb/core/inode.c
index b690aa35df9a..1b125c224dcf 100644
--- a/drivers/usb/core/inode.c
+++ b/drivers/usb/core/inode.c
@@ -343,17 +343,19 @@ static int usbfs_empty (struct dentry *dentry)
343{ 343{
344 struct list_head *list; 344 struct list_head *list;
345 345
346 spin_lock(&dcache_lock); 346 spin_lock(&dentry->d_lock);
347
348 list_for_each(list, &dentry->d_subdirs) { 347 list_for_each(list, &dentry->d_subdirs) {
349 struct dentry *de = list_entry(list, struct dentry, d_u.d_child); 348 struct dentry *de = list_entry(list, struct dentry, d_u.d_child);
349
350 spin_lock_nested(&de->d_lock, DENTRY_D_LOCK_NESTED);
350 if (usbfs_positive(de)) { 351 if (usbfs_positive(de)) {
351 spin_unlock(&dcache_lock); 352 spin_unlock(&de->d_lock);
353 spin_unlock(&dentry->d_lock);
352 return 0; 354 return 0;
353 } 355 }
356 spin_unlock(&de->d_lock);
354 } 357 }
355 358 spin_unlock(&dentry->d_lock);
356 spin_unlock(&dcache_lock);
357 return 1; 359 return 1;
358} 360}
359 361