Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't import and cancel scrub at the same time #3658

Closed
FransUrbo opened this issue Aug 5, 2015 · 3 comments
Closed

Can't import and cancel scrub at the same time #3658

FransUrbo opened this issue Aug 5, 2015 · 3 comments
Labels
Type: Feature Feature request or new feature

Comments

@FransUrbo
Copy link
Contributor

I either have a bad SATA/SAS card, OR (more likely - testings have shown this), the mvsas driver is shit!

In any case, under high load (not EXTREME even!) the kernel crashes. Sometimes. Sometimes it works for hours with almost-extreme load without problem…

I'd like the option to, when importing the pool (after such a crash and the scrub is worsening the problem) to have the pool imported non-scrubbing. As it is now, I need to have the pool imported and 'settled' (all zvol devices etc created), wait for it to offer me a rescue shell and THEN cancel the scrub. Most often than not, it's also resilvering which makes it impossible to cancel the scrub (other issue).

Usually, there wasn't enough time to do all this before the kernel crashes again, hence 'import non-scrubbing' option would be nice.

If someone could point me in the right direction, I can take a stab at this.

@behlendorf
Copy link
Contributor

As a quick workaround you can set zfs_no_scrub_io=1 at module load time to disable the scrub IO. Then once the pools imported cancel the scrub.

I agree an option to zpool import would be better. The way to do it would be to pass the command line option to zfs_ioc_pool_import() using the flags stored in the zfs_cmd_t->zv_cookie. Take a look at the existing ZFS_IMPORT_* flags to see how this works. But basically I'd suggest adding ZFS_IMPORT_STOP_SCRUB and using that to immediately cancel the scrub. This could be done at the end of spa_import(). Something like this (untested):

diff --git a/module/zfs/spa.c b/module/zfs/spa.c
index 2e23a34..87a52d0 100644
--- a/module/zfs/spa.c
+++ b/module/zfs/spa.c
@@ -4199,6 +4199,12 @@ spa_import(char *pool, nvlist_t *config, nvlist_t *props, uint64_t f
        }

        /*
+        * Stop a pool scrub if one is in progress.
+        */
+       if (spa->spa_import_flags & ZFS_IMPORT_STOP_SCRUB)
+               (void) spa_scan_stop(spa);
+
+       /*
         * It's possible that the pool was expanded while it was exported.
         * We kick off an async task to handle this for us.
         */

@gmelikov
Copy link
Member

gmelikov commented Jul 7, 2017

Closed by #6167

@gmelikov gmelikov closed this as completed Jul 7, 2017
@alek-p
Copy link
Contributor

alek-p commented Jul 7, 2017

The pause on import part of #6167 was taken out after review discussions as it seemed arbitrary from a user interface perspective and scrub is paused when you import read-only anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Feature Feature request or new feature
Projects
None yet
Development

No branches or pull requests

4 participants