From patchwork Mon Oct 1 07:40:45 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suresh Jayaraman X-Patchwork-Id: 1529611 Return-Path: X-Original-To: patchwork-cifs-client@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 16D56DF24C for ; Mon, 1 Oct 2012 07:40:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751829Ab2JAHkx (ORCPT ); Mon, 1 Oct 2012 03:40:53 -0400 Received: from cantor2.suse.de ([195.135.220.15]:47453 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751551Ab2JAHkx (ORCPT ); Mon, 1 Oct 2012 03:40:53 -0400 Received: from relay1.suse.de (unknown [195.135.220.254]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id 0B74F9D938; Mon, 1 Oct 2012 09:40:52 +0200 (CEST) Message-ID: <506948FD.3090602@suse.com> Date: Mon, 01 Oct 2012 13:10:45 +0530 From: Suresh Jayaraman User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120825 Thunderbird/15.0 MIME-Version: 1.0 To: Steve French Cc: linux-cifs Subject: [RFC] [PATCH] cifs: retry kernel_sendmsg only in case of -EAGAIN Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org In smb_sendv(), we seem to retry if kernel_sendmsg() returned either -ENOSPC or -EAGAIN. In either case after multiple attempts, we set the error to -EAGAIN before breaking out of the loop. First, it is not clear to me when kernel_sendmsg() can return -ENOSPC, and what it would mean and why should we retry. It makes me wonder whether this check is part of some old code. Also, there seem to be no need to set the error back to -EAGAIN before we break out the loop. Fix this by making cifs retry only if kernel_sendmsg() returns -EAGAIN. If the above discussion make sense, here is a patch to fix this. Acked-by: Jeff Layton --- Retry kernel_sendmsg() only in case of -EAGAIN and remove redundant error assignment. Signed-off-by: Suresh Jayaraman --- -- To unsubscribe from this list: send the line "unsubscribe linux-cifs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c index d9b639b..a33db4c 100644 --- a/fs/cifs/transport.c +++ b/fs/cifs/transport.c @@ -154,7 +154,7 @@ smb_sendv(struct TCP_Server_Info *server, struct kvec *iov, int n_vec) while (total_len) { rc = kernel_sendmsg(ssocket, &smb_msg, &iov[first_vec], n_vec - first_vec, total_len); - if ((rc == -ENOSPC) || (rc == -EAGAIN)) { + if (rc == -EAGAIN) { i++; /* * If blocking send we try 3 times, since each can block @@ -177,7 +177,6 @@ smb_sendv(struct TCP_Server_Info *server, struct kvec *iov, int n_vec) if ((i >= 14) || (!server->noblocksnd && (i > 2))) { cERROR(1, "sends on sock %p stuck for 15 seconds", ssocket); - rc = -EAGAIN; break; } msleep(1 << i);