locks: don't reuse file_lock in __posix_lock_file
authorJeff Layton <jlayton@primarydata.com>
Tue, 12 Aug 2014 12:03:49 +0000 (08:03 -0400)
committerJeff Layton <jlayton@primarydata.com>
Thu, 14 Aug 2014 14:07:47 +0000 (10:07 -0400)
commitb84d49f9440b2b039828f3eb114e4bd4ebeb0c54
tree685156b25d833997ada9caf07bd7f2541efd53bd
parent566709bd627caf933ab8edffaf598203a0c5c8b2
locks: don't reuse file_lock in __posix_lock_file

Currently in the case where a new file lock completely replaces the old
one, we end up overwriting the existing lock with the new info. This
means that we have to call fl_release_private inside i_lock. Change the
code to instead copy the info to new_fl, insert that lock into the
correct spot and then delete the old lock. In a later patch, we'll defer
the freeing of the old lock until after the i_lock has been dropped.

Acked-by: J. Bruce Fields <bfields@fieldses.org>
Signed-off-by: Jeff Layton <jlayton@primarydata.com>
fs/locks.c