[PATCH] cifs: fix server returning zeroed out FileID's in SMB_FIND_FILE_ID_FULL_DIR_INFO

View: New views
2 Messages — Rating Filter:   Alert me  

[PATCH] cifs: fix server returning zeroed out FileID's in SMB_FIND_FILE_ID_FULL_DIR_INFO

by Jeff Layton-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

It's possible that a server will return a valid FileID when we query the
FILE_INTERNAL_INFO for the root inode, but then zeroed out inode numbers
when we do a FindFile with an infolevel of
SMB_FIND_FILE_ID_FULL_DIR_INFO.

In this situation turn off querying for server inode numbers, and just
generate an inode number using iunique.

While I've given this patch to the reporter and asked him to test it, he
hasn't yet come back with the results. So I can't confirm whether this
really fixes the problem or not. I expect that it will, but I'll
understand if you'd rather wait to commit this until we have
confirmation.

Reported-by: Timothy Normand Miller <theosib@...>
Signed-off-by: Jeff Layton <jlayton@...>
---
 fs/cifs/readdir.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c
index 1f098ca..bafef8b 100644
--- a/fs/cifs/readdir.c
+++ b/fs/cifs/readdir.c
@@ -727,11 +727,13 @@ static int cifs_filldir(char *pfindEntry, struct file *file, filldir_t filldir,
  cifs_dir_info_to_fattr(&fattr, (FILE_DIRECTORY_INFO *)
  pfindEntry, cifs_sb);
 
- /* FIXME: make _to_fattr functions fill this out */
- if (pCifsF->srch_inf.info_level == SMB_FIND_FILE_ID_FULL_DIR_INFO)
+ if (inum) {
  fattr.cf_uniqueid = inum;
- else
+ } else {
  fattr.cf_uniqueid = iunique(sb, ROOT_I);
+ if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM)
+ cifs_sb->mnt_cifs_flags &= ~CIFS_MOUNT_SERVER_INUM;
+ }
 
  ino = cifs_uniqueid_to_ino_t(fattr.cf_uniqueid);
  tmp_dentry = cifs_readdir_lookup(file->f_dentry, &qstring, &fattr);
--
1.6.0.6

_______________________________________________
linux-cifs-client mailing list
linux-cifs-client@...
https://lists.samba.org/mailman/listinfo/linux-cifs-client

[PATCH] cifs: don't use CIFSGetSrvInodeNumber in is_path_accessible

by Jeff Layton-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Because it's lighter weight, CIFS tries to do a QPathInfo call with an
infolevel of SMB_QUERY_FILE_INTERNAL_INFO to verify the accessibility of
the root inode. It then falls back to using an infolevel of
SMB_QUERY_FILE_ALL_INFO if that fails with -EOPNOTSUPP.

There's a problem however. SMB_QUERY_FILE_INTERNAL_INFO isn't as well
supported by all servers as SMB_QUERY_FILE_ALL_INFO is, and the error
returns from those servers aren't well standardized. I have at least one
report of a server that returns NT_STATUS_INTERNAL_ERROR (which
translates to EIO) rather than something that translates to EOPNOTSUPP.

Given that that function only gets called at mount time, I think it's
better to do this as simply as possible. Rather than trying to be
clever, just have is_path_accessible use SMB_QUERY_FILE_ALL_INFO. That
call is widely supported and it shouldn't increase the overhead
significantly.

Unfortunately, the reporter of this problem doesn't seem to be in a
hurry to test it, so I don't have any test results from it. Given what I
see in the captures though, I expect that this will fix the problem.

Signed-off-by: Jeff Layton <jlayton@...>
---
 fs/cifs/connect.c |    8 --------
 1 files changed, 0 insertions(+), 8 deletions(-)

diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index b090980..63ea83f 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -2220,16 +2220,8 @@ is_path_accessible(int xid, struct cifsTconInfo *tcon,
    struct cifs_sb_info *cifs_sb, const char *full_path)
 {
  int rc;
- __u64 inode_num;
  FILE_ALL_INFO *pfile_info;
 
- rc = CIFSGetSrvInodeNumber(xid, tcon, full_path, &inode_num,
-   cifs_sb->local_nls,
-   cifs_sb->mnt_cifs_flags &
- CIFS_MOUNT_MAP_SPECIAL_CHR);
- if (rc != -EOPNOTSUPP)
- return rc;
-
  pfile_info = kmalloc(sizeof(FILE_ALL_INFO), GFP_KERNEL);
  if (pfile_info == NULL)
  return -ENOMEM;
--
1.6.0.6

_______________________________________________
linux-cifs-client mailing list
linux-cifs-client@...
https://lists.samba.org/mailman/listinfo/linux-cifs-client