• Aurelien Aptel's avatar
    CIFS: refactor cifs_get_inode_info() · b8f7442b
    Aurelien Aptel authored
    Make logic of cifs_get_inode() much clearer by moving code to sub
    functions and adding comments.
    
    Document the steps this function does.
    
    cifs_get_inode_info() gets and updates a file inode metadata from its
    file path.
    
    * If caller already has raw info data from server they can pass it.
    * If inode already exists (just need to update) caller can pass it.
    
    Step 1: get raw data from server if none was passed
    Step 2: parse raw data into intermediate internal cifs_fattr struct
    Step 3: set fattr uniqueid which is later used for inode number. This
            can sometime be done from raw data
    Step 4: tweak fattr according to mount options (file_mode, acl to mode
            bits, uid, gid, etc)
    Step 5: update or create inode from final fattr struct
    
    * add is_smb1_server() helper
    * add is_inode_cache_good() helper
    * move SMB1-backupcreds-getinfo-retry to separate func
      cifs_backup_query_path_info().
    * move set-uniqueid code to separate func cifs_set_fattr_ino()
    * don't clobber uniqueid from backup cred retry
    * fix some probable corner cases memleaks
    Signed-off-by: default avatarAurelien Aptel <aaptel@suse.com>
    Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
    b8f7442b
inode.c 68.6 KB