From: Anoop C S Date: Fri, 3 Aug 2018 06:21:25 +0000 (+0530) Subject: s3/locking: Corrections and improvements to inline comments X-Git-Tag: ldb-1.5.0~39 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bf9cb64d513d2cdbda558a4cbc65d21fd0c9abbb;p=thirdparty%2Fsamba.git s3/locking: Corrections and improvements to inline comments Signed-off-by: Anoop C S Reviewed-by: Jeremy Allison Reviewed-by: Jim McDonough --- diff --git a/source3/locking/posix.c b/source3/locking/posix.c index 13992663280..79c33cfb0fa 100644 --- a/source3/locking/posix.c +++ b/source3/locking/posix.c @@ -410,20 +410,12 @@ bool posix_locking_end(void) } /**************************************************************************** - Next - the functions that deal with storing fd's that have outstanding - POSIX locks when closed. -****************************************************************************/ - -/**************************************************************************** - The records in posix_pending_close_db are composed of an array of - ints keyed by dev/ino pair. Those ints are the fd's that were open on - this dev/ino pair that should have been closed, but can't as the lock - ref count is non zero. + Next - the functions that deal with reference count of number of locks open + on a dev/ino pair. ****************************************************************************/ /**************************************************************************** - Keep a reference count of the number of locks open on this dev/ino - pair. Creates entry if it doesn't exist. + Increase the lock ref count. Creates lock_ref_count entry if it doesn't exist. ****************************************************************************/ static void increment_lock_ref_count(const files_struct *fsp) @@ -443,6 +435,10 @@ static void increment_lock_ref_count(const files_struct *fsp) fsp_str_dbg(fsp), (int)lock_ref_count)); } +/**************************************************************************** + Reduce the lock ref count. +****************************************************************************/ + static void decrement_lock_ref_count(const files_struct *fsp) { struct lock_ref_count_key tmp; @@ -500,6 +496,18 @@ static void delete_lock_ref_count(const files_struct *fsp) fsp_str_dbg(fsp))); } +/**************************************************************************** + Next - the functions that deal with storing fd's that have outstanding + POSIX locks when closed. +****************************************************************************/ + +/**************************************************************************** + The records in posix_pending_close_db are composed of an array of + ints keyed by dev/ino pair. Those ints are the fd's that were open on + this dev/ino pair that should have been closed, but can't as the lock + ref count is non zero. +****************************************************************************/ + /**************************************************************************** Add an fd to the pending close tdb. ****************************************************************************/ @@ -618,8 +626,9 @@ int fd_close_posix(const struct files_struct *fsp) /* * There are outstanding locks on this dev/inode pair on - * other fds. Add our fd to the pending close tdb and set - * fsp->fh->fd to -1. + * other fds. Add our fd to the pending close db. We also + * set fsp->fh->fd to -1 inside fd_close() after returning + * from VFS layer. */ add_fd_to_close_entry(fsp);