From: J. Bruce Fields Date: Wed, 25 Apr 2012 11:19:52 +0000 (-0400) Subject: vfs: don't use PARENT/CHILD lock classes for non-directories X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=275555163e3ac09c016c964a10e0f389cf152c4c;p=deliverable%2Flinux.git vfs: don't use PARENT/CHILD lock classes for non-directories Reserve I_MUTEX_PARENT and I_MUTEX_CHILD for locking of actual directories. (Also I_MUTEX_QUOTA isn't really a meaningful name for this locking class any more; fixed in a later patch.) Acked-by: Jeff Layton Signed-off-by: J. Bruce Fields Signed-off-by: Al Viro --- diff --git a/fs/inode.c b/fs/inode.c index ef25afdf3906..51f329b98aa4 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -951,16 +951,16 @@ void lock_two_nondirectories(struct inode *inode1, struct inode *inode2) { WARN_ON_ONCE(S_ISDIR(inode1->i_mode)); if (inode1 == inode2 || !inode2) { - mutex_lock_nested(&inode1->i_mutex, I_MUTEX_PARENT); + mutex_lock(&inode1->i_mutex); return; } WARN_ON_ONCE(S_ISDIR(inode2->i_mode)); if (inode1 < inode2) { - mutex_lock_nested(&inode1->i_mutex, I_MUTEX_PARENT); - mutex_lock_nested(&inode2->i_mutex, I_MUTEX_CHILD); + mutex_lock(&inode1->i_mutex); + mutex_lock_nested(&inode2->i_mutex, I_MUTEX_QUOTA); } else { - mutex_lock_nested(&inode2->i_mutex, I_MUTEX_PARENT); - mutex_lock_nested(&inode1->i_mutex, I_MUTEX_CHILD); + mutex_lock(&inode2->i_mutex); + mutex_lock_nested(&inode1->i_mutex, I_MUTEX_QUOTA); } } EXPORT_SYMBOL(lock_two_nondirectories);