Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Andrei Borzenkov <arvidjaar@gmail.com>
To: Chris Murphy <lists@colorremedies.com>,
	Yegor Yegorov <gochkin@gmail.com>
Cc: Btrfs BTRFS <linux-btrfs@vger.kernel.org>
Subject: Re: Help needed to recover from partition resize/move
Date: Sun, 26 Apr 2020 13:03:51 +0300	[thread overview]
Message-ID: <4c46f2a2-8603-977f-74ec-449d3cfb1fb8@gmail.com> (raw)
In-Reply-To: <CAJCQCtRy5-PBRP0K-4BDkdMJfD3U6FPDAYZSxwhFB9KoX0XUTA@mail.gmail.com>

26.04.2020 10:36, Chris Murphy пишет:
>> superblock: bytenr=274877906944, device=/dev/nvme0n1p3
>> ---------------------------------------------------------
>> ERROR: bad magic on superblock on /dev/nvme0n1p3 at 274877906944
> 
> ? OK but why does it even go looking for this 3rd super? A file system
> of this size doesn't have a 3rd super, which appears at 256G.
> 
> There's no dmesg for the resize? This should report the block group
> changes that happen as part of the resize; and also the fs size
> change; and also the partition map change. And if it is rebooted, then
> dump-super shouldn't be looking for a 3rd super.
> 


Most likely it is code bug. The condition is

                 if (ret == 0 && errno == 0)

but errno is not guaranteed to be reset to zero after previous errors. 
Linux errno(3):


        The value in errno is significant only when the return value of 
the call indicated an
        error (i.e., -1 from most system calls; -1 or NULL from most 
library  functions);  a
        function  that  succeeds is allowed to change errno.  The value 
of errno is never set
        to zero by any system call or library function.

And pread64(2)

        Note that is not an error  for  a  successful  call  to 
transfer  fewer  bytes  than
        requested (see read(2) and write(2)).

        On error, -1 is returned and errno is set to indicate the cause 
of the error.

So errno check here is entirely redundant, the only case when pread64 
returns 0 is reading past EOF.

  reply	other threads:[~2020-04-26 10:03 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-25 10:24 Help needed to recover from partition resize/move Yegor Yegorov
2020-04-25 20:05 ` Chris Murphy
2020-04-25 21:54   ` Yegor Yegorov
2020-04-26  0:56     ` Chris Murphy
2020-04-26  5:58       ` Andrei Borzenkov
2020-04-26  6:23       ` Yegor Yegorov
2020-04-26  7:36         ` Chris Murphy
2020-04-26 10:03           ` Andrei Borzenkov [this message]
2020-04-26 11:04 ` Ferry Toth

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=4c46f2a2-8603-977f-74ec-449d3cfb1fb8@gmail.com \
    --to=arvidjaar@gmail.com \
    --cc=gochkin@gmail.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=lists@colorremedies.com \
    /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