]> Pileus Git - ~andy/linux/blobdiff - fs/afs/flock.c
locks: protect most of the file_lock handling with i_lock
[~andy/linux] / fs / afs / flock.c
index 2497bf306c70e4593d552f6e427bfaa81a7d7ccc..a8cf2cff836c337fa64f22009c7cc15e4aa8b6bf 100644 (file)
@@ -252,7 +252,8 @@ static void afs_defer_unlock(struct afs_vnode *vnode, struct key *key)
  */
 static int afs_do_setlk(struct file *file, struct file_lock *fl)
 {
-       struct afs_vnode *vnode = AFS_FS_I(file->f_mapping->host);
+       struct inode *inode = file_inode(file);
+       struct afs_vnode *vnode = AFS_FS_I(inode);
        afs_lock_type_t type;
        struct key *key = file->private_data;
        int ret;
@@ -273,7 +274,7 @@ static int afs_do_setlk(struct file *file, struct file_lock *fl)
 
        type = (fl->fl_type == F_RDLCK) ? AFS_LOCK_READ : AFS_LOCK_WRITE;
 
-       lock_flocks();
+       spin_lock(&inode->i_lock);
 
        /* make sure we've got a callback on this file and that our view of the
         * data version is up to date */
@@ -420,7 +421,7 @@ given_lock:
        afs_vnode_fetch_status(vnode, NULL, key);
 
 error:
-       unlock_flocks();
+       spin_unlock(&inode->i_lock);
        _leave(" = %d", ret);
        return ret;