[PATCH] Changes to inline comments in posix locking
Jim McDonough
jmcd at samba.org
Wed Aug 8 19:38:55 UTC 2018
On 08/06/2018 03:47 PM, Jeremy Allison via samba-technical wrote:
> On Fri, Aug 03, 2018 at 12:11:20PM +0530, Anoop C S via samba-technical wrote:
>> Hi,
>>
>> Attached patch attempts to make the intention clear inside source3/locking/posix.c by replacing and
>> modifying some inline comments around management of entries inside in-memory posix_pending_close_db
>> database.
>>
>> Reviews are appreciated.
>
> Reviewed-by: Jeremy Allison <jra at samba.org>
>
> Can I get a second Team reviewer ?
RB+
>
> Thanks,
>
> Jeremy.
>
>> From 09eb282d798963591d03cc989eb0eb32ffb26a0c Mon Sep 17 00:00:00 2001
>> From: Anoop C S <anoopcs at redhat.com>
>> Date: Fri, 3 Aug 2018 11:51:25 +0530
>> Subject: [PATCH] s3/locking: Corrections and improvements to inline comments
>>
>> Signed-off-by: Anoop C S <anoopcs at redhat.com>
>> ---
>> source3/locking/posix.c | 35 ++++++++++++++++++++++-------------
>> 1 file changed, 22 insertions(+), 13 deletions(-)
>>
>> 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);
>> --
>> 2.17.1
>>
>
>
More information about the samba-technical
mailing list