Skip to content

Commit

Permalink
CIFS: Fix mounts if the client is low on credits
Browse files Browse the repository at this point in the history
If the server doesn't grant us at least 3 credits during the mount
we won't be able to complete it because query path info operation
requires 3 credits. Use the cached file handle if possible to allow
the mount to succeed.

Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
Reviewed-by: Ronnie Sahlberg <lsahlber@redhat.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
  • Loading branch information
Pavel Shilovsky authored and Steve French committed Jan 24, 2019
1 parent 0fd1d37 commit 6a9cbdd
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions fs/cifs/smb2inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,8 @@ smb2_query_path_info(const unsigned int xid, struct cifs_tcon *tcon,
int rc;
struct smb2_file_all_info *smb2_data;
__u32 create_options = 0;
struct cifs_fid fid;
bool no_cached_open = tcon->nohandlecache;

*adjust_tz = false;
*symlink = false;
Expand All @@ -301,6 +303,21 @@ smb2_query_path_info(const unsigned int xid, struct cifs_tcon *tcon,
GFP_KERNEL);
if (smb2_data == NULL)
return -ENOMEM;

/* If it is a root and its handle is cached then use it */
if (!strlen(full_path) && !no_cached_open) {
rc = open_shroot(xid, tcon, &fid);
if (rc)
goto out;
rc = SMB2_query_info(xid, tcon, fid.persistent_fid,
fid.volatile_fid, smb2_data);
close_shroot(&tcon->crfid);
if (rc)
goto out;
move_smb2_info_to_cifs(data, smb2_data);
goto out;
}

if (backup_cred(cifs_sb))
create_options |= CREATE_OPEN_BACKUP_INTENT;

Expand Down

0 comments on commit 6a9cbdd

Please sign in to comment.