[dm-devel] [PATCH RESEND 1/2 block#for-linus] bio, fs: update READA and SWRITE to match the corresponding BIO_RW_* bits

Neil Brown neilb at suse.de
Mon Aug 2 21:52:10 UTC 2010


On Mon, 02 Aug 2010 16:15:38 +0200
Tejun Heo <tj at kernel.org> wrote:

> Commit a82afdf (block: use the same failfast bits for bio and request)
> moved BIO_RW_* bits around such that they match up with REQ_* bits.
> Unfortunately, fs.h hard coded READ, WRITE, READA and SWRITE as 0, 1,
> 2 and 3, and expected them to match with BIO_RW_* bits.  READ/WRITE
> didn't change but BIO_RW_AHEAD was moved to bit 4 instead of bit 1,
> breaking READA and SWRITE.
> 
> This patch updates READA and SWRITE such that they match the BIO_RW_*
> bits again.  A follow up patch will update the definitions to directly
> use BIO_RW_* bits so that this kind of breakage won't happen again.
> 
> Stable: The offending commit a82afdf was released with v2.6.32, so
> this patch should be applied to all kernels since then but it must
> _NOT_ be applied to kernels earlier than that.
> 
> Signed-off-by: Tejun Heo <tj at kernel.org>
> Reported-and-bisected-by: Vladislav Bolkhovitin <vst at vlnb.net>
> Root-caused-by: Neil Brown <neilb at suse.de>
> Cc: Jens Axobe <axboe at kernel.dk>
> Cc: stable at kernel.org
> ---
> Aieee... thanks for root causing it Neil.  That was a stupid bug.  I
> knew that READ/WRITE were hardcoded but forgot about READA.  :-(
> Moving BIO_RW_AHEAD back to bit 1 might be a better solution but I'm
> afraid that would cause more confusions downstream.  This patch
> updates READA and SWRITE to match BIO_RW_AHEAD and should also appear
> in -stable releases.  The next patch will create bio_types.h and
> define all constants in terms of BIO_RW_*.
> 
> Thanks.
> 
> (resending w/ Jens' new address)
> 
>  include/linux/fs.h |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> Index: work/include/linux/fs.h
> ===================================================================
> --- work.orig/include/linux/fs.h
> +++ work/include/linux/fs.h
> @@ -148,8 +148,8 @@ struct inodes_stat_t {
>  #define RWA_MASK	2

Close, but not quite there - RWA_MASK must be 16 too !!

Thanks,
NeilBrown


>  #define READ 0
>  #define WRITE 1
> -#define READA 2		/* read-ahead  - don't block if no resources */
> -#define SWRITE 3	/* for ll_rw_block() - wait for buffer lock */
> +#define READA 16	/* read-ahead  - don't block if no resources */
> +#define SWRITE 17	/* for ll_rw_block() - wait for buffer lock */
>  #define READ_SYNC	(READ | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG))
>  #define READ_META	(READ | (1 << BIO_RW_META))
>  #define WRITE_SYNC_PLUG	(WRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_NOIDLE))




More information about the dm-devel mailing list