Re: [PATCH] block: Avoid executing a report or reset zones while a queue is frozen

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

 



On Tue, 2018-04-17 at 17:18 +0200, Christoph Hellwig wrote:
> On Mon, Apr 16, 2018 at 06:00:34PM -0700, Bart Van Assche wrote:
> > This patch on itself does not change the behavior of either ioctl.
> > However, this patch is necessary to avoid that these ioctls fail
> > with -EIO if sd_revalidate_disk() is called while these ioctls are
> > in progress because the current zoned block command code temporarily
> > clears data that is needed by these ioctls. See also commit
> > 3ed05a987e0f ("blk-zoned: implement ioctls").
> 
> Hmm.  I think we need to avoid clearing that data and update it using
> RCU instead.  Calling blk_queue_enter before submitting bios is
> something that would make zone reporting very different from any
> other block layer user.

Hello Christoph,

As you know some struct members that contain zoned block device information
are in struct request queue and others are in struct scsi_disk:

struct scsi_disk {
	[ ... ]
#ifdef CONFIG_BLK_DEV_ZONED
	u32		nr_zones;
	u32		zone_blocks;
	u32		zone_shift;
	u32		zones_optimal_open;
	u32		zones_optimal_nonseq;
	u32		zones_max_open;
#endif
	[ ... ]
};

struct request_queue {
	[ ... ]
	unsigned int		nr_zones;
	unsigned long		*seq_zones_bitmap;
	unsigned long		*seq_zones_wlock;
	[ ... ]
};

Did you perhaps mean to move these members into two new structures, to use
RCU to update the pointers to these structures and also to protect code that
reads these pointers with rcu_read_lock() / rcu_read_unlock()? If so, how to
make sure that both pointers get updated simultaneously such that no code
ever sees a pointer to the old information in e.g. struct scsi_disk and a
pointer to the new information in struct request_queue?

Thanks,

Bart.






[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]