vfs: don't use PARENT/CHILD lock classes for non-directories
authorJ. Bruce Fields <bfields@redhat.com>
Wed, 25 Apr 2012 11:19:52 +0000 (07:19 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Sat, 9 Nov 2013 05:16:39 +0000 (00:16 -0500)
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 <jlayton@redhat.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/inode.c

index ef25afdf39069d69153c9cb6ab702400824de86e..51f329b98aa43f50d085606377bc14b042763dab 100644 (file)
@@ -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);