Skip to contentSkip to conversation

cifs: remove "legacy" parm from CIFSSMBQPathInfo

PATCH In review Suresh Jayaraman 3 participants 7 messages Oct 28, 2010 – Oct 29, 2010 5 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cifs: remove "legacy" parm from CIFSSMBQPathInfo

as all the callers are setting it to 0 anyway.

I stumbled upon this code when I was looking at the strange hardlink behavior reported in the mailing list. But it seems this patch was originally posted by Jeff Layton on Feb:
http://lists.samba.org/archive/linux-cifs-client/2010-February/005557.html

I didn't see any discussions, ACK/NACK on this patch.

---
 fs/cifs/cifsproto.h |    1 -
 fs/cifs/cifssmb.c   |   22 +++-------------------
 fs/cifs/connect.c   |    2 +-
 fs/cifs/inode.c     |    1 -
 4 files changed, 4 insertions(+), 22 deletions(-)
fs/cifs/cifsproto.h +0 -1
index edb6d90..fa7e8d1 100644
@@ -167,7 +167,6 @@ extern int CIFSSMBQFileInfo(const int xid, struct cifsTconInfo *tcon,
 extern int CIFSSMBQPathInfo(const int xid, struct cifsTconInfo *tcon,
 			const unsigned char *searchName,
 			FILE_ALL_INFO *findData,
-			int legacy /* whether to use old info level */,
 			const struct nls_table *nls_codepage, int remap);
 extern int SMBQueryInformation(const int xid, struct cifsTconInfo *tcon,
 			const unsigned char *searchName,
fs/cifs/cifssmb.c +3 -19
index e98f1f3..392c01b 100644
@@ -3356,7 +3356,6 @@ int
 CIFSSMBQPathInfo(const int xid, struct cifsTconInfo *tcon,
 		 const unsigned char *searchName,
 		 FILE_ALL_INFO *pFindData,
-		 int legacy /* old style infolevel */,
 		 const struct nls_table *nls_codepage, int remap)
 {
 /* level 263 SMB_QUERY_FILE_ALL_INFO */
@@ -3406,10 +3405,7 @@ QPathInfoRetry:
 	byte_count = params + 1 /* pad */ ;
 	pSMB->TotalParameterCount = cpu_to_le16(params);
 	pSMB->ParameterCount = pSMB->TotalParameterCount;
-	if (legacy)
-		pSMB->InformationLevel = cpu_to_le16(SMB_INFO_STANDARD);
-	else
-		pSMB->InformationLevel = cpu_to_le16(SMB_QUERY_FILE_ALL_INFO);
+	pSMB->InformationLevel = cpu_to_le16(SMB_QUERY_FILE_ALL_INFO);
 	pSMB->Reserved4 = 0;
 	pSMB->hdr.smb_buf_length += byte_count;
 	pSMB->ByteCount = cpu_to_le16(byte_count);
@@ -3423,26 +3419,14 @@ QPathInfoRetry:
 
 		if (rc) /* BB add auto retry on EOPNOTSUPP? */
 			rc = -EIO;
-		else if (!legacy && (pSMBr->ByteCount < 40))
+		else if (pSMBr->ByteCount < 40)
 			rc = -EIO;	/* bad smb */
-		else if (legacy && (pSMBr->ByteCount < 24))
-			rc = -EIO;  /* 24 or 26 expected but we do not read
-					last field */
 		else if (pFindData) {
-			int size;
 			__u16 data_offset = le16_to_cpu(pSMBr->t2.DataOffset);
 
-			/* On legacy responses we do not read the last field,
-			EAsize, fortunately since it varies by subdialect and
-			also note it differs on Set vs. Get, ie two bytes or 4
-			bytes depending but we don't care here */
-			if (legacy)
-				size = sizeof(FILE_INFO_STANDARD);
-			else
-				size = sizeof(FILE_ALL_INFO);
 			memcpy((char *) pFindData,
 			       (char *) &pSMBr->hdr.Protocol +
-			       data_offset, size);
+			       data_offset, sizeof(FILE_ALL_INFO));
 		} else
 		    rc = -ENOMEM;
 	}
fs/cifs/connect.c +1 -1
index 469c3dd..b44bfd5 100644
@@ -2629,7 +2629,7 @@ is_path_accessible(int xid, struct cifsTconInfo *tcon,
 		return -ENOMEM;
 
 	rc = CIFSSMBQPathInfo(xid, tcon, full_path, pfile_info,
-			      0 /* not legacy */, cifs_sb->local_nls,
+			      cifs_sb->local_nls,
 			      cifs_sb->mnt_cifs_flags &
 				CIFS_MOUNT_MAP_SPECIAL_CHR);
 	kfree(pfile_info);
fs/cifs/inode.c +0 -1
index 39869c3..2448ad1 100644
@@ -615,7 +615,6 @@ int cifs_get_inode_info(struct inode **pinode,
 
 		/* could do find first instead but this returns more info */
 		rc = CIFSSMBQPathInfo(xid, pTcon, full_path, pfindData,
-			      0 /* not legacy */,
 			      cifs_sb->local_nls, cifs_sb->mnt_cifs_flags &
 				CIFS_MOUNT_MAP_SPECIAL_CHR);
 		/* BB optimize code so we do not make the above call

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw
Quoted 106 lines · Suresh Jayaraman

as all the callers are setting it to 0 anyway.

I stumbled upon this code when I was looking at the strange hardlink behavior reported in the mailing list. But it seems this patch was originally posted by Jeff Layton on Feb:
 http://lists.samba.org/archive/linux-cifs-client/2010-February/005557.html

I didn't see any discussions, ACK/NACK on this patch.

---
 fs/cifs/cifsproto.h |    1 - fs/cifs/cifssmb.c   |   22 +++------------------- fs/cifs/connect.c   |    2 +- fs/cifs/inode.c     |    1 -

 4 files changed, 4 insertions(+), 22 deletions(-)
fs/cifs/cifsproto.h +0 -1
index edb6d90..fa7e8d1 100644
@@ -167,7 +167,6 @@ extern int CIFSSMBQFileInfo(const int xid, struct cifsTconInfo *tcon,
  extern int CIFSSMBQPathInfo(const int xid, struct cifsTconInfo *tcon,
                        const unsigned char *searchName,
                        FILE_ALL_INFO *findData,
-                       int legacy /* whether to use old info level */,
                        const struct nls_table *nls_codepage, int remap);
  extern int SMBQueryInformation(const int xid, struct cifsTconInfo *tcon,
                        const unsigned char *searchName,
fs/cifs/cifssmb.c +1 -5
index e98f1f3..392c01b 100644
@@ -3356,7 +3356,6 @@ int
  CIFSSMBQPathInfo(const int xid, struct cifsTconInfo *tcon,
                 const unsigned char *searchName,
                 FILE_ALL_INFO *pFindData,
-                int legacy /* old style infolevel */,
                 const struct nls_table *nls_codepage, int remap)
  {
  /* level 263 SMB_QUERY_FILE_ALL_INFO */
@@ -3406,10 +3405,7 @@ QPathInfoRetry:
        byte_count = params + 1 /* pad */ ;
        pSMB->TotalParameterCount = cpu_to_le16(params);
        pSMB->ParameterCount = pSMB->TotalParameterCount;
-       if (legacy)
-               pSMB->InformationLevel = cpu_to_le16(SMB_INFO_STANDARD);
-       else
-               pSMB->InformationLevel = cpu_to_le16(SMB_QUERY_FILE_ALL_INFO);
+       pSMB->InformationLevel = cpu_to_le16(SMB_QUERY_FILE_ALL_INFO);
        pSMB->Reserved4 = 0;
        pSMB->hdr.smb_buf_length += byte_count;
        pSMB->ByteCount = cpu_to_le16(byte_count);
@@ -3423,26 +3419,14 @@ QPathInfoRetry:
 

               if (rc) /* BB add auto retry on EOPNOTSUPP? */
                       rc = -EIO;
-               else if (!legacy && (pSMBr->ByteCount < 40))
+               else if (pSMBr->ByteCount < 40)
                       rc = -EIO;      /* bad smb */
-               else if (legacy && (pSMBr->ByteCount < 24))
-                       rc = -EIO;  /* 24 or 26 expected but we do not read
-                                       last field */
               else if (pFindData) {
-                       int size;
                       __u16 data_offset = le16_to_cpu(pSMBr->t2.DataOffset);

-                       /* On legacy responses we do not read the last field,
-                       EAsize, fortunately since it varies by subdialect and
-                       also note it differs on Set vs. Get, ie two bytes or 4
-                       bytes depending but we don't care here */
-                       if (legacy)
-                               size = sizeof(FILE_INFO_STANDARD);
-                       else
-                               size = sizeof(FILE_ALL_INFO); memcpy((char *) pFindData,
                              (char *) &pSMBr->hdr.Protocol +
-                              data_offset, size);
+                              data_offset, sizeof(FILE_ALL_INFO)); } else
                   rc = -ENOMEM;
       }

fs/cifs/connect.c +1 -1
index 469c3dd..b44bfd5 100644
@@ -2629,7 +2629,7 @@ is_path_accessible(int xid, struct cifsTconInfo *tcon,
                return -ENOMEM;
 
        rc = CIFSSMBQPathInfo(xid, tcon, full_path, pfile_info,
-                             0 /* not legacy */, cifs_sb->local_nls,
+                             cifs_sb->local_nls,

                             cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); kfree(pfile_info);

fs/cifs/inode.c +0 -1
index 39869c3..2448ad1 100644
@@ -615,7 +615,6 @@ int cifs_get_inode_info(struct inode **pinode,
 
                /* could do find first instead but this returns more info */
                rc = CIFSSMBQPathInfo(xid, pTcon, full_path, pfindData,
-                             0 /* not legacy */,
Quoted 8 lines

                             cifs_sb->local_nls, cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
               /* BB optimize code so we do not make the above call --
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in the body of a message to [email protected] More majordomo info at  http://vger.kernel.org/majordomo-info.html

Looks correct to me.

#3 lore raw
In reply to a message not in the archive

What is the code flow then on Windows9x, OS/2 or in the EOPNOSUPP case? Seems strange that we don't retry with legacy or in the case where the dialect (or previous call) shows that we don't support the infolevel.

Quoted 110 lines · Suresh Jayaraman

as all the callers are setting it to 0 anyway.

I stumbled upon this code when I was looking at the strange hardlink behavior reported in the mailing list. But it seems this patch was originally posted by Jeff Layton on Feb:
 http://lists.samba.org/archive/linux-cifs-client/2010-February/005557.html

I didn't see any discussions, ACK/NACK on this patch.

---
 fs/cifs/cifsproto.h |    1 - fs/cifs/cifssmb.c   |   22 +++------------------- fs/cifs/connect.c   |    2 +- fs/cifs/inode.c     |    1 -

 4 files changed, 4 insertions(+), 22 deletions(-)
fs/cifs/cifsproto.h +0 -1
index edb6d90..fa7e8d1 100644
@@ -167,7 +167,6 @@ extern int CIFSSMBQFileInfo(const int xid, struct cifsTconInfo *tcon,
  extern int CIFSSMBQPathInfo(const int xid, struct cifsTconInfo *tcon,
                        const unsigned char *searchName,
                        FILE_ALL_INFO *findData,
-                       int legacy /* whether to use old info level */,
                        const struct nls_table *nls_codepage, int remap);
  extern int SMBQueryInformation(const int xid, struct cifsTconInfo *tcon,
                        const unsigned char *searchName,
fs/cifs/cifssmb.c +1 -5
index e98f1f3..392c01b 100644
@@ -3356,7 +3356,6 @@ int
  CIFSSMBQPathInfo(const int xid, struct cifsTconInfo *tcon,
                 const unsigned char *searchName,
                 FILE_ALL_INFO *pFindData,
-                int legacy /* old style infolevel */,
                 const struct nls_table *nls_codepage, int remap)
  {
  /* level 263 SMB_QUERY_FILE_ALL_INFO */
@@ -3406,10 +3405,7 @@ QPathInfoRetry:
        byte_count = params + 1 /* pad */ ;
        pSMB->TotalParameterCount = cpu_to_le16(params);
        pSMB->ParameterCount = pSMB->TotalParameterCount;
-       if (legacy)
-               pSMB->InformationLevel = cpu_to_le16(SMB_INFO_STANDARD);
-       else
-               pSMB->InformationLevel = cpu_to_le16(SMB_QUERY_FILE_ALL_INFO);
+       pSMB->InformationLevel = cpu_to_le16(SMB_QUERY_FILE_ALL_INFO);
        pSMB->Reserved4 = 0;
        pSMB->hdr.smb_buf_length += byte_count;
        pSMB->ByteCount = cpu_to_le16(byte_count);
@@ -3423,26 +3419,14 @@ QPathInfoRetry:
 

               if (rc) /* BB add auto retry on EOPNOTSUPP? */
                       rc = -EIO;
-               else if (!legacy && (pSMBr->ByteCount < 40))
+               else if (pSMBr->ByteCount < 40)
                       rc = -EIO;      /* bad smb */
-               else if (legacy && (pSMBr->ByteCount < 24))
-                       rc = -EIO;  /* 24 or 26 expected but we do not read
-                                       last field */
               else if (pFindData) {
-                       int size;
                       __u16 data_offset = le16_to_cpu(pSMBr->t2.DataOffset);

-                       /* On legacy responses we do not read the last field,
-                       EAsize, fortunately since it varies by subdialect and
-                       also note it differs on Set vs. Get, ie two bytes or 4
-                       bytes depending but we don't care here */
-                       if (legacy)
-                               size = sizeof(FILE_INFO_STANDARD);
-                       else
-                               size = sizeof(FILE_ALL_INFO); memcpy((char *) pFindData,
                              (char *) &pSMBr->hdr.Protocol +
-                              data_offset, size);
+                              data_offset, sizeof(FILE_ALL_INFO)); } else
                   rc = -ENOMEM;
       }

fs/cifs/connect.c +1 -1
index 469c3dd..b44bfd5 100644
@@ -2629,7 +2629,7 @@ is_path_accessible(int xid, struct cifsTconInfo *tcon,
                return -ENOMEM;
 
        rc = CIFSSMBQPathInfo(xid, tcon, full_path, pfile_info,
-                             0 /* not legacy */, cifs_sb->local_nls,
+                             cifs_sb->local_nls,

                             cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); kfree(pfile_info);

fs/cifs/inode.c +0 -1
index 39869c3..2448ad1 100644
@@ -615,7 +615,6 @@ int cifs_get_inode_info(struct inode **pinode,
 
                /* could do find first instead but this returns more info */
                rc = CIFSSMBQPathInfo(xid, pTcon, full_path, pfindData,
-                             0 /* not legacy */,

                             cifs_sb->local_nls, cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
               /* BB optimize code so we do not make the above call

Signature · 3 lines
Thanks,

Steve

A message that is not in the archive (sent off-list or not yet received): AANLkTikpemR3PVzXSimbu-b1zn4QwQj+0VAEM9xwgYqt-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#5 lore raw
Quoted 5 lines · Steve French

What is the code flow then on Windows9x, OS/2 or in the EOPNOSUPP case? Seems strange that we don't retry with legacy or in the case where the dialect (or previous call) shows that we don't support the infolevel.

If CIFSSMBOpen fails, the callers seem to be fall back to legacy open using SMBLegacyOpen().

cifs_open()

       ...
        if (tcon->ses->capabilities & CAP_NT_SMBS)
                rc = CIFSSMBOpen(xid, tcon, full_path, disposition,
                         desiredAccess, CREATE_NOT_DIR, &netfid, &oplock, buf,
                         cifs_sb->local_nls, cifs_sb->mnt_cifs_flags
                                 & CIFS_MOUNT_MAP_SPECIAL_CHR);
        else
                rc = -EIO; /* no NT SMB support fall into legacy open below */
                
        if (rc == -EIO) {
                /* Old server, try legacy style OpenX */
                rc = SMBLegacyOpen(xid, tcon, full_path, disposition,
                        desiredAccess, CREATE_NOT_DIR, &netfid, &oplock, buf,
                        cifs_sb->local_nls, cifs_sb->mnt_cifs_flags
                                & CIFS_MOUNT_MAP_SPECIAL_CHR);
        }
Signature · 1 line
Suresh Jayaraman

A message that is not in the archive (sent off-list or not yet received): [email protected]

#7 lore raw
Quoted 31 lines · Suresh Jayaraman
Quoted 5 lines · Steve French

What is the code flow then on Windows9x, OS/2 or in the EOPNOSUPP case?  Seems strange that we don't retry with legacy or in the case where the dialect (or previous call) shows that we don't support the infolevel.

If CIFSSMBOpen fails, the callers seem to be fall back to legacy open using SMBLegacyOpen().

cifs_open()

      ...
       if (tcon->ses->capabilities & CAP_NT_SMBS)
               rc = CIFSSMBOpen(xid, tcon, full_path, disposition, desiredAccess, CREATE_NOT_DIR, &netfid, &oplock, buf, cifs_sb->local_nls, cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); else
               rc = -EIO; /* no NT SMB support fall into legacy open below */

       if (rc == -EIO) {
               /* Old server, try legacy style OpenX */
               rc = SMBLegacyOpen(xid, tcon, full_path, disposition, desiredAccess, CREATE_NOT_DIR, &netfid, &oplock, buf, cifs_sb->local_nls, cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
       }

Quoted 7 lines

--
Suresh Jayaraman
--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in the body of a message to [email protected] More majordomo info at  http://vger.kernel.org/majordomo-info.html

This is a general comment but should cifs client be using (server) dialect specific set of smb commands
and those smb commands specific info levels instead of sending a command and trying downlevel / legacy
if that command failed with "operation not supported"?

A message that is not in the archive (sent off-list or not yet received): AANLkTinOsN05m0qM56poq2Q5d6Jss6b3ZnpEXc9Z_4cV-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#9 lore raw
Quoted 40 lines · Shirish Pargaonkar
Quoted 31 lines · Suresh Jayaraman
Quoted 5 lines · Steve French

What is the code flow then on Windows9x, OS/2 or in the EOPNOSUPP case?  Seems strange that we don't retry with legacy or in the case where the dialect (or previous call) shows that we don't support the infolevel.

If CIFSSMBOpen fails, the callers seem to be fall back to legacy open using SMBLegacyOpen().

cifs_open()

      ...
       if (tcon->ses->capabilities & CAP_NT_SMBS)
               rc = CIFSSMBOpen(xid, tcon, full_path, disposition, desiredAccess, CREATE_NOT_DIR, &netfid, &oplock, buf, cifs_sb->local_nls, cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); else
               rc = -EIO; /* no NT SMB support fall into legacy open below */

       if (rc == -EIO) {
               /* Old server, try legacy style OpenX */
               rc = SMBLegacyOpen(xid, tcon, full_path, disposition, desiredAccess, CREATE_NOT_DIR, &netfid, &oplock, buf, cifs_sb->local_nls, cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
       }

Quoted 7 lines

--
Suresh Jayaraman
--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in the body of a message to [email protected] More majordomo info at  http://vger.kernel.org/majordomo-info.html

Quoted 5 lines

This is a general comment but should cifs client be using (server) dialect specific set of smb commands
and those smb commands specific info levels instead of sending a command and trying downlevel / legacy
if that command failed with "operation not supported"?

We can do the former for smb2, but not for cifs unfortunately.

For cifs there are lots of cases where a dialect doesn't support an
infolevel it should (or even viceversa). Part of this difficulty
mapping levels to dialects is presumably due to lack of authoritative documentation for cifs when some of the server developers were doing initial cifs development years ago - even so there are cases where we can make assumptions (based on feedback from 7 years of test events) but it depends on the operation.

Signature · 3 lines
Thanks,

Steve

A message that is not in the archive (sent off-list or not yet received): AANLkTimoCvWFbYj+TfCFA-nqd6H=8DTN_e-dw8Hoo_7g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#11 lore raw
Quoted 37 lines · Steve French
Quoted 29 lines · Shirish Pargaonkar
Quoted 20 lines · Suresh Jayaraman
Quoted 4 lines · Steve French

What is the code flow then on Windows9x, OS/2 or in the EOPNOSUPP case? �Seems strange that we don't retry with legacy or in the case where the dialect (or previous call) shows that we don't support the infolevel.

If CIFSSMBOpen fails, the callers seem to be fall back to legacy open using SMBLegacyOpen().

cifs_open()

� � � ...
� � � �if (tcon->ses->capabilities & CAP_NT_SMBS)
� � � � � � � �rc = CIFSSMBOpen(xid, tcon, full_path, disposition, � � � � � � � � � � � � desiredAccess, CREATE_NOT_DIR, &netfid, &oplock, buf, � � � � � � � � � � � � cifs_sb->local_nls, cifs_sb->mnt_cifs_flags � � � � � � � � � � � � � � � � & CIFS_MOUNT_MAP_SPECIAL_CHR);
� � � �else
� � � � � � � �rc = -EIO; /* no NT SMB support fall into legacy open below */

Quoted 8 lines

� � � �if (rc == -EIO) {
� � � � � � � �/* Old server, try legacy style OpenX */
� � � � � � � �rc = SMBLegacyOpen(xid, tcon, full_path, disposition, � � � � � � � � � � � �desiredAccess, CREATE_NOT_DIR, &netfid, &oplock, buf, � � � � � � � � � � � �cifs_sb->local_nls, cifs_sb->mnt_cifs_flags � � � � � � � � � � � � � � � �& CIFS_MOUNT_MAP_SPECIAL_CHR);
� � � �}

Quoted 5 lines

This is a general comment but should cifs client be using (server) dialect specific set of smb commands
and those smb commands specific info levels instead of sending a command and trying downlevel / legacy
if that command failed with "operation not supported"?

Quoted 4 lines

We can do the former for smb2, but not for cifs unfortunately.

For cifs there are lots of cases where a dialect doesn't support an infolevel it should (or even viceversa).

So that means this patch is applicable to CIFS as is, right?

Signature · 1 line
Suresh Jayaraman