Re: [PATCH] xfs: Correctly invert xfs_buftarg LRU isolation logic

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

 



On Wed, Feb 28, 2018 at 04:49:51PM +0100, Vratislav Bendel wrote:
> The function xfs_buftarg_isolate() used by xfs buffer schrinkers 
> to determine whether a buffer should be isolated and disposed 
> from LRU list, has inverted logic.
> 
> Excerpt from xfs_buftarg_isolate():
>         /*
>          * Decrement the b_lru_ref count unless the value is already
>          * zero. If the value is already zero, we need to reclaim the
>          * buffer, otherwise it gets another trip through the LRU.
>          */
>         if (!atomic_add_unless(&bp->b_lru_ref, -1, 0)) {
>                 spin_unlock(&bp->b_lock);
>                 return LRU_ROTATE;
>         }
> 
> However, as per documentation, atomic_add_unless() returns _zero_
> if the atomic value was originally equal to the specified *unsless* value.
> 
> Ultimately causing a xfs_buffer with ->b_lru_ref == 0, to take another 
> trip around LRU, while isolating buffers with non-zero b_lru_ref.
> 
> Signed-off-by: Vratislav Bendel <vbendel@xxxxxxxxxx>
> CC: Brian Foster <bfoster@xxxxxxxxxx>

Can you add a respective Fixes: tag?  Also what effects are observed by
the user when this happens on the kernel log?

 Luis
--
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