Author: sfrench
Date: 2007-02-06 03:20:54 +0000 (Tue, 06 Feb 2007)
New Revision: 96

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=linux-cifs-client&rev=96

Log:
merge with cifs for backlevel kernels git
Now current with mainline fixes up to early December

Modified:
   branches/linux-converged-for-old-kernels/fs/cifs/CHANGES
   branches/linux-converged-for-old-kernels/fs/cifs/file.c
   branches/linux-converged-for-old-kernels/fs/cifs/inode.c
   branches/linux-converged-for-old-kernels/fs/cifs/link.c
   branches/linux-converged-for-old-kernels/fs/cifs/sess.c


Changeset:
Modified: branches/linux-converged-for-old-kernels/fs/cifs/CHANGES
===================================================================
--- branches/linux-converged-for-old-kernels/fs/cifs/CHANGES    2007-02-06 
03:00:26 UTC (rev 95)
+++ branches/linux-converged-for-old-kernels/fs/cifs/CHANGES    2007-02-06 
03:20:54 UTC (rev 96)
@@ -3,7 +3,9 @@
 Support deep tree mounts.  Better support OS/2, Win9x (DOS) time stamps.
 Allow null user to be specified on mount ("username="). Do not return
 EINVAL on readdir when filldir fails due to overwritten blocksize
-(fixes FC problem)
+(fixes FC problem).  Return error in rename 2nd attempt retry (ie report
+if rename by handle also fails, after rename by path fails, we were
+not reporting whether the retry worked or not).
 
 Version 1.45
 ------------

Modified: branches/linux-converged-for-old-kernels/fs/cifs/file.c
===================================================================
--- branches/linux-converged-for-old-kernels/fs/cifs/file.c     2007-02-06 
03:00:26 UTC (rev 95)
+++ branches/linux-converged-for-old-kernels/fs/cifs/file.c     2007-02-06 
03:20:54 UTC (rev 96)
@@ -518,10 +518,14 @@
                                        the struct would be in each open file,
                                        but this should give enough time to 
                                        clear the socket */
-                                       cERROR(1,("close with pending writes"));
+#ifdef CONFIG_CIFS_DEBUG2
+                                       cFYI(1,("close delay, write pending"));
+#endif /* DEBUG2 */
                                        msleep(timeout);
                                        timeout *= 4;
-                               } 
+                               }
+                               if(atomic_read(&pSMBFile->wrtPending))
+                                       cERROR(1,("close with pending writes"));
                                rc = CIFSSMBClose(xid, pTcon,
                                                  pSMBFile->netfid);
                        }

Modified: branches/linux-converged-for-old-kernels/fs/cifs/inode.c
===================================================================
--- branches/linux-converged-for-old-kernels/fs/cifs/inode.c    2007-02-06 
03:00:26 UTC (rev 95)
+++ branches/linux-converged-for-old-kernels/fs/cifs/inode.c    2007-02-06 
03:20:54 UTC (rev 96)
@@ -321,6 +321,7 @@
        struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
        char *tmp_path;
        char *buf = NULL;
+       int adjustTZ = FALSE;
 
        pTcon = cifs_sb->tcon;
        cFYI(1,("Getting info on %s", search_path));
@@ -351,6 +352,7 @@
                                        pfindData, cifs_sb->local_nls, 
                                        cifs_sb->mnt_cifs_flags &
                                          CIFS_MOUNT_MAP_SPECIAL_CHR);
+                       adjustTZ = TRUE;
                }
                
        }
@@ -447,6 +449,10 @@
                inode->i_ctime =
                    cifs_NTtimeToUnix(le64_to_cpu(pfindData->ChangeTime));
                cFYI(0, ("Attributes came in as 0x%x", attr));
+               if(adjustTZ && (pTcon->ses) && (pTcon->ses->server)) {
+                       inode->i_ctime.tv_sec += pTcon->ses->server->timeAdj;
+                       inode->i_mtime.tv_sec += pTcon->ses->server->timeAdj;
+               }
 
                /* set default mode. will override for dirs below */
                if (atomic_read(&cifsInfo->inUse) == 0)
@@ -889,10 +895,14 @@
                        kmalloc(2 * sizeof(FILE_UNIX_BASIC_INFO), GFP_KERNEL);
                if (info_buf_source != NULL) {
                        info_buf_target = info_buf_source + 1;
-                       rc = CIFSSMBUnixQPathInfo(xid, pTcon, fromName,
-                               info_buf_source, cifs_sb_source->local_nls, 
-                               cifs_sb_source->mnt_cifs_flags &
-                                       CIFS_MOUNT_MAP_SPECIAL_CHR);
+                       if (pTcon->ses->capabilities & CAP_UNIX)
+                               rc = CIFSSMBUnixQPathInfo(xid, pTcon, fromName,
+                                       info_buf_source, 
+                                       cifs_sb_source->local_nls,
+                                       cifs_sb_source->mnt_cifs_flags &
+                                               CIFS_MOUNT_MAP_SPECIAL_CHR);
+                       /* else rc is still EEXIST so will fall through to
+                          unlink the target and retry rename */
                        if (rc == 0) {
                                rc = CIFSSMBUnixQPathInfo(xid, pTcon, toName,
                                                info_buf_target,
@@ -941,7 +951,7 @@
                                 cifs_sb_source->mnt_cifs_flags & 
                                        CIFS_MOUNT_MAP_SPECIAL_CHR);
                if (rc==0) {
-                       CIFSSMBRenameOpenFile(xid, pTcon, netfid, toName,
+                       rc = CIFSSMBRenameOpenFile(xid, pTcon, netfid, toName,
                                              cifs_sb_source->local_nls, 
                                              cifs_sb_source->mnt_cifs_flags &
                                                CIFS_MOUNT_MAP_SPECIAL_CHR);
@@ -1094,8 +1104,10 @@
        struct kstat *stat)
 {
        int err = cifs_revalidate(dentry);
-       if (!err)
+       if (!err) {
                generic_fillattr(dentry->d_inode, stat);
+               stat->blksize = CIFS_MAX_MSGSIZE;
+       }
        return err;
 }
 #endif

Modified: branches/linux-converged-for-old-kernels/fs/cifs/link.c
===================================================================
--- branches/linux-converged-for-old-kernels/fs/cifs/link.c     2007-02-06 
03:00:26 UTC (rev 95)
+++ branches/linux-converged-for-old-kernels/fs/cifs/link.c     2007-02-06 
03:20:54 UTC (rev 96)
@@ -72,17 +72,30 @@
                        rc = -EOPNOTSUPP;  
        }
 
-/* if (!rc)     */
-       {
-               /*   renew_parental_timestamps(old_file);
-                  inode->i_nlink++;
-                  mark_inode_dirty(inode);
-                  d_instantiate(direntry, inode); */
-               /* BB add call to either mark inode dirty or refresh its data 
and timestamp to current time */
+       d_drop(direntry);       /* force new lookup from server of target */
+
+       /* if source file is cached (oplocked) revalidate will not go to server
+          until the file is closed or oplock broken so update nlinks locally */
+       if(old_file->d_inode) {
+               cifsInode = CIFS_I(old_file->d_inode);
+               if(rc == 0) {
+                       old_file->d_inode->i_nlink++;
+                       old_file->d_inode->i_ctime = CURRENT_TIME;
+                       /* parent dir timestamps will update from srv
+                       within a second, would it really be worth it
+                       to set the parent dir cifs inode time to zero
+                       to force revalidate (faster) for it too? */
+               }
+               /* if not oplocked will force revalidate to get info 
+                  on source file from srv */
+               cifsInode->time = 0;
+
+                /* Will update parent dir timestamps from srv within a second.
+                  Would it really be worth it to set the parent dir (cifs
+                  inode) time field to zero to force revalidate on parent
+                  directory faster ie 
+                       CIFS_I(inode)->time = 0;  */
        }
-       d_drop(direntry);       /* force new lookup from server */
-       cifsInode = CIFS_I(old_file->d_inode);
-       cifsInode->time = 0;    /* will force revalidate to go get info when 
needed */
 
 cifs_hl_exit:
        kfree(fromName);

Modified: branches/linux-converged-for-old-kernels/fs/cifs/sess.c
===================================================================
--- branches/linux-converged-for-old-kernels/fs/cifs/sess.c     2007-02-06 
03:00:26 UTC (rev 95)
+++ branches/linux-converged-for-old-kernels/fs/cifs/sess.c     2007-02-06 
03:20:54 UTC (rev 96)
@@ -91,7 +91,9 @@
        } */
        /* copy user */
        if(ses->userName == NULL) {
-               /* BB what about null user mounts - check that we do this BB */
+               /* null user mount */
+               *bcc_ptr = 0;
+               *(bcc_ptr+1) = 0;
        } else { /* 300 should be long enough for any conceivable user name */
                bytes_ret = cifs_strtoUCS((__le16 *) bcc_ptr, ses->userName,
                                          300, nls_cp);
@@ -99,10 +101,13 @@
        bcc_ptr += 2 * bytes_ret;
        bcc_ptr += 2; /* account for null termination */
        /* copy domain */
-       if(ses->domainName == NULL)
-               bytes_ret = cifs_strtoUCS((__le16 *) bcc_ptr,
-                                         "CIFS_LINUX_DOM", 32, nls_cp);
-       else
+       if(ses->domainName == NULL) {
+               /* Sending null domain better than using a bogus domain name (as
+               we did briefly in 2.6.18) since server will use its default */
+               *bcc_ptr = 0;
+               *(bcc_ptr+1) = 0;
+               bytes_ret = 0;
+       } else
                bytes_ret = cifs_strtoUCS((__le16 *) bcc_ptr, ses->domainName, 
                                          256, nls_cp);
        bcc_ptr += 2 * bytes_ret;
@@ -145,13 +150,11 @@
 
         /* copy domain */
        
-        if(ses->domainName == NULL) {
-                strcpy(bcc_ptr, "CIFS_LINUX_DOM");
-               bcc_ptr += 14;  /* strlen(CIFS_LINUX_DOM) */
-       } else {
+        if(ses->domainName != NULL) {
                 strncpy(bcc_ptr, ses->domainName, 256); 
                bcc_ptr += strnlen(ses->domainName, 256);
-       }
+       } /* else we will send a null domain name 
+            so the server will default to its own domain */
        *bcc_ptr = 0;
        bcc_ptr++;
 

Reply via email to