[linux-cifs] Re: [PATCH 06/11] CIFS: Respect MaxMpxCount field


This is going to be more complicated than it seems.

Apparently (according to Chris), Windows will often allow mapmpx simultaneous
requests per process for various handle based requests.   In addition according
to JRA, Samba server does not care if you go beyond maxmpx (and there is
a big performance advantage of that).   On the other hand - if the server
sets maxmpx to less than 10, these kind of changes probably make sense
(those servers are probably broken otherwise), but for normal servers
this will end up restricting more than windows (for more than than the
maxmpx per pid).   Generally, for servers like Samba that support
simultaneous requests reasonably we have to be careful about killing
performance especially now that with Jeff's async reads and writes
we will frequently get up to 50 (and should probably make it easier
to have more than 50 to servers like Samba).

Quoting JRA and Volker - "You should be able to queue
thousands of simultaneous requests from one client to Samba"
(as long as the client doesn't time out.  The server keeps
responding to the earlier requests, so with our client timeout
code weshould be fine).

On Wed, Feb 22, 2012 at 1:32 AM, Pavel Shilovsky  wrote:
> by setting the number of available credits to it except 2 that goes
> to extra echo and oplock slots. If MaxMpxCount is 2 - disable oplocks,
> if 1 - disable oplocks and echos.
>
> Signed-off-by: Pavel Shilovsky 
> ---
> fs/cifs/cifsfs.c  |  12 --------
> fs/cifs/cifsglob.h |  60 ++++++++++++++++++--------------------
> fs/cifs/cifsproto.h |  7 ++++-
> fs/cifs/cifssmb.c  |  16 ++++++----
> fs/cifs/connect.c  |  10 +++---
> fs/cifs/dir.c    |  5 ++-
> fs/cifs/file.c   |  4 +-
> fs/cifs/misc.c   |  49 +++++++++++++++++++++++++++++++
> fs/cifs/transport.c |  79 +++++++++++++++++++++++++--------------------------
> 9 files changed, 142 insertions(+), 100 deletions(-)
>
> diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
> index e1ce1ca..a9b483b 100644
> --- a/fs/cifs/cifsfs.c
> +++ b/fs/cifs/cifsfs.c
> @@ -73,10 +73,6 @@ unsigned int cifs_min_small = 30;
> module_param(cifs_min_small, int, 0);
> MODULE_PARM_DESC(cifs_min_small, "Small network buffers in pool. Default: 30 "
>                 "Range: 2 to 256");
> -unsigned int cifs_max_pending = CIFS_MAX_REQ;
> -module_param(cifs_max_pending, int, 0444);
> -MODULE_PARM_DESC(cifs_max_pending, "Simultaneous requests to server. "
> -                 "Default: 50 Range: 2 to 256");
> module_param(enable_oplocks, bool, 0644);
> MODULE_PARM_DESC(enable_oplocks, "Enable or disable oplocks (bool). Default:"
>                 "y/Y/1");
> @@ -1108,14 +1104,6 @@ init_cifs(void)
>    spin_lock_init(&cifs_file_list_lock);
>    spin_lock_init(&GlobalMid_Lock);
>
> -    if (cifs_max_pending < 2) {
> -        cifs_max_pending = 2;
> -        cFYI(1, "cifs_max_pending set to min of 2");
> -    } else if (cifs_max_pending > 256) {
> -        cifs_max_pending = 256;
> -        cFYI(1, "cifs_max_pending set to max of 256");
> -    }
> -
>    rc = cifs_fscache_register();
>    if (rc)
>        goto out_clean_proc;
> diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
> index 674792e..4b13be5 100644
> --- a/fs/cifs/cifsglob.h
> +++ b/fs/cifs/cifsglob.h
> @@ -53,17 +53,6 @@
> */
> #define CIFS_MAX_ACTIMEO (1 << 30)
>
> -/*
> - * MAX_REQ is the maximum number of requests that WE will send
> - * on one socket concurrently. It also matches the most common
> - * value of max multiplex returned by servers. We may
> - * eventually want to use the negotiated value (in case
> - * future servers can handle more) when we are more confident that
> - * we will not have problems oveloading the socket with pending
> - * write data.
> - */
> -#define CIFS_MAX_REQ 50
> -
> #define RFC1001_NAME_LEN 15
> #define RFC1001_NAME_LEN_WITH_NULL (RFC1001_NAME_LEN + 1)
>
> @@ -255,7 +244,11 @@ struct TCP_Server_Info {
>    bool noblocksnd;        /* use blocking sendmsg */
>    bool noautotune;        /* do not autotune send buf sizes */
>    bool tcp_nodelay;
> -    int credits; /* send no more requests at once */
> +    bool oplocks:1; /* server supports async oplock breaks */
> +    bool echos:1; /* server supports async echos */
> +    unsigned int echo_credits; /* reserve for echos */
> +    unsigned int oplock_credits; /* reserve for oplock breaks */
> +    unsigned int credits; /* send no more requests at once */
>    unsigned int in_flight; /* number of requests on the wire to server */
>    spinlock_t req_lock; /* protect the two values above */
>    struct mutex srv_mutex;
> @@ -309,6 +302,12 @@ struct TCP_Server_Info {
> #endif
> };
>
> +/*
> + * The minimal value to set before negotiating and don't issue extra messaging
> + * in cifs_change_conf.
> + */
> +#define CIFS_CREDITS_DEFAULT 3
> +
> static inline unsigned int
> in_flight(struct TCP_Server_Info *server)
> {
> @@ -319,31 +318,31 @@ in_flight(struct TCP_Server_Info *server)
>    return num;
> }
>
> -static inline int
> -get_credits(struct TCP_Server_Info *server)
> -{
> -    int num;
> -    spin_lock(&server->req_lock);
> -    num = server->credits;
> -    spin_unlock(&server->req_lock);
> -    return num;
> -}
> +#define  CIFS_OBREAK_OP  0x080  /* oplock break request */
> +#define  CIFS_ECHO_OP   0x0100  /* echo request */
> +#define  CIFS_REQ_MASK  0x0180  /* mask request type */
>
> -static inline void
> -add_credits(struct TCP_Server_Info *server, unsigned int add)
> +static inline unsigned int*
> +get_credits_field(struct TCP_Server_Info *server, const int optype)
> {
> -    spin_lock(&server->req_lock);
> -    server->credits += add;
> -    server->in_flight--;
> -    spin_unlock(&server->req_lock);
> +    switch (optype) {
> +    case CIFS_ECHO_OP:
> +        return &server->echo_credits;
> +    case CIFS_OBREAK_OP:
> +        return &server->oplock_credits;
> +    default:
> +        return &server->credits;
> +    }
> }
>
> -static inline void
> -set_credits(struct TCP_Server_Info *server, int val)
> +static inline bool
> +has_free_credits(struct TCP_Server_Info *server, unsigned int *val)
> {
> +    bool res;
>    spin_lock(&server->req_lock);
> -    server->credits = val;
> +    res = *val > 0;
>    spin_unlock(&server->req_lock);
> +    return res;
> }
>
> /*
> @@ -1047,7 +1046,6 @@ GLOBAL_EXTERN unsigned int linuxExtEnabled;/*enable Linux/Unix CIFS extensions*/
> GLOBAL_EXTERN unsigned int CIFSMaxBufSize; /* max size not including hdr */
> GLOBAL_EXTERN unsigned int cifs_min_rcv;  /* min size of big ntwrk buf pool */
> GLOBAL_EXTERN unsigned int cifs_min_small; /* min size of small buf pool */
> -GLOBAL_EXTERN unsigned int cifs_max_pending; /* MAX requests at once to server*/
>
> #ifdef CONFIG_CIFS_ACL
> GLOBAL_EXTERN struct rb_root uidtree;
> diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h
> index 6f4e243..75163a6 100644
> --- a/fs/cifs/cifsproto.h
> +++ b/fs/cifs/cifsproto.h
> @@ -71,7 +71,7 @@ extern void DeleteMidQEntry(struct mid_q_entry *midEntry);
> extern int cifs_call_async(struct TCP_Server_Info *server, struct kvec *iov,
>              unsigned int nvec, mid_receive_t *receive,
>              mid_callback_t *callback, void *cbdata,
> -             bool ignore_pend);
> +             int optype);
> extern int SendReceive(const unsigned int /* xid */ , struct cifs_ses *,
>            struct smb_hdr * /* input */ ,
>            struct smb_hdr * /* out */ ,
> @@ -169,6 +169,11 @@ extern struct smb_vol *cifs_get_volume_info(char *mount_data,
> extern int cifs_mount(struct cifs_sb_info *, struct smb_vol *);
> extern void cifs_umount(struct cifs_sb_info *);
> extern void cifs_dfs_release_automount_timer(void);
> +extern int cifs_reconnect(struct TCP_Server_Info *server);
> +extern void cifs_change_conf(struct TCP_Server_Info *server);
> +extern void add_credits(struct TCP_Server_Info *server, unsigned int add,
> +            const int optype);
> +extern void set_credits(struct TCP_Server_Info *server, unsigned int val);
> void cifs_proc_init(void);
> void cifs_proc_clean(void);
>
> diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
> index c255c25..985dcce 100644
> --- a/fs/cifs/cifssmb.c
> +++ b/fs/cifs/cifssmb.c
> @@ -459,6 +459,7 @@ CIFSSMBNegotiate(unsigned int xid, struct cifs_ses *ses)
>        }
>        server->sec_mode = (__u8)le16_to_cpu(rsp->SecurityMode);
>        server->maxReq = le16_to_cpu(rsp->MaxMpxCount);
> +        set_credits(server, server->maxReq);
>        server->maxBuf = le16_to_cpu(rsp->MaxBufSize);
>        server->max_vcs = le16_to_cpu(rsp->MaxNumberVcs);
>        /* even though we do not use raw we might as well set this
> @@ -565,6 +566,7 @@ CIFSSMBNegotiate(unsigned int xid, struct cifs_ses *ses)
>    /* one byte, so no need to convert this or EncryptionKeyLen from
>      little endian */
>    server->maxReq = le16_to_cpu(pSMBr->MaxMpxCount);
> +    set_credits(server, server->maxReq);
>    /* probably no need to store and check maxvcs */
>    server->maxBuf = le32_to_cpu(pSMBr->MaxBufferSize);
>    server->max_rw = le32_to_cpu(pSMBr->MaxRawSize);
> @@ -716,7 +718,7 @@ cifs_echo_callback(struct mid_q_entry *mid)
>    struct TCP_Server_Info *server = mid->callback_data;
>
>    DeleteMidQEntry(mid);
> -    add_credits(server, 1);
> +    add_credits(server, 1, CIFS_ECHO_OP);
>    wake_up(&server->request_q);
> }
>
> @@ -744,7 +746,7 @@ CIFSSMBEcho(struct TCP_Server_Info *server)
>    iov.iov_len = be32_to_cpu(smb->hdr.smb_buf_length) + 4;
>
>    rc = cifs_call_async(server, &iov, 1, NULL, cifs_echo_callback,
> -              server, true);
> +              server, CIFS_ECHO_OP);
>    if (rc)
>        cFYI(1, "Echo request failed: %d", rc);
>
> @@ -1669,7 +1671,7 @@ cifs_readv_callback(struct mid_q_entry *mid)
>
>    queue_work(system_nrt_wq, &rdata->work);
>    DeleteMidQEntry(mid);
> -    add_credits(server, 1);
> +    add_credits(server, 1, 0);
>    wake_up(&server->request_q);
> }
>
> @@ -1725,7 +1727,7 @@ cifs_async_readv(struct cifs_readdata *rdata)
>
>    rc = cifs_call_async(tcon->ses->server, rdata->iov, 1,
>               cifs_readv_receive, cifs_readv_callback,
> -              rdata, false);
> +              rdata, 0);
>
>    if (rc == 0)
>        cifs_stats_inc(&tcon->num_reads);
> @@ -2110,7 +2112,7 @@ cifs_writev_callback(struct mid_q_entry *mid)
>
>    queue_work(system_nrt_wq, &wdata->work);
>    DeleteMidQEntry(mid);
> -    add_credits(tcon->ses->server, 1);
> +    add_credits(tcon->ses->server, 1, 0);
>    wake_up(&tcon->ses->server->request_q);
> }
>
> @@ -2194,7 +2196,7 @@ cifs_async_writev(struct cifs_writedata *wdata)
>
>    kref_get(&wdata->refcount);
>    rc = cifs_call_async(tcon->ses->server, iov, wdata->nr_pages + 1,
> -              NULL, cifs_writev_callback, wdata, false);
> +              NULL, cifs_writev_callback, wdata, 0);
>
>    if (rc == 0)
>        cifs_stats_inc(&tcon->num_writes);
> @@ -2382,7 +2384,7 @@ CIFSSMBLock(const int xid, struct cifs_tcon *tcon,
>        return rc;
>
>    if (lockType == LOCKING_ANDX_OPLOCK_RELEASE) {
> -        timeout = CIFS_ASYNC_OP; /* no response expected */
> +        timeout = CIFS_ASYNC_OP | CIFS_OBREAK_OP;
>        pSMB->Timeout = 0;
>    } else if (waitFlag) {
>        timeout = CIFS_BLOCKING_OP; /* blocking operation, no timeout */
> diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
> index 86d7a40..aa97dab 100644
> --- a/fs/cifs/connect.c
> +++ b/fs/cifs/connect.c
> @@ -78,7 +78,7 @@ static int cifs_setup_volume_info(struct smb_vol *volume_info, char *mount_data,
> * reconnect tcp session
> * wake up waiters on reconnection? - (not needed currently)
> */
> -static int
> +int
> cifs_reconnect(struct TCP_Server_Info *server)
> {
>    int rc = 0;
> @@ -324,7 +324,7 @@ cifs_echo_request(struct work_struct *work)
>     * done, which is indicated by maxBuf != 0. Also, no need to ping if
>     * we got a response recently
>     */
> -    if (server->maxBuf == 0 ||
> +    if (!server->echos || server->maxBuf == 0 ||
>      time_before(jiffies, server->lstrp + SMB_ECHO_INTERVAL - HZ))
>        goto requeue_echo;
>
> @@ -1901,7 +1901,7 @@ cifs_get_tcp_session(struct smb_vol *volume_info)
>    tcp_ses->noautotune = volume_info->noautotune;
>    tcp_ses->tcp_nodelay = volume_info->sockopt_tcp_nodelay;
>    tcp_ses->in_flight = 0;
> -    tcp_ses->credits = cifs_max_pending;
> +    tcp_ses->credits = CIFS_CREDITS_DEFAULT;
>    init_waitqueue_head(&tcp_ses->response_q);
>    init_waitqueue_head(&tcp_ses->request_q);
>    INIT_LIST_HEAD(&tcp_ses->pending_mid_q);
> @@ -3751,11 +3751,11 @@ int cifs_negotiate_protocol(unsigned int xid, struct cifs_ses *ses)
>    if (server->maxBuf != 0)
>        return 0;
>
> -    set_credits(server, cifs_max_pending);
> +    set_credits(server, CIFS_CREDITS_DEFAULT);
>    rc = CIFSSMBNegotiate(xid, ses);
>    if (rc == -EAGAIN) {
>        /* retry only once on 1st time connection */
> -        set_credits(server, cifs_max_pending);
> +        set_credits(server, CIFS_CREDITS_DEFAULT);
>        rc = CIFSSMBNegotiate(xid, ses);
>        if (rc == -EAGAIN)
>            rc = -EHOSTDOWN;
> diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c
> index 63a196b..e183e38 100644
> --- a/fs/cifs/dir.c
> +++ b/fs/cifs/dir.c
> @@ -171,7 +171,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, umode_t mode,
>    }
>    tcon = tlink_tcon(tlink);
>
> -    if (enable_oplocks)
> +    if (tcon->ses->server->oplocks)
>        oplock = REQ_OPLOCK;
>
>    if (nd)
> @@ -492,7 +492,7 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry,
> {
>    int xid;
>    int rc = 0; /* to get around spurious gcc warning, set to zero here */
> -    __u32 oplock = enable_oplocks ? REQ_OPLOCK : 0;
> +    __u32 oplock;
>    __u16 fileHandle = 0;
>    bool posix_open = false;
>    struct cifs_sb_info *cifs_sb;
> @@ -517,6 +517,7 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry,
>        return (struct dentry *)tlink;
>    }
>    pTcon = tlink_tcon(tlink);
> +    oplock = pTcon->ses->server->oplocks ? REQ_OPLOCK : 0;
>
>    /*
>     * Don't allow the separator character in a path component.
> diff --git a/fs/cifs/file.c b/fs/cifs/file.c
> index 4dd9283..b5e38b1 100644
> --- a/fs/cifs/file.c
> +++ b/fs/cifs/file.c
> @@ -380,7 +380,7 @@ int cifs_open(struct inode *inode, struct file *file)
>    cFYI(1, "inode = 0x%p file flags are 0x%x for %s",
>         inode, file->f_flags, full_path);
>
> -    if (enable_oplocks)
> +    if (tcon->ses->server->oplocks)
>        oplock = REQ_OPLOCK;
>    else
>        oplock = 0;
> @@ -505,7 +505,7 @@ static int cifs_reopen_file(struct cifsFileInfo *pCifsFile, bool can_flush)
>    cFYI(1, "inode = 0x%p file flags 0x%x for %s",
>         inode, pCifsFile->f_flags, full_path);
>
> -    if (enable_oplocks)
> +    if (tcon->ses->server->oplocks)
>        oplock = REQ_OPLOCK;
>    else
>        oplock = 0;
> diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c
> index 703ef5c..e14dc8f 100644
> --- a/fs/cifs/misc.c
> +++ b/fs/cifs/misc.c
> @@ -690,3 +690,52 @@ backup_cred(struct cifs_sb_info *cifs_sb)
>
>    return false;
> }
> +
> +void
> +cifs_change_conf(struct TCP_Server_Info *server)
> +{
> +    server->oplock_credits = server->echo_credits = 0;
> +    switch (server->credits) {
> +    case 0:
> +        cifs_reconnect(server);
> +        return;
> +    case 1:
> +        server->echos = false;
> +        server->oplocks = false;
> +        cERROR(1, "disabling echos and oplocks");
> +        break;
> +    case 2:
> +        server->echos = true;
> +        server->oplocks = false;
> +        server->echo_credits = 1;
> +        cFYI(1, "disabling oplocks");
> +        break;
> +    default:
> +        server->echos = true;
> +        server->oplocks = true;
> +        server->echo_credits = 1;
> +        server->oplock_credits = 1;
> +    }
> +    server->credits -= server->echo_credits + server->oplock_credits;
> +}
> +
> +void
> +add_credits(struct TCP_Server_Info *server, const unsigned int add,
> +      const int optype)
> +{
> +    unsigned int *val;
> +    spin_lock(&server->req_lock);
> +    val = get_credits_field(server, optype);
> +    *val += add;
> +    server->in_flight--;
> +    spin_unlock(&server->req_lock);
> +}
> +
> +void
> +set_credits(struct TCP_Server_Info *server, const unsigned int val)
> +{
> +    spin_lock(&server->req_lock);
> +    server->credits = val;
> +    cifs_change_conf(server);
> +    spin_unlock(&server->req_lock);
> +}
> diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c
> index 938d20b..91f009d 100644
> --- a/fs/cifs/transport.c
> +++ b/fs/cifs/transport.c
> @@ -255,44 +255,41 @@ smb_send(struct TCP_Server_Info *server, struct smb_hdr *smb_buffer,
> }
>
> static int
> -wait_for_free_request(struct TCP_Server_Info *server, const int long_op)
> +wait_for_free_credits(struct TCP_Server_Info *server, unsigned int *num)
> {
>    int rc;
>
> -    spin_lock(&server->req_lock);
> -
> -    if (long_op == CIFS_ASYNC_OP) {
> -        /* oplock breaks must not be held up */
> -        server->in_flight++;
> -        server->credits--;
> -        spin_unlock(&server->req_lock);
> -        return 0;
> -    }
> -
>    while (1) {
> -        if (server->credits <= 0) {
> +        if (*num == 0) {
>            spin_unlock(&server->req_lock);
>            cifs_num_waiters_inc(server);
>            rc = wait_event_interruptible(server->request_q,
> -                           get_credits(server) > 0);
> +                        has_free_credits(server, num));
>            cifs_num_waiters_dec(server);
>            if (rc)
>                return rc;
>            spin_lock(&server->req_lock);
>        } else {
> -            if (server->tcpStatus == CifsExiting) {
> -                spin_unlock(&server->req_lock);
> +            if (server->tcpStatus == CifsExiting)
>                return -ENOENT;
> -            }
> -            server->credits--;
> +            *num -= 1;
>            server->in_flight++;
> -            spin_unlock(&server->req_lock);
>            break;
>        }
>    }
>    return 0;
> }
>
> +static int
> +wait_for_free_request(struct TCP_Server_Info *server, const int optype)
> +{
> +    int rc;
> +    spin_lock(&server->req_lock);
> +    rc = wait_for_free_credits(server, get_credits_field(server, optype));
> +    spin_unlock(&server->req_lock);
> +    return rc;
> +}
> +
> static int allocate_mid(struct cifs_ses *ses, struct smb_hdr *in_buf,
>            struct mid_q_entry **ppmidQ)
> {
> @@ -342,13 +339,13 @@ wait_for_response(struct TCP_Server_Info *server, struct mid_q_entry *midQ)
> int
> cifs_call_async(struct TCP_Server_Info *server, struct kvec *iov,
>        unsigned int nvec, mid_receive_t *receive,
> -        mid_callback_t *callback, void *cbdata, bool ignore_pend)
> +        mid_callback_t *callback, void *cbdata, int optype)
> {
>    int rc;
>    struct mid_q_entry *mid;
>    struct smb_hdr *hdr = (struct smb_hdr *)iov[0].iov_base;
>
> -    rc = wait_for_free_request(server, ignore_pend ? CIFS_ASYNC_OP : 0);
> +    rc = wait_for_free_request(server, optype);
>    if (rc)
>        return rc;
>
> @@ -360,7 +357,7 @@ cifs_call_async(struct TCP_Server_Info *server, struct kvec *iov,
>    mid = AllocMidQEntry(hdr, server);
>    if (mid == NULL) {
>        mutex_unlock(&server->srv_mutex);
> -        add_credits(server, 1);
> +        add_credits(server, 1, optype);
>        wake_up(&server->request_q);
>        return -ENOMEM;
>    }
> @@ -393,7 +390,7 @@ cifs_call_async(struct TCP_Server_Info *server, struct kvec *iov,
>    return rc;
> out_err:
>    delete_mid(mid);
> -    add_credits(server, 1);
> +    add_credits(server, 1, optype);
>    wake_up(&server->request_q);
>    return rc;
> }
> @@ -526,10 +523,12 @@ SendReceive2(const unsigned int xid, struct cifs_ses *ses,
> {
>    int rc = 0;
>    int long_op;
> +    int optype;
>    struct mid_q_entry *midQ;
>    struct smb_hdr *in_buf = iov[0].iov_base;
>
>    long_op = flags & CIFS_TIMEOUT_MASK;
> +    optype = flags & CIFS_REQ_MASK;
>
>    *pRespBufType = CIFS_NO_BUFFER; /* no response buf yet */
>
> @@ -548,7 +547,7 @@ SendReceive2(const unsigned int xid, struct cifs_ses *ses,
>      to the same server. We may make this configurable later or
>      use ses->maxReq */
>
> -    rc = wait_for_free_request(ses->server, long_op);
> +    rc = wait_for_free_request(ses->server, optype);
>    if (rc) {
>        cifs_small_buf_release(in_buf);
>        return rc;
> @@ -565,7 +564,7 @@ SendReceive2(const unsigned int xid, struct cifs_ses *ses,
>        mutex_unlock(&ses->server->srv_mutex);
>        cifs_small_buf_release(in_buf);
>        /* Update # of requests on wire to server */
> -        add_credits(ses->server, 1);
> +        add_credits(ses->server, 1, optype);
>        wake_up(&ses->server->request_q);
>        return rc;
>    }
> @@ -602,7 +601,7 @@ SendReceive2(const unsigned int xid, struct cifs_ses *ses,
>            midQ->callback = DeleteMidQEntry;
>            spin_unlock(&GlobalMid_Lock);
>            cifs_small_buf_release(in_buf);
> -            add_credits(ses->server, 1);
> +            add_credits(ses->server, 1, optype);
>            wake_up(&ses->server->request_q);
>            return rc;
>        }
> @@ -613,7 +612,7 @@ SendReceive2(const unsigned int xid, struct cifs_ses *ses,
>
>    rc = cifs_sync_mid_result(midQ, ses->server);
>    if (rc != 0) {
> -        add_credits(ses->server, 1);
> +        add_credits(ses->server, 1, optype);
>        wake_up(&ses->server->request_q);
>        return rc;
>    }
> @@ -638,7 +637,7 @@ SendReceive2(const unsigned int xid, struct cifs_ses *ses,
>        midQ->resp_buf = NULL;
> out:
>    delete_mid(midQ);
> -    add_credits(ses->server, 1);
> +    add_credits(ses->server, 1, optype);
>    wake_up(&ses->server->request_q);
>
>    return rc;
> @@ -675,7 +674,7 @@ SendReceive(const unsigned int xid, struct cifs_ses *ses,
>        return -EIO;
>    }
>
> -    rc = wait_for_free_request(ses->server, long_op);
> +    rc = wait_for_free_request(ses->server, 0);
>    if (rc)
>        return rc;
>
> @@ -689,7 +688,7 @@ SendReceive(const unsigned int xid, struct cifs_ses *ses,
>    if (rc) {
>        mutex_unlock(&ses->server->srv_mutex);
>        /* Update # of requests on wire to server */
> -        add_credits(ses->server, 1);
> +        add_credits(ses->server, 1, 0);
>        wake_up(&ses->server->request_q);
>        return rc;
>    }
> @@ -722,7 +721,7 @@ SendReceive(const unsigned int xid, struct cifs_ses *ses,
>            /* no longer considered to be "in-flight" */
>            midQ->callback = DeleteMidQEntry;
>            spin_unlock(&GlobalMid_Lock);
> -            add_credits(ses->server, 1);
> +            add_credits(ses->server, 1, 0);
>            wake_up(&ses->server->request_q);
>            return rc;
>        }
> @@ -731,7 +730,7 @@ SendReceive(const unsigned int xid, struct cifs_ses *ses,
>
>    rc = cifs_sync_mid_result(midQ, ses->server);
>    if (rc != 0) {
> -        add_credits(ses->server, 1);
> +        add_credits(ses->server, 1, 0);
>        wake_up(&ses->server->request_q);
>        return rc;
>    }
> @@ -748,7 +747,7 @@ SendReceive(const unsigned int xid, struct cifs_ses *ses,
>    rc = cifs_check_receive(midQ, ses->server, 0);
> out:
>    delete_mid(midQ);
> -    add_credits(ses->server, 1);
> +    add_credits(ses->server, 1, 0);
>    wake_up(&ses->server->request_q);
>
>    return rc;
> @@ -827,7 +826,7 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifs_tcon *tcon,
>    rc = allocate_mid(ses, in_buf, &midQ);
>    if (rc) {
>        mutex_unlock(&ses->server->srv_mutex);
> -        add_credits(ses->server, 1);
> +        add_credits(ses->server, 1, 0);
>        wake_up(&ses->server->request_q);
>        return rc;
>    }
> @@ -836,7 +835,7 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifs_tcon *tcon,
>    if (rc) {
>        delete_mid(midQ);
>        mutex_unlock(&ses->server->srv_mutex);
> -        add_credits(ses->server, 1);
> +        add_credits(ses->server, 1, 0);
>        wake_up(&ses->server->request_q);
>        return rc;
>    }
> @@ -850,7 +849,7 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifs_tcon *tcon,
>
>    if (rc < 0) {
>        delete_mid(midQ);
> -        add_credits(ses->server, 1);
> +        add_credits(ses->server, 1, 0);
>        wake_up(&ses->server->request_q);
>        return rc;
>    }
> @@ -873,7 +872,7 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifs_tcon *tcon,
>            rc = send_nt_cancel(ses->server, in_buf, midQ);
>            if (rc) {
>                delete_mid(midQ);
> -                add_credits(ses->server, 1);
> +                add_credits(ses->server, 1, 0);
>                wake_up(&ses->server->request_q);
>                return rc;
>            }
> @@ -887,7 +886,7 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifs_tcon *tcon,
>              already been removed. Don't exit in this case. */
>            if (rc && rc != -ENOLCK) {
>                delete_mid(midQ);
> -                add_credits(ses->server, 1);
> +                add_credits(ses->server, 1, 0);
>                wake_up(&ses->server->request_q);
>                return rc;
>            }
> @@ -901,7 +900,7 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifs_tcon *tcon,
>                /* no longer considered to be "in-flight" */
>                midQ->callback = DeleteMidQEntry;
>                spin_unlock(&GlobalMid_Lock);
> -                add_credits(ses->server, 1);
> +                add_credits(ses->server, 1, 0);
>                wake_up(&ses->server->request_q);
>                return rc;
>            }
> @@ -914,7 +913,7 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifs_tcon *tcon,
>
>    rc = cifs_sync_mid_result(midQ, ses->server);
>    if (rc != 0) {
> -        add_credits(ses->server, 1);
> +        add_credits(ses->server, 1, 0);
>        wake_up(&ses->server->request_q);
>        return rc;
>    }
> @@ -931,7 +930,7 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifs_tcon *tcon,
>    rc = cifs_check_receive(midQ, ses->server, 0);
> out:
>    delete_mid(midQ);
> -    add_credits(ses->server, 1);
> +    add_credits(ses->server, 1, 0);
>    wake_up(&ses->server->request_q);
>    if (rstart && rc == -EACCES)
>        return -ERESTARTSYS;
> --
> 1.7.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html



-- 
Thanks,

Steve

This message from: http://www.mailbrowse.com/linux-cifs/5541.html
Previous message: Re: [linux-cifs-client] [PATCH] cifs: hard mount option behaviour implementation
Next message:Re: [PATCH 07/11] CIFS: Separate protocol-specific code from transport routines