]> git.michaelhowe.org Git - packages/o/openafs.git/commit
afs: Avoid memory leak on recursive write flock
authorAndrew Deason <adeason@sinenomine.net>
Fri, 1 Apr 2011 21:43:24 +0000 (16:43 -0500)
committerDerrick Brashear <shadow@dementix.org>
Wed, 2 Nov 2011 02:43:56 +0000 (19:43 -0700)
commit741bea05a3a5d170d47ca9df590f84ab02a7baad
tree460143ae78c26525cef9b1cae595dccdbe856356
parent09159b5cc353fa901d130ed5353043579cb4cb1b
afs: Avoid memory leak on recursive write flock

When a process requests an exclusive lock on a file on which it
already holds an exclusive lock, we basically form a no-op. However,
HandleFlock was allocating a new SimpleLocks and attaching it to
avc->slocks, without freeing the old SimpleLocks structure.

Since we don't need to do anything if we already hold an exclusive
lock, just break out of the loop right away when we detect that
scenario. Thus we avoid adding a new structure to avc->slocks, and we
avoid a memory leak.

Reviewed-on: http://gerrit.openafs.org/4395
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit ba9ae1ed7c269d7c080b5ce99b3b4bb2fe0a2a6f)

Change-Id: I9e45a51e02774c555c6d5cb5ba9d0407b8442215
Reviewed-on: http://gerrit.openafs.org/5765
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
src/afs/VNOPS/afs_vnop_flock.c