summaryrefslogtreecommitdiff
path: root/libnetfs/release-peropen.c
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2014-01-26 23:14:35 +0100
committerRichard Braun <rbraun@sceen.net>2014-01-26 23:14:35 +0100
commitb8c728ec51696c5d17ef09a00b3b193b70a487da (patch)
tree5585ad01051d340e8c0655968327c9fa20a93271 /libnetfs/release-peropen.c
parent7cb7fa6b3a0d02985b4a51f7823bc1cb631d6bfa (diff)
libnetfs: fix file locking on peropen release
* libnetfs/release-peropen.c (netfs_release_peropen): Release the lock on the underlying node if the peropen status indicates it's not unlocked.
Diffstat (limited to 'libnetfs/release-peropen.c')
-rw-r--r--libnetfs/release-peropen.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libnetfs/release-peropen.c b/libnetfs/release-peropen.c
index d4d3574c..c206b438 100644
--- a/libnetfs/release-peropen.c
+++ b/libnetfs/release-peropen.c
@@ -18,6 +18,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
+#include <sys/file.h>
#include "netfs.h"
void
@@ -39,6 +40,10 @@ netfs_release_peropen (struct peropen *po)
if (po->shadow_root_parent)
mach_port_deallocate (mach_task_self (), po->shadow_root_parent);
+ if (po->lock_status != LOCK_UN)
+ fshelp_acquire_lock (&po->np->userlock, &po->lock_status,
+ &po->np->lock, LOCK_UN);
+
netfs_nput (po->np);
free (po->path);