[PATCH 4/6] libxfs: reused invalidated buffers leak state and data

Christoph Hellwig hch at infradead.org
Fri Jul 4 09:15:09 CDT 2014


On Fri, Jul 04, 2014 at 03:57:13PM +1000, Dave Chinner wrote:
> @@ -632,6 +632,12 @@ libxfs_putbuf(xfs_buf_t *bp)
>  			pthread_mutex_unlock(&bp->b_lock);
>  		}
>  	}
> +	/*
> +	 * ensure that any errors on this use of the buffer don't carry
> +	 * over to the next user.
> +	 */
> +	bp->b_error = 0;
> +
>  	cache_node_put(libxfs_bcache, (struct cache_node *)bp);

This seems a bit fishy to me.  For one I'm pretty sure it needs to be
done before unlocking b_lock, second it's different behavior from the
kernel where we explicitly clear it in the caller for the rare case
we want to reuse a buffer that had an error (xfs_buf_iodone_callbacks
seems to be the only one).  Any reason to do this differently in
userspace?



More information about the xfs mailing list