*/
 
 static int
-initiate_cifs_search(const unsigned int xid, struct file *file,
+_initiate_cifs_search(const unsigned int xid, struct file *file,
                     const char *full_path)
 {
        __u16 search_flags;
        return rc;
 }
 
+static int
+initiate_cifs_search(const unsigned int xid, struct file *file,
+                    const char *full_path)
+{
+       int rc, retry_count = 0;
+
+       do {
+               rc = _initiate_cifs_search(xid, file, full_path);
+               /*
+                * If we don't have enough credits to start reading the
+                * directory just try again after short wait.
+                */
+               if (rc != -EDEADLK)
+                       break;
+
+               usleep_range(512, 2048);
+       } while (retry_count++ < 5);
+
+       return rc;
+}
+
 /* return length of unicode string in bytes */
 static int cifs_unicode_bytelen(const char *str)
 {