19 Jul, 2019

1 commit


28 Jun, 2019

1 commit


02 Mar, 2019

10 commits


21 Feb, 2019

1 commit


20 Dec, 2018

1 commit

  • SUNRPC has two sorts of credentials, both of which appear as
    "struct rpc_cred".
    There are "generic credentials" which are supplied by clients
    such as NFS and passed in 'struct rpc_message' to indicate
    which user should be used to authorize the request, and there
    are low-level credentials such as AUTH_NULL, AUTH_UNIX, AUTH_GSS
    which describe the credential to be sent over the wires.

    This patch replaces all the generic credentials by 'struct cred'
    pointers - the credential structure used throughout Linux.

    For machine credentials, there is a special 'struct cred *' pointer
    which is statically allocated and recognized where needed as
    having a special meaning. A look-up of a low-level cred will
    map this to a machine credential.

    Signed-off-by: NeilBrown
    Acked-by: J. Bruce Fields
    Signed-off-by: Anna Schumaker

    NeilBrown
     

23 Nov, 2018

1 commit

  • rfc8435 says:

    For tight coupling, ffds_stateid provides the stateid to be used by
    the client to access the file.

    However current implementation replaces per-mirror provided stateid with
    by open or lock stateid.

    Ensure that per-mirror stateid is used by ff_layout_write_prepare_v4 and
    nfs4_ff_layout_prepare_ds.

    Signed-off-by: Tigran Mkrtchyan
    Signed-off-by: Rick Macklem
    Signed-off-by: Trond Myklebust

    Tigran Mkrtchyan
     

01 Oct, 2018

1 commit


13 Jun, 2018

1 commit

  • The kzalloc() function has a 2-factor argument form, kcalloc(). This
    patch replaces cases of:

    kzalloc(a * b, gfp)

    with:
    kcalloc(a * b, gfp)

    as well as handling cases of:

    kzalloc(a * b * c, gfp)

    with:

    kzalloc(array3_size(a, b, c), gfp)

    as it's slightly less ugly than:

    kzalloc_array(array_size(a, b), c, gfp)

    This does, however, attempt to ignore constant size factors like:

    kzalloc(4 * 1024, gfp)

    though any constants defined via macros get caught up in the conversion.

    Any factors with a sizeof() of "unsigned char", "char", and "u8" were
    dropped, since they're redundant.

    The Coccinelle script used for this was:

    // Fix redundant parens around sizeof().
    @@
    type TYPE;
    expression THING, E;
    @@

    (
    kzalloc(
    - (sizeof(TYPE)) * E
    + sizeof(TYPE) * E
    , ...)
    |
    kzalloc(
    - (sizeof(THING)) * E
    + sizeof(THING) * E
    , ...)
    )

    // Drop single-byte sizes and redundant parens.
    @@
    expression COUNT;
    typedef u8;
    typedef __u8;
    @@

    (
    kzalloc(
    - sizeof(u8) * (COUNT)
    + COUNT
    , ...)
    |
    kzalloc(
    - sizeof(__u8) * (COUNT)
    + COUNT
    , ...)
    |
    kzalloc(
    - sizeof(char) * (COUNT)
    + COUNT
    , ...)
    |
    kzalloc(
    - sizeof(unsigned char) * (COUNT)
    + COUNT
    , ...)
    |
    kzalloc(
    - sizeof(u8) * COUNT
    + COUNT
    , ...)
    |
    kzalloc(
    - sizeof(__u8) * COUNT
    + COUNT
    , ...)
    |
    kzalloc(
    - sizeof(char) * COUNT
    + COUNT
    , ...)
    |
    kzalloc(
    - sizeof(unsigned char) * COUNT
    + COUNT
    , ...)
    )

    // 2-factor product with sizeof(type/expression) and identifier or constant.
    @@
    type TYPE;
    expression THING;
    identifier COUNT_ID;
    constant COUNT_CONST;
    @@

    (
    - kzalloc
    + kcalloc
    (
    - sizeof(TYPE) * (COUNT_ID)
    + COUNT_ID, sizeof(TYPE)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(TYPE) * COUNT_ID
    + COUNT_ID, sizeof(TYPE)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(TYPE) * (COUNT_CONST)
    + COUNT_CONST, sizeof(TYPE)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(TYPE) * COUNT_CONST
    + COUNT_CONST, sizeof(TYPE)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(THING) * (COUNT_ID)
    + COUNT_ID, sizeof(THING)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(THING) * COUNT_ID
    + COUNT_ID, sizeof(THING)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(THING) * (COUNT_CONST)
    + COUNT_CONST, sizeof(THING)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(THING) * COUNT_CONST
    + COUNT_CONST, sizeof(THING)
    , ...)
    )

    // 2-factor product, only identifiers.
    @@
    identifier SIZE, COUNT;
    @@

    - kzalloc
    + kcalloc
    (
    - SIZE * COUNT
    + COUNT, SIZE
    , ...)

    // 3-factor product with 1 sizeof(type) or sizeof(expression), with
    // redundant parens removed.
    @@
    expression THING;
    identifier STRIDE, COUNT;
    type TYPE;
    @@

    (
    kzalloc(
    - sizeof(TYPE) * (COUNT) * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    kzalloc(
    - sizeof(TYPE) * (COUNT) * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    kzalloc(
    - sizeof(TYPE) * COUNT * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    kzalloc(
    - sizeof(TYPE) * COUNT * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    kzalloc(
    - sizeof(THING) * (COUNT) * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    kzalloc(
    - sizeof(THING) * (COUNT) * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    kzalloc(
    - sizeof(THING) * COUNT * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    kzalloc(
    - sizeof(THING) * COUNT * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    )

    // 3-factor product with 2 sizeof(variable), with redundant parens removed.
    @@
    expression THING1, THING2;
    identifier COUNT;
    type TYPE1, TYPE2;
    @@

    (
    kzalloc(
    - sizeof(TYPE1) * sizeof(TYPE2) * COUNT
    + array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
    , ...)
    |
    kzalloc(
    - sizeof(TYPE1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
    , ...)
    |
    kzalloc(
    - sizeof(THING1) * sizeof(THING2) * COUNT
    + array3_size(COUNT, sizeof(THING1), sizeof(THING2))
    , ...)
    |
    kzalloc(
    - sizeof(THING1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(THING1), sizeof(THING2))
    , ...)
    |
    kzalloc(
    - sizeof(TYPE1) * sizeof(THING2) * COUNT
    + array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
    , ...)
    |
    kzalloc(
    - sizeof(TYPE1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
    , ...)
    )

    // 3-factor product, only identifiers, with redundant parens removed.
    @@
    identifier STRIDE, SIZE, COUNT;
    @@

    (
    kzalloc(
    - (COUNT) * STRIDE * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kzalloc(
    - COUNT * (STRIDE) * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kzalloc(
    - COUNT * STRIDE * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kzalloc(
    - (COUNT) * (STRIDE) * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kzalloc(
    - COUNT * (STRIDE) * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kzalloc(
    - (COUNT) * STRIDE * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kzalloc(
    - (COUNT) * (STRIDE) * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kzalloc(
    - COUNT * STRIDE * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    )

    // Any remaining multi-factor products, first at least 3-factor products,
    // when they're not all constants...
    @@
    expression E1, E2, E3;
    constant C1, C2, C3;
    @@

    (
    kzalloc(C1 * C2 * C3, ...)
    |
    kzalloc(
    - (E1) * E2 * E3
    + array3_size(E1, E2, E3)
    , ...)
    |
    kzalloc(
    - (E1) * (E2) * E3
    + array3_size(E1, E2, E3)
    , ...)
    |
    kzalloc(
    - (E1) * (E2) * (E3)
    + array3_size(E1, E2, E3)
    , ...)
    |
    kzalloc(
    - E1 * E2 * E3
    + array3_size(E1, E2, E3)
    , ...)
    )

    // And then all remaining 2 factors products when they're not all constants,
    // keeping sizeof() as the second factor argument.
    @@
    expression THING, E1, E2;
    type TYPE;
    constant C1, C2, C3;
    @@

    (
    kzalloc(sizeof(THING) * C2, ...)
    |
    kzalloc(sizeof(TYPE) * C2, ...)
    |
    kzalloc(C1 * C2 * C3, ...)
    |
    kzalloc(C1 * C2, ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(TYPE) * (E2)
    + E2, sizeof(TYPE)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(TYPE) * E2
    + E2, sizeof(TYPE)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(THING) * (E2)
    + E2, sizeof(THING)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(THING) * E2
    + E2, sizeof(THING)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - (E1) * E2
    + E1, E2
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - (E1) * (E2)
    + E1, E2
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - E1 * E2
    + E1, E2
    , ...)
    )

    Signed-off-by: Kees Cook

    Kees Cook
     

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
     

09 Aug, 2017

1 commit


21 Apr, 2017

2 commits


01 Apr, 2017

1 commit

  • this fix aims to fix dereferencing of a mirror in an error state when MDS
    returns unsupported DS type (IOW, not v3), which causes the following oops:

    [ 220.370709] BUG: unable to handle kernel NULL pointer dereference at 0000000000000065
    [ 220.370842] IP: ff_layout_mirror_valid+0x2d/0x110 [nfs_layout_flexfiles]
    [ 220.370920] PGD 0

    [ 220.370972] Oops: 0000 [#1] SMP
    [ 220.371013] Modules linked in: nfnetlink_queue nfnetlink_log bluetooth nfs_layout_flexfiles rpcsec_gss_krb5 nfsv4 dns_resolver nfs fscache nf_conntrack_netbios_ns nf_conntrack_broadcast xt_CT ip6t_rpfilter ip6t_REJECT nf_reject_ipv6 xt_conntrack ip_set nfnetlink ebtable_nat ebtable_broute bridge stp llc ip6table_raw ip6table_nat nf_conntrack_ipv6 nf_defrag_ipv6 nf_nat_ipv6 ip6table_mangle ip6table_security iptable_raw iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrack libcrc32c iptable_mangle iptable_security ebtable_filter ebtables ip6table_filter ip6_tables binfmt_misc intel_rapl x86_pkg_temp_thermal intel_powerclamp coretemp kvm_intel btrfs kvm arc4 snd_hda_codec_hdmi iwldvm irqbypass crct10dif_pclmul crc32_pclmul ghash_clmulni_intel intel_cstate mac80211 xor uvcvideo
    [ 220.371814] videobuf2_vmalloc videobuf2_memops snd_hda_codec_idt mei_wdt videobuf2_v4l2 snd_hda_codec_generic iTCO_wdt ppdev videobuf2_core iTCO_vendor_support dell_rbtn dell_wmi iwlwifi sparse_keymap dell_laptop dell_smbios snd_hda_intel dcdbas videodev snd_hda_codec dell_smm_hwmon snd_hda_core media cfg80211 intel_uncore snd_hwdep raid6_pq snd_seq intel_rapl_perf snd_seq_device joydev i2c_i801 rfkill lpc_ich snd_pcm parport_pc mei_me parport snd_timer dell_smo8800 mei snd shpchp soundcore tpm_tis tpm_tis_core tpm nfsd auth_rpcgss nfs_acl lockd grace sunrpc i915 nouveau mxm_wmi ttm i2c_algo_bit drm_kms_helper crc32c_intel e1000e drm sdhci_pci firewire_ohci sdhci serio_raw mmc_core firewire_core ptp crc_itu_t pps_core wmi fjes video
    [ 220.372568] CPU: 7 PID: 4988 Comm: cat Not tainted 4.10.5-200.fc25.x86_64 #1
    [ 220.372647] Hardware name: Dell Inc. Latitude E6520/0J4TFW, BIOS A06 07/11/2011
    [ 220.372729] task: ffff94791f6ea580 task.stack: ffffb72b88c0c000
    [ 220.372802] RIP: 0010:ff_layout_mirror_valid+0x2d/0x110 [nfs_layout_flexfiles]
    [ 220.372883] RSP: 0018:ffffb72b88c0f970 EFLAGS: 00010246
    [ 220.372945] RAX: 0000000000000000 RBX: ffff9479015ca600 RCX: ffffffffffffffed
    [ 220.373025] RDX: ffffffffffffffed RSI: ffff9479753dc980 RDI: 0000000000000000
    [ 220.373104] RBP: ffffb72b88c0f988 R08: 000000000001c980 R09: ffffffffc0ea6112
    [ 220.373184] R10: ffffef17477d9640 R11: ffff9479753dd6c0 R12: ffff9479211c7440
    [ 220.373264] R13: ffff9478f45b7790 R14: 0000000000000001 R15: ffff9479015ca600
    [ 220.373345] FS: 00007f555fa3e700(0000) GS:ffff9479753c0000(0000) knlGS:0000000000000000
    [ 220.373435] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [ 220.373506] CR2: 0000000000000065 CR3: 0000000196044000 CR4: 00000000000406e0
    [ 220.373586] Call Trace:
    [ 220.373627] nfs4_ff_layout_prepare_ds+0x5e/0x200 [nfs_layout_flexfiles]
    [ 220.373708] ff_layout_pg_init_read+0x81/0x160 [nfs_layout_flexfiles]
    [ 220.373806] __nfs_pageio_add_request+0x11f/0x4a0 [nfs]
    [ 220.373886] ? nfs_create_request.part.14+0x37/0x330 [nfs]
    [ 220.373967] nfs_pageio_add_request+0xb2/0x260 [nfs]
    [ 220.374042] readpage_async_filler+0xaf/0x280 [nfs]
    [ 220.374103] read_cache_pages+0xef/0x1b0
    [ 220.374166] ? nfs_read_completion+0x210/0x210 [nfs]
    [ 220.374239] nfs_readpages+0x129/0x200 [nfs]
    [ 220.374293] __do_page_cache_readahead+0x1d0/0x2f0
    [ 220.374352] ondemand_readahead+0x17d/0x2a0
    [ 220.374403] page_cache_sync_readahead+0x2e/0x50
    [ 220.374460] generic_file_read_iter+0x6c8/0x950
    [ 220.374532] ? nfs_mapping_need_revalidate_inode+0x17/0x40 [nfs]
    [ 220.374617] nfs_file_read+0x6e/0xc0 [nfs]
    [ 220.374670] __vfs_read+0xe2/0x150
    [ 220.374715] vfs_read+0x96/0x130
    [ 220.374758] SyS_read+0x55/0xc0
    [ 220.374801] entry_SYSCALL_64_fastpath+0x1a/0xa9
    [ 220.374856] RIP: 0033:0x7f555f570bd0
    [ 220.374900] RSP: 002b:00007ffeb73e1b38 EFLAGS: 00000246 ORIG_RAX: 0000000000000000
    [ 220.374986] RAX: ffffffffffffffda RBX: 00007f555f839ae0 RCX: 00007f555f570bd0
    [ 220.375066] RDX: 0000000000020000 RSI: 00007f555fa41000 RDI: 0000000000000003
    [ 220.375145] RBP: 0000000000021010 R08: ffffffffffffffff R09: 0000000000000000
    [ 220.375226] R10: 00007f555fa40010 R11: 0000000000000246 R12: 0000000000022000
    [ 220.375305] R13: 0000000000021010 R14: 0000000000001000 R15: 0000000000002710
    [ 220.375386] Code: 66 66 90 55 48 89 e5 41 54 53 49 89 fc 48 83 ec 08 48 85 f6 74 2e 48 8b 4e 30 48 89 f3 48 81 f9 00 f0 ff ff 77 1e 48 85 c9 74 15 83 79 78 00 b8 01 00 00 00 74 2c 48 83 c4 08 5b 41 5c 5d c3
    [ 220.375653] RIP: ff_layout_mirror_valid+0x2d/0x110 [nfs_layout_flexfiles] RSP: ffffb72b88c0f970
    [ 220.375748] CR2: 0000000000000065
    [ 220.403538] ---[ end trace bcdca752211b7da9 ]---

    Signed-off-by: Tigran Mkrtchyan
    Signed-off-by: Anna Schumaker

    Tigran Mkrtchyan
     

18 Mar, 2017

2 commits

  • The flexfiles layout should never mark a device unavailable.

    Move nfs4_mark_deviceid_unavailable out of nfs4_pnfs_ds_connect and call
    directly from files layout where it's still needed.

    The flexfiles driver still handles marked devices in error paths, but will
    now print a rate limited warning.

    Signed-off-by: Weston Andros Adamson
    Signed-off-by: Anna Schumaker

    Weston Andros Adamson
     
  • The nfs4_pnfs_ds_connect path can call rpc_create which can fail or it
    can wait on another context to reach the same failure.

    This checks that the rpc_create succeeded and returns the error to the
    caller.

    When an error is returned, both the files and flexfiles layouts will return
    NULL from _prepare_ds(). The flexfiles layout will also return the layout
    with the error NFS4ERR_NXIO.

    Signed-off-by: Weston Andros Adamson
    Signed-off-by: Anna Schumaker

    Weston Andros Adamson
     

20 Dec, 2016

1 commit


09 Dec, 2016

1 commit

  • We encountered a deadlock where the SEQUENCE that accompanied the
    LAYOUTGET triggered a session drain, while ff_layout_alloc_lseg
    triggered a GETDEVICEINFO. The GETDEVICEINFO hung waiting for the
    session drain, while the LAYOUTGET held the slot waiting for
    alloc_lseg to finish.
    Avoid this by moving the call to nfs4_find_get_deviceid out of
    ff_layout_alloc_lseg and into nfs4_ff_layout_prepare_ds.

    Signed-off-by: Fred Isaman
    [dros@primarydata.com: pNFS/flexfiles: fix races in ff_layout_mirror_valid]
    Signed-off-by: Weston Andros Adamson
    Signed-off-by: Trond Myklebust

    Fred Isaman
     

08 Dec, 2016

1 commit


04 Dec, 2016

1 commit


02 Dec, 2016

2 commits


30 Aug, 2016

1 commit

  • If the attempt to connect to a DS fails inside ff_layout_pg_init_read or
    ff_layout_pg_init_write, then we currently end up clearing the layout
    segment carried by the struct nfs_pageio_descriptor, causing an Oops
    when we later call into ff_layout_read_pagelist/ff_layout_write_pagelist.

    The fix is to ensure we return the layout and then retry.

    Fixes: 446ca2195303 ("pNFS/flexfiles: When initing reads or writes, we...")
    Cc: stable@vger.kernel.org # v4.7+
    Signed-off-by: Trond Myklebust

    Trond Myklebust
     

16 Aug, 2016

1 commit

  • Prior to this patch, the retrans value was set at 5, meaning that we
    could see a maximum retransmission timeout value of more than 6 minutes.
    That's a tad high for NFSv3 where the protocol does allow the server to
    drop requests at any time.

    Since this is a data channel, let's just set retrans to 0, and the default
    timeout to 60s. The user can continue to adjust these defaults using the
    dataserver_retrans and dataserver_timeo module parameters.

    Signed-off-by: Trond Myklebust

    Trond Myklebust
     

26 May, 2016

1 commit


18 May, 2016

4 commits


09 May, 2016

3 commits

  • A mirror can be shared between multiple layouts, even with different
    iomodes. That makes stats gathering simpler, but it causes a problem
    when we get different creds in READ vs. RW layouts.

    The current code drops the newer credentials onto the floor when this
    occurs. That's problematic when you fetch a READ layout first, and then
    a RW. If the READ layout doesn't have the correct creds to do a write,
    then writes will fail.

    We could just overwrite the READ credentials with the RW ones, but that
    would break the ability for the server to fence the layout for reads if
    things go awry. We need to be able to revert to the earlier READ creds
    if the RW layout is returned afterward.

    The simplest fix is to just keep two sets of creds per mirror. One for
    READ layouts and one for RW, and then use the appropriate set depending
    on the iomode of the layout segment.

    Also fix up some RCU nits that sparse found.

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

    Jeff Layton
     
  • We're just as likely to have allocation problems here as we would if we
    delay looking up the credential like we currently do. Fix the code to
    get a rpc_cred reference early, as soon as the mirror is set up.

    This allows us to eliminate the mirror early if there is a problem
    getting an rpc credential. This also allows us to drop the uid/gid
    from the layout_mirror struct as well.

    In the event that we find an existing mirror where this one would go, we
    swap in the new creds unconditionally, and drop the reference to the old
    one.

    Note that the old ff_layout_update_mirror_cred function wouldn't set
    this pointer unless the DS version was 3, but we don't know what the DS
    version is at this point. I'm a little unclear on why it did that as you
    still need creds to talk to v4 servers as well. I have the code set
    it regardless of the DS version here.

    Also note the change to using generic creds instead of calling
    lookup_cred directly. With that change, we also need to populate the
    group_info pointer in the acred as some functions expect that to never
    be NULL. Instead of allocating one every time however, we can allocate
    one when the module is loaded and share it since the group_info is
    refcounted.

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

    Jeff Layton
     
  • In later patches, we're going to want to allow the creds to be updated
    when we get a new layout with updated creds. Have this function take
    a reference to the cred that is later put once the call has been
    dispatched.

    Also, prepare for this change by ensuring we follow RCU rules when
    getting a reference to the cred as well.

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

    Jeff Layton