Skip to contentSkip to conversation

block bits for 2.6.29-rc5

GIT PULL Jens Axboe 4 participants 12 messages Feb 18, 2009 – Feb 24, 2009

Subsystems (9)
lore
Share & tools
lore

Jens Axboe

author
#0 lore raw

Hi Linus,

One trivial patch, otherwise it's all bug fixes or regressions. Please pull.

git://git.kernel.dk/linux-2.6-block.git for-linus

Boaz Harrosh (1):
bsg: Fix sense buffer bug in SG_IO

Chip Coldwell (1):
cciss: PCI power management reset for kexec

Hannes Reinecke (1):
block: fix deadlock in blk_abort_queue() for drivers that readd to timeout list

Jens Axboe (2):
block: fix bad definition of BIO_RW_SYNC
block: revert part of 18ce3751ccd488c78d3827e9f6bf54e6322676fb

Neil Brown (1):
block: fix booting from partitioned md array

Roel Kluin (1):

      paride/pg.c: xs(): &&/|| confusion

Subhash Peddamallu (1):
fs/bio: bio_alloc_bioset: pass right object ptr to mempool_free

 block/blk-timeout.c          |    9 ++-
 block/blktrace.c             |    2 +-
 block/bsg.c                  |   17 ++--
 block/genhd.c                |    8 ++
 drivers/block/cciss.c        |  215 ++++++++++++++++++++++++++++++++++++++++++
 drivers/block/paride/pg.c    |    2 +-
 drivers/md/dm-io.c           |    2 +-
 drivers/md/dm-kcopyd.c       |    2 +-
 drivers/md/md.c              |    4 +-
 fs/bio.c                     |    5 +-
 fs/buffer.c                  |    2 +-
 include/linux/bio.h          |    2 -
 include/linux/blktrace_api.h |    1 +
 include/linux/fs.h           |    6 +-
 kernel/power/swap.c          |    5 +-
 mm/page_io.c                 |    2 +-
 16 files changed, 259 insertions(+), 25 deletions(-)
block/blk-timeout.c +8 -1
index a095353..bbbdc4b 100644
@@ -209,12 +209,19 @@ void blk_abort_queue(struct request_queue *q)
 {
 	unsigned long flags;
 	struct request *rq, *tmp;
+	LIST_HEAD(list);
 
 	spin_lock_irqsave(q->queue_lock, flags);
 
 	elv_abort_queue(q);
 
-	list_for_each_entry_safe(rq, tmp, &q->timeout_list, timeout_list)
+	/*
+	 * Splice entries to local list, to avoid deadlocking if entries
+	 * get readded to the timeout list by error handling
+	 */
+	list_splice_init(&q->timeout_list, &list);
+
+	list_for_each_entry_safe(rq, tmp, &list, timeout_list)
 		blk_abort_request(rq);
 
 	spin_unlock_irqrestore(q->queue_lock, flags);
block/blktrace.c +1 -1
index 39cc3bf..7cf9d1f 100644
@@ -142,7 +142,7 @@ static void __blk_add_trace(struct blk_trace *bt, sector_t sector, int bytes,
 
 	what |= ddir_act[rw & WRITE];
 	what |= MASK_TC_BIT(rw, BARRIER);
-	what |= MASK_TC_BIT(rw, SYNC);
+	what |= MASK_TC_BIT(rw, SYNCIO);
 	what |= MASK_TC_BIT(rw, AHEAD);
 	what |= MASK_TC_BIT(rw, META);
 	what |= MASK_TC_BIT(rw, DISCARD);
block/bsg.c +10 -7
index d414bb5..0ce8806 100644
@@ -244,7 +244,8 @@ bsg_validate_sgv4_hdr(struct request_queue *q, struct sg_io_v4 *hdr, int *rw)
  * map sg_io_v4 to a request.
  */
 static struct request *
-bsg_map_hdr(struct bsg_device *bd, struct sg_io_v4 *hdr, fmode_t has_write_perm)
+bsg_map_hdr(struct bsg_device *bd, struct sg_io_v4 *hdr, fmode_t has_write_perm,
+	    u8 *sense)
 {
 	struct request_queue *q = bd->queue;
 	struct request *rq, *next_rq = NULL;
@@ -306,6 +307,10 @@ bsg_map_hdr(struct bsg_device *bd, struct sg_io_v4 *hdr, fmode_t has_write_perm)
 		if (ret)
 			goto out;
 	}
+
+	rq->sense = sense;
+	rq->sense_len = 0;
+
 	return rq;
 out:
 	if (rq->cmd != rq->__cmd)
@@ -348,9 +353,6 @@ static void bsg_rq_end_io(struct request *rq, int uptodate)
 static void bsg_add_command(struct bsg_device *bd, struct request_queue *q,
 			    struct bsg_command *bc, struct request *rq)
 {
-	rq->sense = bc->sense;
-	rq->sense_len = 0;
-
 	/*
 	 * add bc command to busy queue and submit rq for io
 	 */
@@ -419,7 +421,7 @@ static int blk_complete_sgv4_hdr_rq(struct request *rq, struct sg_io_v4 *hdr,
 {
 	int ret = 0;
 
-	dprintk("rq %p bio %p %u\n", rq, bio, rq->errors);
+	dprintk("rq %p bio %p 0x%x\n", rq, bio, rq->errors);
 	/*
 	 * fill in all the output members
 	 */
@@ -635,7 +637,7 @@ static int __bsg_write(struct bsg_device *bd, const char __user *buf,
 		/*
 		 * get a request, fill in the blanks, and add to request queue
 		 */
-		rq = bsg_map_hdr(bd, &bc->hdr, has_write_perm);
+		rq = bsg_map_hdr(bd, &bc->hdr, has_write_perm, bc->sense);
 		if (IS_ERR(rq)) {
 			ret = PTR_ERR(rq);
 			rq = NULL;
@@ -922,11 +924,12 @@ static long bsg_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 		struct request *rq;
 		struct bio *bio, *bidi_bio = NULL;
 		struct sg_io_v4 hdr;
+		u8 sense[SCSI_SENSE_BUFFERSIZE];
 
 		if (copy_from_user(&hdr, uarg, sizeof(hdr)))
 			return -EFAULT;
 
-		rq = bsg_map_hdr(bd, &hdr, file->f_mode & FMODE_WRITE);
+		rq = bsg_map_hdr(bd, &hdr, file->f_mode & FMODE_WRITE, sense);
 		if (IS_ERR(rq))
 			return PTR_ERR(rq);
 
block/genhd.c +8 -0
index 397960c..e1eadcc 100644
@@ -1087,6 +1087,14 @@ dev_t blk_lookup_devt(const char *name, int partno)
 		if (strcmp(dev_name(dev), name))
 			continue;
 
+		if (partno < disk->minors) {
+			/* We need to return the right devno, even
+			 * if the partition doesn't exist yet.
+			 */
+			devt = MKDEV(MAJOR(dev->devt),
+				     MINOR(dev->devt) + partno);
+			break;
+		}
 		part = disk_get_part(disk, partno);
 		if (part) {
 			devt = part_devt(part);
drivers/block/cciss.c +215 -0

227 lines not on this page · raw message

drivers/block/paride/pg.c +1 -1
index 9dfa271..c397b3d 100644
@@ -422,7 +422,7 @@ static void xs(char *buf, char *targ, int len)
 
 	for (k = 0; k < len; k++) {
 		char c = *buf++;
-		if (c != ' ' || c != l)
+		if (c != ' ' && c != l)
 			l = *targ++ = c;
 	}
 	if (l == ' ')
drivers/md/dm-io.c +1 -1
index a343385..f14813b 100644
@@ -328,7 +328,7 @@ static void dispatch_io(int rw, unsigned int num_regions,
 	struct dpages old_pages = *dp;
 
 	if (sync)
-		rw |= (1 << BIO_RW_SYNC);
+		rw |= (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG);
 
 	/*
 	 * For multiple regions we need to be careful to rewind
drivers/md/dm-kcopyd.c +1 -1
index 3073618..0a225da 100644
@@ -344,7 +344,7 @@ static int run_io_job(struct kcopyd_job *job)
 {
 	int r;
 	struct dm_io_request io_req = {
-		.bi_rw = job->rw | (1 << BIO_RW_SYNC),
+		.bi_rw = job->rw | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG),
 		.mem.type = DM_IO_PAGE_LIST,
 		.mem.ptr.pl = job->pages,
 		.mem.offset = job->offset,
drivers/md/md.c +2 -2
index 4495104..03b4cd0 100644
@@ -474,7 +474,7 @@ void md_super_write(mddev_t *mddev, mdk_rdev_t *rdev,
 	 * causes ENOTSUPP, we allocate a spare bio...
 	 */
 	struct bio *bio = bio_alloc(GFP_NOIO, 1);
-	int rw = (1<<BIO_RW) | (1<<BIO_RW_SYNC);
+	int rw = (1<<BIO_RW) | (1<<BIO_RW_SYNCIO) | (1<<BIO_RW_UNPLUG);
 
 	bio->bi_bdev = rdev->bdev;
 	bio->bi_sector = sector;
@@ -531,7 +531,7 @@ int sync_page_io(struct block_device *bdev, sector_t sector, int size,
 	struct completion event;
 	int ret;
 
-	rw |= (1 << BIO_RW_SYNC);
+	rw |= (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG);
 
 	bio->bi_bdev = bdev;
 	bio->bi_sector = sector;
fs/bio.c +3 -2
index 062299a..72ab251 100644
@@ -302,9 +302,10 @@ void bio_init(struct bio *bio)
 struct bio *bio_alloc_bioset(gfp_t gfp_mask, int nr_iovecs, struct bio_set *bs)
 {
 	struct bio *bio = NULL;
+	void *p;
 
 	if (bs) {
-		void *p = mempool_alloc(bs->bio_pool, gfp_mask);
+		p = mempool_alloc(bs->bio_pool, gfp_mask);
 
 		if (p)
 			bio = p + bs->front_pad;
@@ -329,7 +330,7 @@ struct bio *bio_alloc_bioset(gfp_t gfp_mask, int nr_iovecs, struct bio_set *bs)
 			}
 			if (unlikely(!bvl)) {
 				if (bs)
-					mempool_free(bio, bs->bio_pool);
+					mempool_free(p, bs->bio_pool);
 				else
 					kfree(bio);
 				bio = NULL;
fs/buffer.c +1 -1
index 665d446..62b57e3 100644
@@ -3108,7 +3108,7 @@ int sync_dirty_buffer(struct buffer_head *bh)
 	if (test_clear_buffer_dirty(bh)) {
 		get_bh(bh);
 		bh->b_end_io = end_buffer_write_sync;
-		ret = submit_bh(WRITE_SYNC, bh);
+		ret = submit_bh(WRITE, bh);
 		wait_on_buffer(bh);
 		if (buffer_eopnotsupp(bh)) {
 			clear_buffer_eopnotsupp(bh);
include/linux/bio.h +0 -2
index 2aa283a..1b16108 100644
@@ -171,8 +171,6 @@ struct bio {
 #define BIO_RW_FAILFAST_TRANSPORT	8
 #define BIO_RW_FAILFAST_DRIVER		9
 
-#define BIO_RW_SYNC	(BIO_RW_SYNCIO | BIO_RW_UNPLUG)
-
 #define bio_rw_flagged(bio, flag)	((bio)->bi_rw & (1 << (flag)))
 
 /*
include/linux/blktrace_api.h +1 -0
index 25379cb..6e91587 100644
@@ -15,6 +15,7 @@ enum blktrace_cat {
 	BLK_TC_WRITE	= 1 << 1,	/* writes */
 	BLK_TC_BARRIER	= 1 << 2,	/* barrier */
 	BLK_TC_SYNC	= 1 << 3,	/* sync IO */
+	BLK_TC_SYNCIO	= BLK_TC_SYNC,
 	BLK_TC_QUEUE	= 1 << 4,	/* queueing/merging */
 	BLK_TC_REQUEUE	= 1 << 5,	/* requeueing */
 	BLK_TC_ISSUE	= 1 << 6,	/* issue */
include/linux/fs.h +3 -3
index 6022f44..67857dc 100644
@@ -87,10 +87,10 @@ struct inodes_stat_t {
 #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 READ_SYNC	(READ | (1 << BIO_RW_SYNC))
+#define READ_SYNC	(READ | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG))
 #define READ_META	(READ | (1 << BIO_RW_META))
-#define WRITE_SYNC	(WRITE | (1 << BIO_RW_SYNC))
-#define SWRITE_SYNC	(SWRITE | (1 << BIO_RW_SYNC))
+#define WRITE_SYNC	(WRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG))
+#define SWRITE_SYNC	(SWRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG))
 #define WRITE_BARRIER	(WRITE | (1 << BIO_RW_BARRIER))
 #define DISCARD_NOBARRIER (1 << BIO_RW_DISCARD)
 #define DISCARD_BARRIER ((1 << BIO_RW_DISCARD) | (1 << BIO_RW_BARRIER))
kernel/power/swap.c +3 -2
index 6da1435..505f319 100644
@@ -60,6 +60,7 @@ static struct block_device *resume_bdev;
 static int submit(int rw, pgoff_t page_off, struct page *page,
 			struct bio **bio_chain)
 {
+	const int bio_rw = rw | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG);
 	struct bio *bio;
 
 	bio = bio_alloc(__GFP_WAIT | __GFP_HIGH, 1);
@@ -80,7 +81,7 @@ static int submit(int rw, pgoff_t page_off, struct page *page,
 	bio_get(bio);
 
 	if (bio_chain == NULL) {
-		submit_bio(rw | (1 << BIO_RW_SYNC), bio);
+		submit_bio(bio_rw, bio);
 		wait_on_page_locked(page);
 		if (rw == READ)
 			bio_set_pages_dirty(bio);
@@ -90,7 +91,7 @@ static int submit(int rw, pgoff_t page_off, struct page *page,
 			get_page(page);	/* These pages are freed later */
 		bio->bi_private = *bio_chain;
 		*bio_chain = bio;
-		submit_bio(rw | (1 << BIO_RW_SYNC), bio);
+		submit_bio(bio_rw, bio);
 	}
 	return 0;
 }
mm/page_io.c +1 -1
index dc6ce0a..3023c47 100644
@@ -111,7 +111,7 @@ int swap_writepage(struct page *page, struct writeback_control *wbc)
 		goto out;
 	}
 	if (wbc->sync_mode == WB_SYNC_ALL)
-		rw |= (1 << BIO_RW_SYNC);
+		rw |= (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG);
 	count_vm_event(PSWPOUT);
 	set_page_writeback(page);
 	unlock_page(page);
Signature · 1 line
Jens Axboe
#1 lore raw
Quoted 4 lines · Jens Axboe

Hi Linus,

One trivial patch, otherwise it's all bug fixes or regressions. Please pull.

Any chance you could look into the barrier fail warning spew regression introduced early in the 2.6.29 circle?

author
#2 lore raw
Quoted 8 lines · Christoph Hellwig
Quoted 4 lines · Jens Axboe

Hi Linus,

One trivial patch, otherwise it's all bug fixes or regressions. Please pull.

Any chance you could look into the barrier fail warning spew regression introduced early in the 2.6.29 circle?

Yep, will get fixed in the next round. There were just a few important fixes queued up that I wanted in -rc6.

Signature · 1 line
Jens Axboe
maintainer
#5 lore raw
In reply to Jens Axboe

drivers/block/cciss.c static int __devinit cciss_init_one(struct pci_dev *pdev, · line 3611

Quoted 12 lines · On Wed, 18 Feb 2009 15:41:06 +0100 Jens Axboe <[email protected]> wrote:
drivers/block/cciss.c +8 -0
@@ -3404,6 +3601,24 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
 	int dac, return_code;
 	InquiryData_struct *inq_buff = NULL;
 
+	if (reset_devices) {
+		/* Reset the controller with a PCI power-cycle */
+		if (cciss_hard_reset_controller(pdev) || cciss_reset_msi(pdev))
+			return -ENODEV;
+
+		/* Some devices (notably the HP Smart Array 5i Controller)
+		   need a little pause here */
+		schedule_timeout_uninterruptible(30*HZ);

little!

Perhaps we should do a printk("no, your machine is not dead") here.

author
#3 lore raw
In reply to Jens Axboe
Quoted 4 lines · Jens Axboe
Quoted 3 lines · Christoph Hellwig
Quoted 2 lines · Jens Axboe

Hi Linus,

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

One trivial patch, otherwise it's all bug fixes or regressions. Please pull.

Any chance you could look into the barrier fail warning spew regression introduced early in the 2.6.29 circle?

Yep, will get fixed in the next round. There were just a few important fixes queued up that I wanted in -rc6.

It seems to work fine for me, tested with a modified sd that doesn't have barrier support and loop:

Filesystem "sdc1": Disabling barriers, trial barrier write failed XFS mounting filesystem sdc1

and

Filesystem "loop0": Disabling barriers, trial barrier write failed XFS mounting filesystem loop0

No extra failure warnings on the barrier IO itself. What device do you see this on?

Signature · 1 line
Jens Axboe
author
#6 lore raw
In reply to Andrew Morton
Quoted 7 lines · Andrew Morton
Quoted 4 lines · On Wed, 18 Feb 2009 15:41:06 +0100 Jens Axboe <[email protected]> wrote:
drivers/block/cciss.c +0 -0
@@ -3404,6 +3601,24 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
 	int dac, return_code;
 	InquiryData_struct *inq_buff = NULL;
 
Quoted 10 lines

drivers/block/cciss.c static int __devinit cciss_init_one(struct pci_dev *pdev, · line 3611

Quoted 8 lines
drivers/block/cciss.c +8 -0
+	if (reset_devices) {
+		/* Reset the controller with a PCI power-cycle */
+		if (cciss_hard_reset_controller(pdev) || cciss_reset_msi(pdev))
+			return -ENODEV;
+
+		/* Some devices (notably the HP Smart Array 5i Controller)
+		   need a little pause here */
+		schedule_timeout_uninterruptible(30*HZ);

little!

That does qualify as the understatement of the day :-)

Quoted 1 line

Perhaps we should do a printk("no, your machine is not dead") here.

Perhaps we should shrink it to something a little more tolerable and put it in the noop loop instead. 30 seconds is insane...

Signature · 1 line
Jens Axboe
#7 lore raw
Quoted 32 lines

-----Original Message-----
From: Jens Axboe [mailto:[email protected]]
Sent: Friday, February 20, 2009 10:41 AM
To: Andrew Morton
Cc: [email protected]; [email protected]; Miller, Mike (OS Dev)
Subject: Re: [GIT PULL] block bits for 2.6.29-rc5

Quoted 4 lines · Andrew Morton

Review static int __devinit

Quoted 1 line · On Wed, 18 Feb 2009 15:41:06 +0100 Jens Axboe <[email protected]> wrote:
(quoted diff) +0 -0
@@ -3404,6 +3601,24 @@ static int __devinit 

cciss_init_one(struct pci_dev *pdev,

Quoted 6 lines

drivers/block/cciss.c static int __devinit cciss_init_one(struct pci_dev *pdev,

Quoted 6 lines
drivers/block/cciss.c +3 -0
 	int dac, return_code;
 	InquiryData_struct *inq_buff = NULL;
 
+	if (reset_devices) {
+		/* Reset the controller with a PCI power-cycle */
+		if (cciss_hard_reset_controller(pdev) || 

cciss_reset_msi(pdev))

Quoted 3 lines

drivers/block/cciss.c static void free_hba(int i)

Quoted 3 lines
drivers/block/cciss.c +3 -0
+			return -ENODEV;
+
+		/* Some devices (notably the HP Smart Array 5i 

Controller)

Quoted 4 lines

drivers/block/cciss.c static int __devinit cciss_init_one(struct pci_dev *pdev, · line 3611

Quoted 2 lines
drivers/block/cciss.c +2 -0
+		   need a little pause here */
+		schedule_timeout_uninterruptible(30*HZ);

little!

Quoted 6 lines

That does qualify as the understatement of the day :-)

Quoted 1 line

Perhaps we should do a printk("no, your machine is not dead") here.

Perhaps we should shrink it to something a little more tolerable and put it in the noop loop instead. 30 seconds is insane...

Some of these controllers do take a long time to recover from the reset because the firmware has to re-initialize. The firmware guys claim that's only a few seconds but that's not true.

Granted, the 5i is old as dirt. Don't know how many are still out there running newer kernels.

-- mikem

author
#8 lore raw
Quoted 39 lines · Mike (OS Dev)
Quoted 32 lines

-----Original Message-----
From: Jens Axboe [mailto:[email protected]]
Sent: Friday, February 20, 2009 10:41 AM
To: Andrew Morton
Cc: [email protected]; [email protected]; Miller, Mike (OS Dev)
Subject: Re: [GIT PULL] block bits for 2.6.29-rc5

Quoted 4 lines · Andrew Morton

Review static int __devinit

Quoted 1 line · On Wed, 18 Feb 2009 15:41:06 +0100 Jens Axboe <[email protected]> wrote:
(quoted diff) +0 -0
@@ -3404,6 +3601,24 @@ static int __devinit 

cciss_init_one(struct pci_dev *pdev,

Quoted 6 lines

Review static int __devinit · line 3606

Quoted 6 lines
(quoted diff) +3 -0
 	int dac, return_code;
 	InquiryData_struct *inq_buff = NULL;
 
+	if (reset_devices) {
+		/* Reset the controller with a PCI power-cycle */
+		if (cciss_hard_reset_controller(pdev) || 

cciss_reset_msi(pdev))

Quoted 3 lines

Review static int __devinit · line 3609

Quoted 3 lines
(quoted diff) +3 -0
+			return -ENODEV;
+
+		/* Some devices (notably the HP Smart Array 5i 

Controller)

Quoted 4 lines

Review static int __devinit · line 3611

Quoted 2 lines
(quoted diff) +2 -0
+		   need a little pause here */
+		schedule_timeout_uninterruptible(30*HZ);

little!

Quoted 6 lines

That does qualify as the understatement of the day :-)

Quoted 1 line

Perhaps we should do a printk("no, your machine is not dead") here.

Perhaps we should shrink it to something a little more tolerable and put it in the noop loop instead. 30 seconds is insane...

Quoted 6 lines

Some of these controllers do take a long time to recover from the reset because the firmware has to re-initialize. The firmware guys claim that's only a few seconds but that's not true.

Granted, the 5i is old as dirt. Don't know how many are still out there running newer kernels.

So a small improvement would be to do that delay only for 5i. Or how about just being a little more relaxed, ala the below? It's still 30 seconds in total, but that's now worst case. Will the 5i crap itself if we attempt to talk to it too soon?

drivers/block/cciss.c +7 -3
index d2cb67b..b5a0611 100644
@@ -3611,11 +3611,15 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
 		schedule_timeout_uninterruptible(30*HZ);
 
 		/* Now try to get the controller to respond to a no-op */
-		for (i=0; i<12; i++) {
+		for (i=0; i<30; i++) {
 			if (cciss_noop(pdev) == 0)
 				break;
-			else
-				printk("cciss: no-op failed%s\n", (i < 11 ? "; re-trying" : ""));
+
+			schedule_timeout_uninterruptible(HZ);
+		}
+		if (i == 30) {
+			printk(KERN_ERR "cciss: controller seems dead\n");
+			return -EBUSY;
 		}
 	}
 
Signature · 1 line
Jens Axboe
#9 lore raw
Quoted 39 lines · Jens
Quoted 1 line
Quoted 1 line

Perhaps we should shrink it to something a little more

tolerable and

Quoted 8 lines
Quoted 1 line

put it in the noop loop instead. 30 seconds is insane...

Some of these controllers do take a long time to recover from the reset because the firmware has to re-initialize. The firmware guys claim that's only a few seconds but that's not true.

Granted, the 5i is old as dirt. Don't know how many are still out there running newer kernels.

So a small improvement would be to do that delay only for 5i. Or how about just being a little more relaxed, ala the below? It's still 30 seconds in total, but that's now worst case. Will the 5i crap itself if we attempt to talk to it too soon?

drivers/block/cciss.c +0 -0
index d2cb67b..b5a0611 100644
@@ -3611,11 +3611,15 @@ static int __devinit 
 cciss_init_one(struct pci_dev *pdev,
 		schedule_timeout_uninterruptible(30*HZ);
 
 		/* Now try to get the controller to respond to 

a no-op */

drivers/block/cciss.c +1 -3
-		for (i=0; i<12; i++) {
+		for (i=0; i<30; i++) {
 			if (cciss_noop(pdev) == 0)
 				break;
-			else
-				printk("cciss: no-op 

failed%s\n", (i < 11 ? "; re-trying" : ""));

drivers/block/cciss.c +5 -0
+
+			schedule_timeout_uninterruptible(HZ);
+		}
+		if (i == 30) {
+			printk(KERN_ERR "cciss: controller 

seems dead\n");

drivers/block/cciss.c static int __devinit cciss_init_one(struct pci_dev *pdev, · line 3624

Quoted 3 lines
drivers/block/cciss.c +1 -0
+			return -EBUSY;
 		}
 	}

The controller won't crap the bed, it will just ignore any requests until it becomes ready. I don't see any problem with this change.

-- mikem

author
#10 lore raw
Quoted 39 lines · Mike (OS Dev)
Quoted 37 lines · Jens
Quoted 1 line
Quoted 1 line

Perhaps we should shrink it to something a little more

tolerable and

Quoted 8 lines
Quoted 1 line

put it in the noop loop instead. 30 seconds is insane...

Some of these controllers do take a long time to recover from the reset because the firmware has to re-initialize. The firmware guys claim that's only a few seconds but that's not true.

Granted, the 5i is old as dirt. Don't know how many are still out there running newer kernels.

So a small improvement would be to do that delay only for 5i. Or how about just being a little more relaxed, ala the below? It's still 30 seconds in total, but that's now worst case. Will the 5i crap itself if we attempt to talk to it too soon?

drivers/block/cciss.c +0 -0
index d2cb67b..b5a0611 100644
@@ -3611,11 +3611,15 @@ static int __devinit 
 cciss_init_one(struct pci_dev *pdev,
 		schedule_timeout_uninterruptible(30*HZ);
 
 		/* Now try to get the controller to respond to 

a no-op */

drivers/block/cciss.c +1 -3
-		for (i=0; i<12; i++) {
+		for (i=0; i<30; i++) {
 			if (cciss_noop(pdev) == 0)
 				break;
-			else
-				printk("cciss: no-op 

failed%s\n", (i < 11 ? "; re-trying" : ""));

drivers/block/cciss.c +4 -0
+
+			schedule_timeout_uninterruptible(HZ);
+		}
+		if (i == 30) {
Quoted 8 lines

drivers/block/cciss.c static int __devinit cciss_init_one(struct pci_dev *pdev, · line 3624

Quoted 5 lines
drivers/block/cciss.c +1 -0
+			printk(KERN_ERR "cciss: controller 

seems dead\n");

drivers/block/cciss.c +1 -0
+			return -EBUSY;
 		}
 	}

The controller won't crap the bed, it will just ignore any requests until it becomes ready. I don't see any problem with this change.

OK, then it should be safe enough. I've added the patch to the upstream queue, with your reviewed-by tag.

Signature · 1 line
Jens Axboe
#11 lore raw
Quoted 63 lines

-----Original Message-----
From: Jens Axboe [mailto:[email protected]]
Sent: Monday, February 23, 2009 5:10 AM
To: Miller, Mike (OS Dev)
Cc: Andrew Morton; [email protected];
[email protected]; [email protected]
Subject: Re: [GIT PULL] block bits for 2.6.29-rc5

Quoted 7 lines · Mike (OS Dev)
Quoted 5 lines · Jens
Quoted 1 line
Quoted 1 line

Perhaps we should shrink it to something a little more

tolerable and

Quoted 3 lines
Quoted 1 line

put it in the noop loop instead. 30 seconds is insane...

Some of these controllers do take a long time to

recover from the

Quoted 1 line
Quoted 1 line
Quoted 1 line

reset because the firmware has to re-initialize. The

firmware guys

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

claim that's only a few seconds but that's not true.

Granted, the 5i is old as dirt. Don't know how many are

still out

Quoted 7 lines
Quoted 7 lines
Quoted 1 line

there running newer kernels.

So a small improvement would be to do that delay only for 5i. Or how about just being a little more relaxed, ala the below? It's still 30 seconds in total, but that's now worst case. Will the 5i crap itself if we attempt to talk to it too soon?

Quoted 5 lines

drivers/block/cciss.c static int __devinit

Quoted 5 lines
drivers/block/cciss.c index renamed from drivers/block/cciss.c +0 -0

d2cb67b..b5a0611 100644

drivers/block/cciss.c +0 -0
@@ -3611,11 +3611,15 @@ static int __devinit 

cciss_init_one(struct

Quoted 4 lines

drivers/block/cciss.c static int __devinit cciss_init_one(struct pci_dev *pdev,

Quoted 4 lines
drivers/block/cciss.c +0 -0
 pci_dev *pdev,
 		schedule_timeout_uninterruptible(30*HZ);
 
 		/* Now try to get the controller to respond to 

a no-op */

Quoted 11 lines
Quoted 11 lines
drivers/block/cciss.c +5 -3
-		for (i=0; i<12; i++) {
+		for (i=0; i<30; i++) {
 			if (cciss_noop(pdev) == 0)
 				break;
-			else
-				printk("cciss: no-op 
 failed%s\n", (i < 11 ? "; re-trying" : ""));
+
+			schedule_timeout_uninterruptible(HZ);
+		}
+		if (i == 30) {
Quoted 8 lines

drivers/block/cciss.c

Quoted 5 lines
drivers/block/cciss.c +2 -0
+			printk(KERN_ERR "cciss: controller
 seems dead\n");
+			return -EBUSY;
drivers/block/cciss.c +0 -0
 		}
 	}

The controller won't crap the bed, it will just ignore any requests until it becomes ready. I don't see any problem with this change.

Quoted 6 lines

OK, then it should be safe enough. I've added the patch to the upstream queue, with your reviewed-by tag.

--
Jens Axboe

Thanks, Jens.

Quoted 1 line
#4 lore raw
In reply to Jens Axboe
Quoted 6 lines · Jens Axboe

It seems to work fine for me, tested with a modified sd that doesn't have barrier support and loop:

Filesystem "sdc1": Disabling barriers, trial barrier write failed XFS mounting filesystem sdc1

Quoted 7 lines

and

Filesystem "loop0": Disabling barriers, trial barrier write failed XFS mounting filesystem loop0

No extra failure warnings on the barrier IO itself. What device do you see this on?

virtio_blk and loop. bvut I have investigated this further, and the reason why I still saw the warnings is that xfs does a blkdev_issue_flush on unomunt which is not protected by the barrier flag, so it gets issued unconditionally. So we got the additional warning on unmount. I've sent a patch to make the blkdev_issue_flush conditionally to fix that issue.