Whamcloud - gitweb
b=22660 Return kernel's locking return code to when lustre reports success
[fs/lustre-release.git] / lustre / llite / file.c
index 6acf7f5..a0ed244 100644 (file)
@@ -3169,7 +3169,7 @@ int ll_file_flock(struct file *file, int cmd, struct file_lock *file_lock)
         struct lustre_handle lockh = {0};
         ldlm_policy_data_t flock;
         int flags = 0;
-        int rc;
+        int rc, rc2 = 0;
         ENTRY;
 
         CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu file_lock=%p\n",
@@ -3253,15 +3253,15 @@ int ll_file_flock(struct file *file, int cmd, struct file_lock *file_lock)
                               &flock, &flags, NULL, 0, NULL, &lockh, 0);
         if ((file_lock->fl_flags & FL_FLOCK) &&
             (rc == 0 || file_lock->fl_type == F_UNLCK))
-                ll_flock_lock_file_wait(file, file_lock, (cmd == F_SETLKW));
+                rc2 = ll_flock_lock_file_wait(file, file_lock, (cmd == F_SETLKW));
 #ifdef HAVE_F_OP_FLOCK
         if ((file_lock->fl_flags & FL_POSIX) &&
             (rc == 0 || file_lock->fl_type == F_UNLCK) &&
             !(flags & LDLM_FL_TEST_LOCK))
-                posix_lock_file_wait(file, file_lock);
+                rc2 = posix_lock_file_wait(file, file_lock);
 #endif
 
-        RETURN(rc);
+        RETURN(rc ? rc : rc2);
 }
 
 int ll_file_noflock(struct file *file, int cmd, struct file_lock *file_lock)