linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Zach Brown <zab@zabbo.net>
Cc: Sandy McArthur Jr <sandymac@gmail.com>,
	"linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>
Subject: Re: btrfs scrub status reports not running when it is
Date: Thu, 15 Jan 2015 12:24:41 +0100	[thread overview]
Message-ID: <20150115112441.GA3685@twin.jikos.cz> (raw)
In-Reply-To: <20150114222717.GA9900@lenny.home.zabbo.net>

On Wed, Jan 14, 2015 at 02:27:17PM -0800, Zach Brown wrote:
> On Wed, Jan 14, 2015 at 04:06:02PM -0500, Sandy McArthur Jr wrote:
> > Sometimes btrfs scrub status reports that is not running when it still is.
> > 
> > I think this a cosmetic bug. And I believe this is related to the
> > scrub completing on some drives before others in a multi-drive btrfs
> > filesystem that is not well balanced.
> 
> Boy, I don't really know this code, but it looks like:
> 
> if (ss->in_progress)
> 	printf(", running for %llu seconds\n", ss->duration);
> else
> 	printf(", interrupted after %llu seconds, not running\n",
> 			ss->duration);
> 
> in_progress = is_scrub_running_in_kernel(fdmnt, di_args, fi_args.num_devices);
> 
> static int is_scrub_running_in_kernel(int fd,
>                 struct btrfs_ioctl_dev_info_args *di_args, u64 max_devices)
> {
>         struct scrub_progress sp;
>         int i;
>         int ret;
> 
>         for (i = 0; i < max_devices; i++) {
>                 memset(&sp, 0, sizeof(sp));
>                 sp.scrub_args.devid = di_args[i].devid;
>                 ret = ioctl(fd, BTRFS_IOC_SCRUB_PROGRESS, &sp.scrub_args);
>                 if (ret < 0 && errno == ENODEV)
>                         continue;
>                 if (ret < 0 && errno == ENOTCONN)
>                         return 0;
> 
> It says that scrub isn't running if any devices have completed.  If you drop
> all those ret < 0 conditional branches that are either noops or wrong, does it
> work like you'd expect?

Why wrong? The ioctl callback returns -ENODEV or -ENOTCONN that get
translated to the errno values and ioctl(...) returns -1 in both cases.

  reply	other threads:[~2015-01-15 11:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-14 21:06 btrfs scrub status reports not running when it is Sandy McArthur Jr
2015-01-14 21:23 ` Marc Joliet
2015-01-14 21:26 ` Sandy McArthur Jr
2015-01-14 22:27 ` Zach Brown
2015-01-15 11:24   ` David Sterba [this message]
2015-01-15 18:02     ` Zach Brown
2015-01-19 17:45       ` David Sterba

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=20150115112441.GA3685@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=sandymac@gmail.com \
    --cc=zab@zabbo.net \
    /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).