+Index: linux-2.6.10-base/fs/locks.c
+===================================================================
+--- linux-2.6.10-base.orig/fs/locks.c 2005-09-16 01:45:22.000000000 +0800
++++ linux-2.6.10-base/fs/locks.c 2005-09-16 01:45:48.000000000 +0800
+@@ -1819,14 +1819,6 @@
+ {
+ struct file_lock lock, **before;
+
+- /*
+- * If there are no locks held on this file, we don't need to call
+- * posix_lock_file(). Another process could be setting a lock on this
+- * file at the same time, but we wouldn't remove that lock anyway.
+- */
+- before = &filp->f_dentry->d_inode->i_flock;
+- if (*before == NULL)
+- return;
+
+ lock.fl_type = F_UNLCK;
+ lock.fl_flags = FL_POSIX;
+@@ -1843,6 +1835,15 @@
+ goto out;
+ }
+
++ /*
++ * If there are no locks held on this file, we don't need to call
++ * posix_lock_file(). Another process could be setting a lock on this
++ * file at the same time, but we wouldn't remove that lock anyway.
++ */
++ before = &filp->f_dentry->d_inode->i_flock;
++ if (*before == NULL)
++ return;
++
+ /* Can't use posix_lock_file here; we need to remove it no matter
+ * which pid we have.
+ */