diff options
author | Steve French <sfrench@us.ibm.com> | 2008-08-08 21:10:16 +0000 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2008-08-08 21:10:16 +0000 |
commit | ad8b15f0ffc297cdd6c65ef7552b3b8abd11a401 (patch) | |
tree | ee3fedbfb1e3be88898de6297e82f7e89cbac17d /fs/cifs/cifsfs.c | |
parent | 0510eeb7367aca017c6320d04cfd9cbc3b5dd992 (diff) | |
download | linux-3.10-ad8b15f0ffc297cdd6c65ef7552b3b8abd11a401.tar.gz linux-3.10-ad8b15f0ffc297cdd6c65ef7552b3b8abd11a401.tar.bz2 linux-3.10-ad8b15f0ffc297cdd6c65ef7552b3b8abd11a401.zip |
[CIFS] list entry can not return null
Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/cifsfs.c')
-rw-r--r-- | fs/cifs/cifsfs.c | 71 |
1 files changed, 33 insertions, 38 deletions
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 1ec7076f7b2..e8da4ee761b 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c @@ -930,36 +930,34 @@ static int cifs_oplock_thread(void *dummyarg) schedule_timeout(39*HZ); } else { oplock_item = list_entry(GlobalOplock_Q.next, - struct oplock_q_entry, qhead); - if (oplock_item) { - cFYI(1, ("found oplock item to write out")); - pTcon = oplock_item->tcon; - inode = oplock_item->pinode; - netfid = oplock_item->netfid; - spin_unlock(&GlobalMid_Lock); - DeleteOplockQEntry(oplock_item); - /* can not grab inode sem here since it would + struct oplock_q_entry, qhead); + cFYI(1, ("found oplock item to write out")); + pTcon = oplock_item->tcon; + inode = oplock_item->pinode; + netfid = oplock_item->netfid; + spin_unlock(&GlobalMid_Lock); + DeleteOplockQEntry(oplock_item); + /* can not grab inode sem here since it would deadlock when oplock received on delete since vfs_unlink holds the i_mutex across the call */ - /* mutex_lock(&inode->i_mutex);*/ - if (S_ISREG(inode->i_mode)) { - rc = - filemap_fdatawrite(inode->i_mapping); - if (CIFS_I(inode)->clientCanCacheRead - == 0) { - waitrc = filemap_fdatawait(inode->i_mapping); - invalidate_remote_inode(inode); - } - if (rc == 0) - rc = waitrc; - } else - rc = 0; - /* mutex_unlock(&inode->i_mutex);*/ - if (rc) - CIFS_I(inode)->write_behind_rc = rc; - cFYI(1, ("Oplock flush inode %p rc %d", - inode, rc)); + /* mutex_lock(&inode->i_mutex);*/ + if (S_ISREG(inode->i_mode)) { + rc = filemap_fdatawrite(inode->i_mapping); + if (CIFS_I(inode)->clientCanCacheRead == 0) { + waitrc = filemap_fdatawait( + inode->i_mapping); + invalidate_remote_inode(inode); + } + if (rc == 0) + rc = waitrc; + } else + rc = 0; + /* mutex_unlock(&inode->i_mutex);*/ + if (rc) + CIFS_I(inode)->write_behind_rc = rc; + cFYI(1, ("Oplock flush inode %p rc %d", + inode, rc)); /* releasing stale oplock after recent reconnect of smb session using a now incorrect file @@ -967,15 +965,13 @@ static int cifs_oplock_thread(void *dummyarg) not bother sending an oplock release if session to server still is disconnected since oplock already released by the server in that case */ - if (pTcon->tidStatus != CifsNeedReconnect) { - rc = CIFSSMBLock(0, pTcon, netfid, - 0 /* len */ , 0 /* offset */, 0, - 0, LOCKING_ANDX_OPLOCK_RELEASE, - false /* wait flag */); - cFYI(1, ("Oplock release rc = %d", rc)); - } - } else - spin_unlock(&GlobalMid_Lock); + if (pTcon->tidStatus != CifsNeedReconnect) { + rc = CIFSSMBLock(0, pTcon, netfid, + 0 /* len */ , 0 /* offset */, 0, + 0, LOCKING_ANDX_OPLOCK_RELEASE, + false /* wait flag */); + cFYI(1, ("Oplock release rc = %d", rc)); + } set_current_state(TASK_INTERRUPTIBLE); schedule_timeout(1); /* yield in case q were corrupt */ } @@ -1001,8 +997,7 @@ static int cifs_dnotify_thread(void *dummyarg) list_for_each(tmp, &GlobalSMBSessionList) { ses = list_entry(tmp, struct cifsSesInfo, cifsSessionList); - if (ses && ses->server && - atomic_read(&ses->server->inFlight)) + if (ses->server && atomic_read(&ses->server->inFlight)) wake_up_all(&ses->server->response_q); } read_unlock(&GlobalSMBSeslock); |