diff options
author | Enzo Matsumiya <ematsumiya@suse.de> | 2025-02-06 12:17:37 -0300 |
---|---|---|
committer | Enzo Matsumiya <ematsumiya@suse.de> | 2025-02-06 12:17:37 -0300 |
commit | 35994ab1501217e5d8cfc7ff60a574a5964dbeea (patch) | |
tree | 606ea087dfc237b2f7f6ac69f9032809f5fb934a /fs/smb/client/smb2inode.c | |
parent | 695a21286916342240d02c80900e9b1ab12d0776 (diff) | |
download | linux-35994ab1501217e5d8cfc7ff60a574a5964dbeea.tar.gz linux-35994ab1501217e5d8cfc7ff60a574a5964dbeea.tar.bz2 linux-35994ab1501217e5d8cfc7ff60a574a5964dbeea.zip |
smb: client: fix cfid (cont, WIP)cached
Signed-off-by: Enzo Matsumiya <ematsumiya@suse.de>
Diffstat (limited to 'fs/smb/client/smb2inode.c')
-rw-r--r-- | fs/smb/client/smb2inode.c | 49 |
1 files changed, 1 insertions, 48 deletions
diff --git a/fs/smb/client/smb2inode.c b/fs/smb/client/smb2inode.c index 7fc393d55903..d7e7842aa7aa 100644 --- a/fs/smb/client/smb2inode.c +++ b/fs/smb/client/smb2inode.c @@ -889,45 +889,23 @@ int smb2_query_path_info(const unsigned int xid, if (*full_path) { rc = -ENOENT; } else { - rc = 0; - cfid = find_cached_dir(tcon, full_path); + cfid = open_cached_dir(xid, tcon, full_path, cifs_sb); if (IS_ERR(cfid)) { rc = PTR_ERR(cfid); cfid = NULL; } } - pr_err("%s: path=%s, cfid=%p, rc=%d\n", __func__, full_path, cfid, rc); - /* If it is a root and its handle is cached then use it */ if (!rc) { - spin_lock(&cfid->lock); - pr_err("%s: cfid path=%s, dentry=%pd, info=%s, valid=%d\n", __func__, - cfid->path, cfid->dentry, cfid->info.FileName, cfid->info_valid); - if (cfid->info_valid) { memcpy(&data->fi, &cfid->info, sizeof(data->fi)); - spin_unlock(&cfid->lock); } else { - u64 pfid, vfid; - - pfid = cfid->fid.persistent_fid; - vfid = cfid->fid.volatile_fid; - memset(&cfid->info, 0, sizeof(cfid->info)); - spin_unlock(&cfid->lock); - rc = SMB2_query_info(xid, tcon, cfid->fid.persistent_fid, cfid->fid.volatile_fid, &data->fi); - if (!rc) { - spin_lock(&cfid->lock); - memcpy(&cfid->info, &data->fi, sizeof(data->fi)); - cfid->info_valid = true; - spin_unlock(&cfid->lock); - } } - close_cached_dir(cfid); return rc; } @@ -958,17 +936,6 @@ int smb2_query_path_info(const unsigned int xid, switch (rc) { case 0: rc = parse_create_response(data, cifs_sb, full_path, &out_iov[0]); - if (!rc && !cfid) { - struct smb2_create_rsp *rsp = out_iov[0].iov_base; - struct cifs_fid fid = { - .persistent_fid = rsp->PersistentFileId, - .volatile_fid = rsp->VolatileFileId, - .access = oparms.desired_access, - // what else is needed for a cfid? - }; - - add_cached_dir(cifs_sb, tcon, full_path, &fid, &data->fi); - } break; case -EOPNOTSUPP: /* @@ -997,20 +964,6 @@ int smb2_query_path_info(const unsigned int xid, rc = smb2_compound_op(xid, tcon, cifs_sb, full_path, &oparms, in_iov, cmds, num_cmds, cfile, NULL, NULL, NULL); - - if (!rc && !cfid) { - struct smb2_create_rsp *rsp = out_iov[0].iov_base; - struct cifs_fid fid = { - .persistent_fid = rsp->PersistentFileId, - .volatile_fid = rsp->VolatileFileId, - .access = oparms.desired_access, - // what else is needed for a cfid? - }; - - pr_err("%s: cfile=%p\n", __func__, cfile); - - add_cached_dir(cifs_sb, tcon, full_path, &fid, &data->fi); - } break; case -EREMOTE: break; |