locks: protect most of the file_lock handling with i_lock
[linux-2.6-block.git] / fs / cifs / file.c
index 1686e408564615045e154c22bd1667af9f1cd768..0630710a9c3ff5ffdf2b0588379e1be06b3cb555 100644 (file)
@@ -1092,6 +1092,7 @@ struct lock_to_push {
 static int
 cifs_push_posix_locks(struct cifsFileInfo *cfile)
 {
+       struct inode *inode = cfile->dentry->d_inode;
        struct cifs_tcon *tcon = tlink_tcon(cfile->tlink);
        struct file_lock *flock, **before;
        unsigned int count = 0, i = 0;
@@ -1102,12 +1103,12 @@ cifs_push_posix_locks(struct cifsFileInfo *cfile)
 
        xid = get_xid();
 
-       lock_flocks();
-       cifs_for_each_lock(cfile->dentry->d_inode, before) {
+       spin_lock(&inode->i_lock);
+       cifs_for_each_lock(inode, before) {
                if ((*before)->fl_flags & FL_POSIX)
                        count++;
        }
-       unlock_flocks();
+       spin_unlock(&inode->i_lock);
 
        INIT_LIST_HEAD(&locks_to_send);
 
@@ -1126,8 +1127,8 @@ cifs_push_posix_locks(struct cifsFileInfo *cfile)
        }
 
        el = locks_to_send.next;
-       lock_flocks();
-       cifs_for_each_lock(cfile->dentry->d_inode, before) {
+       spin_lock(&inode->i_lock);
+       cifs_for_each_lock(inode, before) {
                flock = *before;
                if ((flock->fl_flags & FL_POSIX) == 0)
                        continue;
@@ -1152,7 +1153,7 @@ cifs_push_posix_locks(struct cifsFileInfo *cfile)
                lck->offset = flock->fl_start;
                el = el->next;
        }
-       unlock_flocks();
+       spin_unlock(&inode->i_lock);
 
        list_for_each_entry_safe(lck, tmp, &locks_to_send, llist) {
                int stored_rc;