linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Fam Zheng <famz@redhat.com>
To: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: linux-kernel@vger.kernel.org, Jens Axboe <axboe@kernel.dk>,
	linux-scsi@vger.kernel.org
Subject: Re: [PATCH 1/3] block: Return error in rescan_partitions if revalidating disk failed
Date: Wed, 22 Apr 2015 12:13:10 +0800	[thread overview]
Message-ID: <20150422041310.GF2723@ad.nay.redhat.com> (raw)
In-Reply-To: <1429671506.18798.4.camel@HansenPartnership.com>

On Tue, 04/21 19:58, James Bottomley wrote:
> On Tue, 2015-03-24 at 18:16 +0800, Fam Zheng wrote:
> > If the disk can't read capacity, we should return an error.
> 
> I'm not sure I buy this: you need to justify why.
> 
> For instance removable media return an error in revalidate that causes
> the medium not present flag to be set ... do we really want to propagate
> the error in that case?

I think we should. There is a command failed, and the user won't get a valid
disk size.

> 
> > Signed-off-by: Fam Zheng <famz@redhat.com>
> > ---
> >  block/partition-generic.c | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/block/partition-generic.c b/block/partition-generic.c
> > index 0d9e5f9..1e60d7d 100644
> > --- a/block/partition-generic.c
> > +++ b/block/partition-generic.c
> > @@ -427,11 +427,11 @@ rescan:
> >  		return res;
> >  
> >  	if (disk->fops->revalidate_disk)
> > -		disk->fops->revalidate_disk(disk);
> > +		res = disk->fops->revalidate_disk(disk);
> 
> You're assuming here that a negative error code is being returned, but
> some (cciss) seem to be returning 1 on error.
> 
> You'll need to assure us that you've checked all the consumers before
> making this change.

I'll look at the return values.

Fam

> 
> James
> 
> >  	check_disk_size_change(disk, bdev);
> >  	bdev->bd_invalidated = 0;
> > -	if (!get_capacity(disk) || !(state = check_partition(disk, bdev)))
> > -		return 0;
> > +	if (res || !get_capacity(disk) || !(state = check_partition(disk, bdev)))
> > +		return res;
> >  	if (IS_ERR(state)) {
> >  		/*
> >  		 * I/O error reading the partition table.  If any
> 
> 
> 

  reply	other threads:[~2015-04-22  4:13 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-24 10:16 [PATCH 0/3] Fix return code for ioctl( BLKRRPART ) if device is down Fam Zheng
2015-03-24 10:16 ` [PATCH 1/3] block: Return error in rescan_partitions if revalidating disk failed Fam Zheng
2015-04-22  2:58   ` James Bottomley
2015-04-22  4:13     ` Fam Zheng [this message]
2015-03-24 10:16 ` [PATCH 2/3] sd: Return error in sd_revalidate_disk if read capacity failed Fam Zheng
2015-03-24 10:16 ` [PATCH 3/3] sd: Return -EIO " Fam Zheng
2015-03-24 10:34 ` [PATCH 0/3] Fix return code for ioctl( BLKRRPART ) if device is down Paolo Bonzini
2015-03-24 10:42   ` Fam Zheng
2015-04-16  5:05   ` Fam Zheng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150422041310.GF2723@ad.nay.redhat.com \
    --to=famz@redhat.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=axboe@kernel.dk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).