Re: [PATCH v3] xfs: do not call xfs_buf_hash_destroy on a NULL pag

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 1/26/17 12:55 PM, Bill O'Donnell wrote:
>>> @@ -242,8 +245,11 @@ xfs_initialize_perag(
>>>  out_unwind:
>>>  	xfs_buf_hash_destroy(pag);
>>>  	kmem_free(pag);
>>> -	for (; index > first_initialised; index--) {
>>> -		pag = radix_tree_delete(&mp->m_perag_tree, index);
>>> +out_unwind_pags:
>>> +	for (i = index; i >= first_initialised; i--) {
>>> +		pag = radix_tree_delete(&mp->m_perag_tree, (xfs_agnumber_t)i);
>> (don't make i an int if it's really supposed to be an xfs_agnumber_t,
>> which is unsigned)
> It might be wrong, but I used an int in order to handle the case where
> first_initialized==0, and a decrement of an unsigned would roll over
> instead of going negative (so i >= first_initialized would be true again).

Oh, urgh.  I see.

OTOH AG count is unsigned, so if you have index > 2147483648 AGs,
your "i >= first" will fail because i will be negative in /that/
comparison.

Ok, how about something like:

out_unwind_pags:
	/* start unwinding at previous index */
	index--;
        do {
                /* uninitialize pag at this index */
		index--;
        } while (index && index >= first_initialised);

-Eric

--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux