Whamcloud - gitweb
b=22522 do not remove from res_list without locks
authorOleg Drokin <green@linuxhacker.ru>
Wed, 5 May 2010 23:35:58 +0000 (19:35 -0400)
committerRobert Read <robert.read@oracle.com>
Thu, 6 May 2010 00:55:09 +0000 (17:55 -0700)
Patch in bug 21501 moved list manipulation of res_list outside or res_lock
introducing a race window in flock code. Move it back under the lock.

i=rread
i=adilger

lustre/ldlm/ldlm_flock.c

index 914ed4e..8e17167 100644 (file)
@@ -605,10 +605,10 @@ granted:
         cfs_list_del_init(&lock->l_flock_waitq);
         cfs_spin_unlock(&ldlm_flock_waitq_lock);
 
+        lock_res_and_lock(lock);
         /* ldlm_lock_enqueue() has already placed lock on the granted list. */
         cfs_list_del_init(&lock->l_res_link);
 
-        lock_res_and_lock(lock);
         if (flags & LDLM_FL_TEST_LOCK) {
                 /* fcntl(F_GETLK) request */
                 /* The old mode was saved in getlk->fl_type so that if the mode