From patchwork Wed Sep 9 08:40:13 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shirish Pargaonkar X-Patchwork-Id: 33168 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.samba.org (fn.samba.org [216.83.154.106]) by bilbo.ozlabs.org (Postfix) with ESMTP id 60609B7063 for ; Wed, 9 Sep 2009 18:40:20 +1000 (EST) Received: from fn.samba.org (localhost [127.0.0.1]) by lists.samba.org (Postfix) with ESMTP id 68BF9AD0E7; Wed, 9 Sep 2009 02:29:40 -0600 (MDT) X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on fn.samba.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.8 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.2.5 X-Original-To: linux-cifs-client@lists.samba.org Delivered-To: linux-cifs-client@lists.samba.org Received: from an-out-0708.google.com (an-out-0708.google.com [209.85.132.248]) by lists.samba.org (Postfix) with ESMTP id 14C54AD0E6 for ; Wed, 9 Sep 2009 02:29:34 -0600 (MDT) Received: by an-out-0708.google.com with SMTP id c5so1550490anc.35 for ; Wed, 09 Sep 2009 01:40:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type; bh=lY5FrcxEcdEViTfEaPNM2f6bn88C4bU716mJphVRo0o=; b=MfKu8OdMruuo5/N+EO9umQS6rPnTE+mnXXTM1aK+ugjysxjZAixkA+TewBUAgcZlsv xvWyq1IhlhrGwYBXRXhoZd4aapuoZ6c/thA4Ygq8Udsa8DoirBTPEL99RDMgN/eUrmR5 f7kPQ7xBKBWi8SukrPvAmlOYI5hLnUUgc0Sa0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=BuBWzhGiAYySgqNH1EpIv2LhIiPp8H46qOOMnRd6+h2PX2Eu3WGwpJBfElmbKkNO7x pkjVb18QeCXtxsnJj31OXoimOiUvMAai0ia25Bgo710V1JKQ5Q3uO5iFCCYCNAJ9X/ti fKH+m3Yhlw6MVmEzia5o71tfknmrtJ+fy+GcA= MIME-Version: 1.0 Received: by 10.101.81.12 with SMTP id i12mr18181706anl.151.1252485613563; Wed, 09 Sep 2009 01:40:13 -0700 (PDT) Date: Wed, 9 Sep 2009 03:40:13 -0500 Message-ID: <4a4634330909090140n1d40029ds6e510f6a9963efcc@mail.gmail.com> From: Shirish Pargaonkar To: linux-cifs-client@lists.samba.org Subject: [linux-cifs-client] [PATCH] return error code for a partial/short send for a retry of the send X-BeenThere: linux-cifs-client@lists.samba.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: The Linux CIFS VFS client List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-cifs-client-bounces@lists.samba.org Errors-To: linux-cifs-client-bounces@lists.samba.org - Enable such that partial/shorts sends can be resent/retried_for_send - Keep the midQ entry by marking it for resend/retry_sending in case of EAGAIN error if (rc < 0) { @@ -505,8 +506,13 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses, mutex_unlock(&ses->server->srv_mutex); cifs_small_buf_release(in_buf); - if (rc < 0) - goto out; + if (rc < 0) { + if (rc == -EAGAIN) { + midQ->midState = MID_RETRY_NEEDED; + goto outagain; + } else + goto out; + } if (long_op == CIFS_STD_OP) timeout = 15 * HZ; @@ -623,6 +629,7 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses, out: DeleteMidQEntry(midQ); +outagain: atomic_dec(&ses->server->inFlight); wake_up(&ses->server->request_q); @@ -697,8 +704,13 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses, #endif mutex_unlock(&ses->server->srv_mutex); - if (rc < 0) - goto out; + if (rc < 0) { + if (rc == -EAGAIN) { + midQ->midState = MID_RETRY_NEEDED; + goto outagain; + } else + goto out; + } if (long_op == CIFS_STD_OP) timeout = 15 * HZ; @@ -807,6 +819,7 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses, out: DeleteMidQEntry(midQ); +outagain: atomic_dec(&ses->server->inFlight); wake_up(&ses->server->request_q); diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c index 1da4ab2..92fa1ad 100644 --- a/fs/cifs/transport.c +++ b/fs/cifs/transport.c @@ -269,6 +269,7 @@ smb_sendv(struct TCP_Server_Info *server, struct kvec *iov, int n_vec) to kill the socket so the server throws away the partial SMB */ server->tcpStatus = CifsNeedReconnect; + rc = -EAGAIN; }