OpenVZ Forum


Home » Mailing lists » Devel » [PATCH] Memory shortage can result in inconsistent flocks state
Re: [PATCH] Memory shortage can result in inconsistent flocks state [message #20242 is a reply to message #20043] Thu, 13 September 2007 19:45 Go to previous messageGo to previous message
Chuck Ebbert is currently offline  Chuck Ebbert
Messages: 4
Registered: July 2007
Junior Member
On 09/13/2007 03:34 PM, J. Bruce Fields wrote:
>> Doesn't that create a leak in some cases?
>>
>>>         for_each_lock(inode, before) {
>>>                 struct file_lock *fl = *before;
>>>                 if (IS_POSIX(fl))
>>>                         break;
>>>                 if (IS_LEASE(fl))
>>>                         continue;
>>>                 if (filp != fl->fl_file)
>>>                         continue;
>>>                 if (request->fl_type == fl->fl_type)
>>>                         goto out;  <<<<<<<<<<<<<<<< LEAK?
> 
> You mean, a leak of the memory allocated for new_fl?  That's freed at
> the exit labeled with "out".  It's the only exit:
> 
> 	out:
> 	        unlock_kernel();
> 		if (new_fl)
> 			locks_free_lock(new_fl);
> 		return error;
> 
> And new_fl is initially NULL, assigned only once by the allocation, then
> assigned to NULL only at the very end when we know we've succeeded.
> 
> Am I missing something else?
> 

Never mind, I didn't look closely enough. Looks good to me.
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: [PATCH] net: Fix race when opening a proc file while a network namespace is exiting.
Next Topic: [PATCH] shrink_dcache_sb speedup
Goto Forum:
  


Current Time: Mon Aug 25 06:49:44 GMT 2025

Total time taken to generate the page: 0.06125 seconds