Commit 27555516 authored by J. Bruce Fields's avatar J. Bruce Fields Committed by Al Viro

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: default avatarJeff Layton <jlayton@redhat.com>
Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 375e289e
...@@ -951,16 +951,16 @@ void lock_two_nondirectories(struct inode *inode1, struct inode *inode2) ...@@ -951,16 +951,16 @@ void lock_two_nondirectories(struct inode *inode1, struct inode *inode2)
{ {
WARN_ON_ONCE(S_ISDIR(inode1->i_mode)); WARN_ON_ONCE(S_ISDIR(inode1->i_mode));
if (inode1 == inode2 || !inode2) { if (inode1 == inode2 || !inode2) {
mutex_lock_nested(&inode1->i_mutex, I_MUTEX_PARENT); mutex_lock(&inode1->i_mutex);
return; return;
} }
WARN_ON_ONCE(S_ISDIR(inode2->i_mode)); WARN_ON_ONCE(S_ISDIR(inode2->i_mode));
if (inode1 < inode2) { if (inode1 < inode2) {
mutex_lock_nested(&inode1->i_mutex, I_MUTEX_PARENT); mutex_lock(&inode1->i_mutex);
mutex_lock_nested(&inode2->i_mutex, I_MUTEX_CHILD); mutex_lock_nested(&inode2->i_mutex, I_MUTEX_QUOTA);
} else { } else {
mutex_lock_nested(&inode2->i_mutex, I_MUTEX_PARENT); mutex_lock(&inode2->i_mutex);
mutex_lock_nested(&inode1->i_mutex, I_MUTEX_CHILD); mutex_lock_nested(&inode1->i_mutex, I_MUTEX_QUOTA);
} }
} }
EXPORT_SYMBOL(lock_two_nondirectories); EXPORT_SYMBOL(lock_two_nondirectories);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment