• Jeff Layton's avatar
    nfs: get a reference to the credential in ff_layout_alloc_lseg · 90a0be00
    Jeff Layton authored
    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: default avatarJeff Layton <jeff.layton@primarydata.com>
    Signed-off-by: default avatarAnna Schumaker <Anna.Schumaker@Netapp.com>
    90a0be00
flexfilelayout.h 5.2 KB