[CIFS] Fix oops in cifs_close due to unitialized lock sem and list in
authorSteve French <sfrench@us.ibm.com>
Tue, 15 Aug 2006 13:07:18 +0000 (13:07 +0000)
committerSteve French <sfrench@us.ibm.com>
Tue, 15 Aug 2006 13:07:18 +0000 (13:07 +0000)
new POSIX locking code

Signed-off-by: Steve French <sfrench@us.ibm.com>
fs/cifs/CHANGES
fs/cifs/connect.c
fs/cifs/dir.c

index acb843b9bc3b7aca67cbc3343190ff16cf50f235..bd37727526eafa81718bd03fd99d2a1efa5455d3 100644 (file)
@@ -2,7 +2,10 @@ Version 1.45
 ------------
 Do not time out lockw calls when using posix extensions. Do not
 time out requests if server still responding reasonably fast
-on requests on other threads
+on requests on other threads.  Improve POSIX locking emulation,
+(lock cancel now works, and unlock of merged range works even
+to Windows servers now).  Fix oops on mount to lanman servers
+(win9x, os/2 etc.) when null password.
 
 Version 1.44
 ------------
index b706b4f48b107bb328cdc49b0a4fba498cbfd841..5d394c726860740316e6fb96172aeccc888d6214 100644 (file)
@@ -1271,33 +1271,35 @@ find_unc(__be32 new_target_ip_addr, char *uncName, char *userName)
 
        read_lock(&GlobalSMBSeslock);
        list_for_each(tmp, &GlobalTreeConnectionList) {
-               cFYI(1, ("Next tcon - "));
+               cFYI(1, ("Next tcon"));
                tcon = list_entry(tmp, struct cifsTconInfo, cifsConnectionList);
                if (tcon->ses) {
                        if (tcon->ses->server) {
                                cFYI(1,
-                                    (" old ip addr: %x == new ip %x ?",
+                                    ("old ip addr: %x == new ip %x ?",
                                      tcon->ses->server->addr.sockAddr.sin_addr.
                                      s_addr, new_target_ip_addr));
                                if (tcon->ses->server->addr.sockAddr.sin_addr.
                                    s_addr == new_target_ip_addr) {
-       /* BB lock tcon and server and tcp session and increment use count here? */
+       /* BB lock tcon, server and tcp session and increment use count here? */
                                        /* found a match on the TCP session */
                                        /* BB check if reconnection needed */
-                                       cFYI(1,("Matched ip, old UNC: %s == new: %s ?",
+                                       cFYI(1,("IP match, old UNC: %s new: %s",
                                              tcon->treeName, uncName));
                                        if (strncmp
                                            (tcon->treeName, uncName,
                                             MAX_TREE_SIZE) == 0) {
                                                cFYI(1,
-                                                    ("Matched UNC, old user: %s == new: %s ?",
+                                                    ("and old usr: %s new: %s",
                                                      tcon->treeName, uncName));
                                                if (strncmp
                                                    (tcon->ses->userName,
                                                     userName,
                                                     MAX_USERNAME_SIZE) == 0) {
                                                        read_unlock(&GlobalSMBSeslock);
-                                                       return tcon;/* also matched user (smb session)*/
+                                                       /* matched smb session
+                                                       (user name */
+                                                       return tcon;
                                                }
                                        }
                                }
index ba4cbe9b0684dd0a6ae66d65f8486462ab80e778..914239d53634dce734a66a1a2ceee6aa8a00f854 100644 (file)
@@ -267,6 +267,10 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
                        pCifsFile->invalidHandle = FALSE;
                        pCifsFile->closePend     = FALSE;
                        init_MUTEX(&pCifsFile->fh_sem);
+                       init_MUTEX(&pCifsFile->lock_sem);
+                       INIT_LIST_HEAD(&pCifsFile->llist);
+                       atomic_set(&pCifsFile->wrtPending,0);
+
                        /* set the following in open now 
                                pCifsFile->pfile = file; */
                        write_lock(&GlobalSMBSeslock);