cifs: use workqueue instead of slow-work
Workqueue can now handle high concurrency. Use system_nrt_wq instead of slow-work. * Updated is_valid_oplock_break() to not call cifs_oplock_break_put() as advised by Steve French. It might cause deadlock. Instead, reference is increased after queueing succeeded and cifs_oplock_break() briefly grabs GlobalSMBSeslock before putting the cfile to make sure it doesn't put before the matching get is finished. * Anton Blanchard reported that cifs conversion was using now gone system_single_wq. Use system_nrt_wq which provides non-reentrance guarantee which is enough and much better. Signed-off-by: Tejun Heo <tj@kernel.org> Acked-by: Steve French <sfrench@samba.org> Cc: Anton Blanchard <anton@samba.org>
This commit is contained in:
@@ -498,7 +498,6 @@ is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv)
|
||||
struct cifsTconInfo *tcon;
|
||||
struct cifsInodeInfo *pCifsInode;
|
||||
struct cifsFileInfo *netfile;
|
||||
int rc;
|
||||
|
||||
cFYI(1, "Checking for oplock break or dnotify response");
|
||||
if ((pSMB->hdr.Command == SMB_COM_NT_TRANSACT) &&
|
||||
@@ -583,13 +582,18 @@ is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv)
|
||||
pCifsInode->clientCanCacheAll = false;
|
||||
if (pSMB->OplockLevel == 0)
|
||||
pCifsInode->clientCanCacheRead = false;
|
||||
rc = slow_work_enqueue(&netfile->oplock_break);
|
||||
if (rc) {
|
||||
cERROR(1, "failed to enqueue oplock "
|
||||
"break: %d\n", rc);
|
||||
} else {
|
||||
netfile->oplock_break_cancelled = false;
|
||||
}
|
||||
|
||||
/*
|
||||
* cifs_oplock_break_put() can't be called
|
||||
* from here. Get reference after queueing
|
||||
* succeeded. cifs_oplock_break() will
|
||||
* synchronize using GlobalSMSSeslock.
|
||||
*/
|
||||
if (queue_work(system_nrt_wq,
|
||||
&netfile->oplock_break))
|
||||
cifs_oplock_break_get(netfile);
|
||||
netfile->oplock_break_cancelled = false;
|
||||
|
||||
read_unlock(&GlobalSMBSeslock);
|
||||
read_unlock(&cifs_tcp_ses_lock);
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user