linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arne Jansen <sensille@gmx.net>
To: Josef Bacik <josef@redhat.com>
Cc: chris.mason@oracle.com, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH v2] btrfs: scrub: errors in tree enumeration
Date: Thu, 09 Jun 2011 08:46:47 +0200	[thread overview]
Message-ID: <4DF06C57.1010203@gmx.net> (raw)
In-Reply-To: <4DEF7DB3.2090902@redhat.com>

On 08.06.2011 15:48, Josef Bacik wrote:
> On 06/08/2011 04:38 AM, Arne Jansen wrote:
>> due to the semantics of btrfs_search_slot the path can point to an
>> invalid slot when ret > 0. This condition went unnoticed, which in
>> turn could have led to an incomplete scrubbing.
>>
>> Signed-off-by: Arne Jansen <sensille@gmx.net>
>> ---
>>
>> Change in v2:
>> fix return value of scrub_enumerate_chunks
>>
>> ---
>>  fs/btrfs/scrub.c |   29 ++++++++++++++++++-----------
>>  1 files changed, 18 insertions(+), 11 deletions(-)
>>
>> diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
>> index df50fd1..c4f3a2b 100644
>> --- a/fs/btrfs/scrub.c
>> +++ b/fs/btrfs/scrub.c

>> @@ -1116,9 +1119,13 @@ int scrub_enumerate_chunks(struct scrub_dev *sdev, u64 start, u64 end)
>>  		btrfs_release_path(path);
>>  	}
>>  
>> -out:
>>  	btrfs_free_path(path);
>> -	return ret;
>> +
>> +	/*
>> +	 * ret can still be 1 from search_slot or next_leaf,
>> +	 * that's not an error
>> +	 */
>> +	return ret < 0 ? ret : 0;
> 
> Why not just set ret to 0 if you have to do a btrfs_next_leaf?  Thanks,

I tried, but that looks stupid, to. I then have the same test, but only
after btrfs_next_leaf.

-Arne

> 
> Josef

      reply	other threads:[~2011-06-09  6:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-08  8:38 [PATCH v2] btrfs: scrub: errors in tree enumeration Arne Jansen
2011-06-08 13:48 ` Josef Bacik
2011-06-09  6:46   ` Arne Jansen [this message]

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=4DF06C57.1010203@gmx.net \
    --to=sensille@gmx.net \
    --cc=chris.mason@oracle.com \
    --cc=josef@redhat.com \
    --cc=linux-btrfs@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).