]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - fs/lockd/svcsubs.c
Merge tag 'v2.6.37' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
[mv-sheeva.git] / fs / lockd / svcsubs.c
index d0ef94cfb3da4d218b66a0a4046d96ab30506f3b..1ca0679c80bfcca842d277f7597d96dbe8792c35 100644 (file)
@@ -170,6 +170,7 @@ nlm_traverse_locks(struct nlm_host *host, struct nlm_file *file,
 
 again:
        file->f_locks = 0;
+       lock_flocks(); /* protects i_flock list */
        for (fl = inode->i_flock; fl; fl = fl->fl_next) {
                if (fl->fl_lmops != &nlmsvc_lock_operations)
                        continue;
@@ -181,6 +182,7 @@ again:
                if (match(lockhost, host)) {
                        struct file_lock lock = *fl;
 
+                       unlock_flocks();
                        lock.fl_type  = F_UNLCK;
                        lock.fl_start = 0;
                        lock.fl_end   = OFFSET_MAX;
@@ -192,6 +194,7 @@ again:
                        goto again;
                }
        }
+       unlock_flocks();
 
        return 0;
 }
@@ -226,10 +229,14 @@ nlm_file_inuse(struct nlm_file *file)
        if (file->f_count || !list_empty(&file->f_blocks) || file->f_shares)
                return 1;
 
+       lock_flocks();
        for (fl = inode->i_flock; fl; fl = fl->fl_next) {
-               if (fl->fl_lmops == &nlmsvc_lock_operations)
+               if (fl->fl_lmops == &nlmsvc_lock_operations) {
+                       unlock_flocks();
                        return 1;
+               }
        }
+       unlock_flocks();
        file->f_locks = 0;
        return 0;
 }