Merge tag '5.15-rc-cifs-part2' of git://git.samba.org/sfrench/cifs-2.6
[linux-2.6-microblaze.git] / fs / cifs / smb2ops.c
index ddc0e8f..bda606d 100644 (file)
@@ -689,13 +689,19 @@ smb2_close_cached_fid(struct kref *ref)
                cifs_dbg(FYI, "clear cached root file handle\n");
                SMB2_close(0, cfid->tcon, cfid->fid->persistent_fid,
                           cfid->fid->volatile_fid);
-               cfid->is_valid = false;
-               cfid->file_all_info_is_valid = false;
-               cfid->has_lease = false;
-               if (cfid->dentry) {
-                       dput(cfid->dentry);
-                       cfid->dentry = NULL;
-               }
+       }
+
+       /*
+        * We only check validity above to send SMB2_close,
+        * but we still need to invalidate these entries
+        * when this function is called
+        */
+       cfid->is_valid = false;
+       cfid->file_all_info_is_valid = false;
+       cfid->has_lease = false;
+       if (cfid->dentry) {
+               dput(cfid->dentry);
+               cfid->dentry = NULL;
        }
 }