aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/cifsglob.h
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2011-01-11 07:24:21 -0500
committerSteve French <sfrench@us.ibm.com>2011-01-20 12:43:59 -0500
commit2b84a36c5529da136d28b268e75268892d09869c (patch)
tree7977fad1c4a8ae8926184c00a3e7ccd30b398e5e /fs/cifs/cifsglob.h
parent74dd92a881b62014ca3c754db6868e1f142f2fb9 (diff)
cifs: allow for different handling of received response
In order to incorporate async requests, we need to allow for a more general way to do things on receive, rather than just waking up a process. Turn the task pointer in the mid_q_entry into a callback function and a generic data pointer. When a response comes in, or the socket is reconnected, cifsd can call the callback function in order to wake up the process. The default is to just wake up the current process which should mean no change in behavior for existing code. Also, clean up the locking in cifs_reconnect. There doesn't seem to be any need to hold both the srv_mutex and GlobalMid_Lock when walking the list of mids. Reviewed-by: Suresh Jayaraman <sjayaraman@suse.de> Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/cifsglob.h')
-rw-r--r--fs/cifs/cifsglob.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index 606ca8bb7102..4de737575959 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -508,6 +508,18 @@ static inline void cifs_stats_bytes_read(struct cifsTconInfo *tcon,
508 508
509#endif 509#endif
510 510
511struct mid_q_entry;
512
513/*
514 * This is the prototype for the mid callback function. When creating one,
515 * take special care to avoid deadlocks. Things to bear in mind:
516 *
517 * - it will be called by cifsd
518 * - the GlobalMid_Lock will be held
519 * - the mid will be removed from the pending_mid_q list
520 */
521typedef void (mid_callback_t)(struct mid_q_entry *mid);
522
511/* one of these for every pending CIFS request to the server */ 523/* one of these for every pending CIFS request to the server */
512struct mid_q_entry { 524struct mid_q_entry {
513 struct list_head qhead; /* mids waiting on reply from this server */ 525 struct list_head qhead; /* mids waiting on reply from this server */
@@ -519,7 +531,8 @@ struct mid_q_entry {
519 unsigned long when_sent; /* time when smb send finished */ 531 unsigned long when_sent; /* time when smb send finished */
520 unsigned long when_received; /* when demux complete (taken off wire) */ 532 unsigned long when_received; /* when demux complete (taken off wire) */
521#endif 533#endif
522 struct task_struct *tsk; /* task waiting for response */ 534 mid_callback_t *callback; /* call completion callback */
535 void *callback_data; /* general purpose pointer for callback */
523 struct smb_hdr *resp_buf; /* response buffer */ 536 struct smb_hdr *resp_buf; /* response buffer */
524 int midState; /* wish this were enum but can not pass to wait_event */ 537 int midState; /* wish this were enum but can not pass to wait_event */
525 __u8 command; /* smb command code */ 538 __u8 command; /* smb command code */