diff options
author | Ronnie Sahlberg <lsahlber@redhat.com> | 2021-03-09 02:07:32 +0300 |
---|---|---|
committer | Steve French <stfrench@microsoft.com> | 2021-04-26 00:28:23 +0300 |
commit | 6ef4e9cbe15df691323af007831dab4e70faa1cf (patch) | |
tree | 7df2b4ea820fe4c8c79897ac8c8d873c2f7d55ee /fs/cifs/smb2ops.c | |
parent | 5e9c89d43fa6f5d458d4d0f9e22a67cc001c8da9 (diff) | |
download | linux-6ef4e9cbe15df691323af007831dab4e70faa1cf.tar.xz |
cifs: add a function to get a cached dir based on its dentry
Needed for subsequent patches in the directory caching
series.
Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs/cifs/smb2ops.c')
-rw-r--r-- | fs/cifs/smb2ops.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c index 5864ef600ee9..65d303466581 100644 --- a/fs/cifs/smb2ops.c +++ b/fs/cifs/smb2ops.c @@ -925,6 +925,22 @@ oshr_free: return rc; } +int open_cached_dir_by_dentry(struct cifs_tcon *tcon, + struct dentry *dentry, + struct cached_fid **cfid) +{ + mutex_lock(&tcon->crfid.fid_mutex); + if (tcon->crfid.dentry == dentry) { + cifs_dbg(FYI, "found a cached root file handle by dentry\n"); + *cfid = &tcon->crfid; + kref_get(&tcon->crfid.refcount); + mutex_unlock(&tcon->crfid.fid_mutex); + return 0; + } + mutex_unlock(&tcon->crfid.fid_mutex); + return -ENOENT; +} + static void smb3_qfs_tcon(const unsigned int xid, struct cifs_tcon *tcon, struct cifs_sb_info *cifs_sb) |