28 Feb, 2019

1 commit

  • Because the new API passes in key,value parameters, match_token() cannot be
    used with it. Instead, provide three new helpers to aid with parsing:

    (1) fs_parse(). This takes a parameter and a simple static description of
    all the parameters and maps the key name to an ID. It returns 1 on a
    match, 0 on no match if unknowns should be ignored and some other
    negative error code on a parse error.

    The parameter description includes a list of key names to IDs, desired
    parameter types and a list of enumeration name -> ID mappings.

    [!] Note that for the moment I've required that the key->ID mapping
    array is expected to be sorted and unterminated. The size of the
    array is noted in the fsconfig_parser struct. This allows me to use
    bsearch(), but I'm not sure any performance gain is worth the hassle
    of requiring people to keep the array sorted.

    The parameter type array is sized according to the number of parameter
    IDs and is indexed directly. The optional enum mapping array is an
    unterminated, unsorted list and the size goes into the fsconfig_parser
    struct.

    The function can do some additional things:

    (a) If it's not ambiguous and no value is given, the prefix "no" on
    a key name is permitted to indicate that the parameter should
    be considered negatory.

    (b) If the desired type is a single simple integer, it will perform
    an appropriate conversion and store the result in a union in
    the parse result.

    (c) If the desired type is an enumeration, {key ID, name} will be
    looked up in the enumeration list and the matching value will
    be stored in the parse result union.

    (d) Optionally generate an error if the key is unrecognised.

    This is called something like:

    enum rdt_param {
    Opt_cdp,
    Opt_cdpl2,
    Opt_mba_mpbs,
    nr__rdt_params
    };

    const struct fs_parameter_spec rdt_param_specs[nr__rdt_params] = {
    [Opt_cdp] = { fs_param_is_bool },
    [Opt_cdpl2] = { fs_param_is_bool },
    [Opt_mba_mpbs] = { fs_param_is_bool },
    };

    const const char *const rdt_param_keys[nr__rdt_params] = {
    [Opt_cdp] = "cdp",
    [Opt_cdpl2] = "cdpl2",
    [Opt_mba_mpbs] = "mba_mbps",
    };

    const struct fs_parameter_description rdt_parser = {
    .name = "rdt",
    .nr_params = nr__rdt_params,
    .keys = rdt_param_keys,
    .specs = rdt_param_specs,
    .no_source = true,
    };

    int rdt_parse_param(struct fs_context *fc,
    struct fs_parameter *param)
    {
    struct fs_parse_result parse;
    struct rdt_fs_context *ctx = rdt_fc2context(fc);
    int ret;

    ret = fs_parse(fc, &rdt_parser, param, &parse);
    if (ret < 0)
    return ret;

    switch (parse.key) {
    case Opt_cdp:
    ctx->enable_cdpl3 = true;
    return 0;
    case Opt_cdpl2:
    ctx->enable_cdpl2 = true;
    return 0;
    case Opt_mba_mpbs:
    ctx->enable_mba_mbps = true;
    return 0;
    }

    return -EINVAL;
    }

    (2) fs_lookup_param(). This takes a { dirfd, path, LOOKUP_EMPTY? } or
    string value and performs an appropriate path lookup to convert it
    into a path object, which it will then return.

    If the desired type was a blockdev, the type of the looked up inode
    will be checked to make sure it is one.

    This can be used like:

    enum foo_param {
    Opt_source,
    nr__foo_params
    };

    const struct fs_parameter_spec foo_param_specs[nr__foo_params] = {
    [Opt_source] = { fs_param_is_blockdev },
    };

    const char *char foo_param_keys[nr__foo_params] = {
    [Opt_source] = "source",
    };

    const struct constant_table foo_param_alt_keys[] = {
    { "device", Opt_source },
    };

    const struct fs_parameter_description foo_parser = {
    .name = "foo",
    .nr_params = nr__foo_params,
    .nr_alt_keys = ARRAY_SIZE(foo_param_alt_keys),
    .keys = foo_param_keys,
    .alt_keys = foo_param_alt_keys,
    .specs = foo_param_specs,
    };

    int foo_parse_param(struct fs_context *fc,
    struct fs_parameter *param)
    {
    struct fs_parse_result parse;
    struct foo_fs_context *ctx = foo_fc2context(fc);
    int ret;

    ret = fs_parse(fc, &foo_parser, param, &parse);
    if (ret < 0)
    return ret;

    switch (parse.key) {
    case Opt_source:
    return fs_lookup_param(fc, &foo_parser, param,
    &parse, &ctx->source);
    default:
    return -EINVAL;
    }
    }

    (3) lookup_constant(). This takes a table of named constants and looks up
    the given name within it. The table is expected to be sorted such
    that bsearch() be used upon it.

    Possibly I should require the table be terminated and just use a
    for-loop to scan it instead of using bsearch() to reduce hassle.

    Tables look something like:

    static const struct constant_table bool_names[] = {
    { "0", false },
    { "1", true },
    { "false", false },
    { "no", false },
    { "true", true },
    { "yes", true },
    };

    and a lookup is done with something like:

    b = lookup_constant(bool_names, param->string, -1);

    Additionally, optional validation routines for the parameter description
    are provided that can be enabled at compile time. A later patch will
    invoke these when a filesystem is registered.

    Signed-off-by: David Howells
    Signed-off-by: Al Viro

    David Howells
     

02 Nov, 2017

1 commit

  • Many source files in the tree are missing licensing information, which
    makes it harder for compliance tools to determine the correct license.

    By default all files without license information are under the default
    license of the kernel, which is GPL version 2.

    Update the files which contain no license information with the 'GPL-2.0'
    SPDX license identifier. The SPDX identifier is a legally binding
    shorthand, which can be used instead of the full boiler plate text.

    This patch is based on work done by Thomas Gleixner and Kate Stewart and
    Philippe Ombredanne.

    How this work was done:

    Patches were generated and checked against linux-4.14-rc6 for a subset of
    the use cases:
    - file had no licensing information it it.
    - file was a */uapi/* one with no licensing information in it,
    - file was a */uapi/* one with existing licensing information,

    Further patches will be generated in subsequent months to fix up cases
    where non-standard license headers were used, and references to license
    had to be inferred by heuristics based on keywords.

    The analysis to determine which SPDX License Identifier to be applied to
    a file was done in a spreadsheet of side by side results from of the
    output of two independent scanners (ScanCode & Windriver) producing SPDX
    tag:value files created by Philippe Ombredanne. Philippe prepared the
    base worksheet, and did an initial spot review of a few 1000 files.

    The 4.13 kernel was the starting point of the analysis with 60,537 files
    assessed. Kate Stewart did a file by file comparison of the scanner
    results in the spreadsheet to determine which SPDX license identifier(s)
    to be applied to the file. She confirmed any determination that was not
    immediately clear with lawyers working with the Linux Foundation.

    Criteria used to select files for SPDX license identifier tagging was:
    - Files considered eligible had to be source code files.
    - Make and config files were included as candidates if they contained >5
    lines of source
    - File already had some variant of a license header in it (even if
    Reviewed-by: Philippe Ombredanne
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

18 May, 2016

1 commit

  • There are several problems in the way a stateid is selected for a
    LAYOUTGET operation:

    We pick a stateid to use in the RPC prepare op, but that makes
    it difficult to serialize LAYOUTGETs that use the open stateid. That
    serialization is done in pnfs_update_layout, which occurs well before
    the rpc_prepare operation.

    Between those two events, the i_lock is dropped and reacquired.
    pnfs_update_layout can find that the list has lsegs in it and not do any
    serialization, but then later pnfs_choose_layoutget_stateid ends up
    choosing the open stateid.

    This patch changes the client to select the stateid to use in the
    LAYOUTGET earlier, when we're searching for a usable layout segment.
    This way we can do it all while holding the i_lock the first time, and
    ensure that we serialize any LAYOUTGET call that uses a non-layout
    stateid.

    This also means a rework of how LAYOUTGET replies are handled, as we
    must now get the latest stateid if we want to retransmit in response
    to a retryable error.

    Most of those errors boil down to the fact that the layout state has
    changed in some fashion. Thus, what we really want to do is to re-search
    for a layout when it fails with a retryable error, so that we can avoid
    reissuing the RPC at all if possible.

    While the LAYOUTGET RPC is async, the initiating thread always waits for
    it to complete, so it's effectively synchronous anyway. Currently, when
    we need to retry a LAYOUTGET because of an error, we drive that retry
    via the rpc state machine.

    This means that once the call has been submitted, it runs until it
    completes. So, we must move the error handling for this RPC out of the
    rpc_call_done operation and into the caller.

    In order to handle errors like NFS4ERR_DELAY properly, we must also
    pass a pointer to the sliding timeout, which is now moved to the stack
    in pnfs_update_layout.

    The complicating errors are -NFS4ERR_RECALLCONFLICT and
    -NFS4ERR_LAYOUTTRYLATER, as those involve a timeout after which we give
    up and return NULL back to the caller. So, there is some special
    handling for those errors to ensure that the layers driving the retries
    can handle that appropriately.

    Signed-off-by: Jeff Layton
    Signed-off-by: Anna Schumaker

    Jeff Layton
     

08 May, 2013

1 commit

  • This removes the retry-based AIO infrastructure now that nothing in tree
    is using it.

    We want to remove retry-based AIO because it is fundemantally unsafe.
    It retries IO submission from a kernel thread that has only assumed the
    mm of the submitting task. All other task_struct references in the IO
    submission path will see the kernel thread, not the submitting task.
    This design flaw means that nothing of any meaningful complexity can use
    retry-based AIO.

    This removes all the code and data associated with the retry machinery.
    The most significant benefit of this is the removal of the locking
    around the unused run list in the submission path.

    [akpm@linux-foundation.org: coding-style fixes]
    Signed-off-by: Kent Overstreet
    Signed-off-by: Zach Brown
    Cc: Zach Brown
    Cc: Felipe Balbi
    Cc: Greg Kroah-Hartman
    Cc: Mark Fasheh
    Cc: Joel Becker
    Cc: Rusty Russell
    Cc: Jens Axboe
    Cc: Asai Thambi S P
    Cc: Selvan Mani
    Cc: Sam Bradshaw
    Acked-by: Jeff Moyer
    Cc: Al Viro
    Cc: Benjamin LaHaise
    Reviewed-by: "Theodore Ts'o"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Zach Brown
     

13 Oct, 2012

1 commit


02 Jun, 2012

1 commit

  • NFS optimizes away d_revalidates for last component of open. This means that
    open itself can find the dentry stale.

    This patch allows the filesystem to return EOPENSTALE and the VFS will retry the
    lookup on just the last component if possible.

    If the lookup was done using RCU mode, including the last component, then this
    is not possible since the parent dentry is lost. In this case fall back to
    non-RCU lookup. Currently this is not used since NFS will always leave RCU
    mode.

    Signed-off-by: Miklos Szeredi
    Signed-off-by: Al Viro

    Miklos Szeredi
     

09 Mar, 2012

1 commit

  • Allow drivers to report at probe time that they cannot get all the resources
    required by the device, and should be retried at a later time.

    This should completely solve the problem of getting devices
    initialized in the right order. Right now this is mostly handled by
    mucking about with initcall ordering which is a complete hack, and
    doesn't even remotely handle the case where device drivers are in
    modules. This approach completely sidesteps the issues by allowing
    driver registration to occur in any order, and any driver can request
    to be retried after a few more other drivers get probed.

    v4: - Integrate Manjunath's addition of a separate workqueue
    - Change -EAGAIN to -EPROBE_DEFER for drivers to trigger deferral
    - Update comment blocks to reflect how the code really works
    v3: - Hold off workqueue scheduling until late_initcall so that the bulk
    of driver probes are complete before we start retrying deferred devices.
    - Tested with simple use cases. Still needs more testing though.
    Using it to get rid of the gpio early_initcall madness, or to replace
    the ASoC internal probe deferral code would be ideal.
    v2: - added locking so it should no longer be utterly broken in that regard
    - remove device from deferred list at device_del time.
    - Still completely untested with any real use case, but has been
    boot tested.

    Signed-off-by: Grant Likely
    Cc: Mark Brown
    Cc: Arnd Bergmann
    Cc: Dilan Lee
    Cc: Manjunath GKondaiah
    Cc: Alan Stern
    Cc: Tony Lindgren
    Cc: Alan Cox
    Reviewed-by: Mark Brown
    Acked-by: David Daney
    Reviewed-by: Arnd Bergmann
    Signed-off-by: Greg Kroah-Hartman

    Grant Likely
     

01 Jun, 2007

1 commit


17 Apr, 2005

1 commit

  • Initial git repository build. I'm not bothering with the full history,
    even though we have it. We can create a separate "historical" git
    archive of that later if we want to, and in the meantime it's about
    3.2GB when imported into git - space that would just make the early
    git days unnecessarily complicated, when we don't have a lot of good
    infrastructure for it.

    Let it rip!

    Linus Torvalds