RHBZ: 1994393 If we hit a STATUS_USER_SESSION_DELETED for the Create part in the Create/QueryDirectory compound that starts a directory scan we will leak EDEADLK back to userspace and surprise glibc and the application. Pick this up cifs_readdir() and retry a small number of tries before we return an error to userspace. Signed-off-by: Ronnie Sahlberg <lsahlber@xxxxxxxxxx> --- fs/cifs/readdir.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c index bfee176b901d..56e5d456366d 100644 --- a/fs/cifs/readdir.c +++ b/fs/cifs/readdir.c @@ -930,6 +930,7 @@ int cifs_readdir(struct file *file, struct dir_context *ctx) unsigned int max_len; const char *full_path; void *page = alloc_dentry_path(); + int retry_count = 0; xid = get_xid(); @@ -944,8 +945,15 @@ int cifs_readdir(struct file *file, struct dir_context *ctx) * '..'. Otherwise we won't be able to notify VFS in case of failure. */ if (file->private_data == NULL) { + again: rc = initiate_cifs_search(xid, file, full_path); - cifs_dbg(FYI, "initiate cifs search rc %d\n", rc); + if (rc == -EDEADLK && retry_count++ < 5) { + /* + * We don't have enough credits to start reading the + * directory so just try again. + */ + goto again; + } if (rc) goto rddir2_exit; } -- 2.30.2