All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: Karel Zak <kzak@redhat.com>
Cc: Werner Fink <werner@suse.de>, Stanislav Brabec <sbrabec@suse.com>,
	util-linux@vger.kernel.org
Subject: Re: [PATCH 1/2] blkid: stop scanning on I/O error
Date: Wed, 19 Mar 2014 21:20:43 +0100	[thread overview]
Message-ID: <5329FC1B.9050706@suse.de> (raw)
In-Reply-To: <20140319173819.GA31824@x2.net.home>

On 03/19/2014 06:38 PM, Karel Zak wrote:
> On Wed, Mar 19, 2014 at 02:50:55PM +0100, Hannes Reinecke wrote:
>> @@ -794,6 +801,8 @@ int blkid_probe_get_idmag(blkid_probe pr, const struct blkid_idinfo *id,
>>   		off = (mag->kboff + (mag->sboff >> 10)) << 10;
>>   		buf = blkid_probe_get_buffer(pr, off, 1024);
>>
>> +		if (!buf && errno)
>> +			return -1;
>
>              return -errno;
>
Hmm. Okay; but then I'll need to audit the callers.

>>   		if (buf && !memcmp(mag->magic,
>>   				buf + (mag->sboff & 0x3ff), mag->len)) {
>>   			DBG(LOWPROBE, blkid_debug("\tmagic sboff=%u, kboff=%ld",
>> diff --git a/libblkid/src/superblocks/superblocks.c b/libblkid/src/superblocks/superblocks.c
>> index c6394c4..35cfd50 100644
>> --- a/libblkid/src/superblocks/superblocks.c
>> +++ b/libblkid/src/superblocks/superblocks.c
>> @@ -379,15 +379,22 @@ static int superblocks_probe(blkid_probe pr, struct blkid_chain *chn)
>>
>>   		DBG(LOWPROBE, blkid_debug("[%zd] %s:", i, id->name));
>>
>> -		if (blkid_probe_get_idmag(pr, id, &off, &mag))
>> +		rc = blkid_probe_get_idmag(pr, id, &off, &mag);
>> +		if (rc < 0)
>> +			break;
>> +		if (rc > 0)
>>   			continue;
>>
>>   		/* final check by probing function */
>>   		if (id->probefunc) {
>>   			DBG(LOWPROBE, blkid_debug("\tcall probefunc()"));
>> -			if (id->probefunc(pr, mag) != 0) {
>> +			rc = id->probefunc(pr, mag);
>> +			if (rc != 0) {
>>   				blkid_probe_chain_reset_vals(pr, chn);
>> -				continue;
>> +				if (rc < 0)
>> +					break;
>> +				else
>> +					continue;
>>   			}
>>   		}
>
> The function superblocks_probe() has to return 'rc' (now after the
> loop break it returns 1), otherwise the errors will be invisible for
> superblocks_safeprobe().
>
Okay, fixed.

> The errors has to be propagated to top level function (probe.c
> blkid_do_probe(), blkid_do_safeprobe(), etc).
>
That's already taken care of; the current code allows for this.

Cheers,

Hannes

  reply	other threads:[~2014-03-19 20:20 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-19 13:50 [PATCHv2 0/2] Abort blkid on I/O errors Hannes Reinecke
2014-03-19 13:50 ` [PATCH 1/2] blkid: stop scanning on I/O error Hannes Reinecke
2014-03-19 17:38   ` Karel Zak
2014-03-19 20:20     ` Hannes Reinecke [this message]
2014-03-19 13:50 ` [PATCH 2/2] blkid: convert superblocks to new calling convention Hannes Reinecke
2014-03-19 17:55   ` Karel Zak
2014-03-19 20:57     ` Hannes Reinecke
2014-03-20  9:18       ` Karel Zak
  -- strict thread matches above, loose matches on Subject: below --
2014-03-20 10:03 [PATCHv3 0/2] Abort blkid probing errors Hannes Reinecke
2014-03-20 10:03 ` [PATCH 1/2] blkid: stop scanning on I/O error Hannes Reinecke
2014-03-20 10:48   ` Karel Zak
2014-03-19 10:59 [PATCH 0/2] Abort blkid on I/O errors Hannes Reinecke
2014-03-19 10:59 ` [PATCH 1/2] blkid: stop scanning on I/O error Hannes Reinecke

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=5329FC1B.9050706@suse.de \
    --to=hare@suse.de \
    --cc=kzak@redhat.com \
    --cc=sbrabec@suse.com \
    --cc=util-linux@vger.kernel.org \
    --cc=werner@suse.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.