tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: patch - cgdconfig do_all mode gracefully ignore detached devices



On Sun, Nov 10, 2019 at 10:00:48AM -0600, Jason High wrote:
> Thanks for the quick chat.  Per suggestions, I'm using open rather
> than opendisk.  Ok?

open is better, because cgd internally just opens the path.

However,

>          return -1;
>      }
> 
> +    /* if called from do_all, then ignore if device is not attached */
> +    if (flags == CONFIG_FLAGS_FROMALL) {
> +
> +        ret = verify_attached(argv[1]);
> +
> +        /* device unattached */
> +        if (ret == 0) {
> +            VPRINTF(1, ("skipping %s: device is not attached\n", argv[1]));
> +            return 0;
> +        }
> +        /* pass-through success and errors */
> +    }

this check is done with argv[1] before argv[1] might be translated by
getfsspecname(). An entry for a named wedge (NAME=foo) will not be
handled correctly. Also, dev can be overridden from the command line.

So the check should happen a bit later until the final value is known
that will be passed to configure_params(), probably after checking
all the parameters.


Greetings,
-- 
                                Michael van Elst
Internet: mlelstv%serpens.de@localhost
                                "A potential Snark may lurk in every tree."


Home | Main Index | Thread Index | Old Index