From patchwork Wed Oct 3 07:15:36 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suresh Jayaraman X-Patchwork-Id: 1540481 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 4419BDF283 for ; Wed, 3 Oct 2012 07:15:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755974Ab2JCHPq (ORCPT ); Wed, 3 Oct 2012 03:15:46 -0400 Received: from cantor2.suse.de ([195.135.220.15]:32886 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755653Ab2JCHPq (ORCPT ); Wed, 3 Oct 2012 03:15:46 -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 DB7CF9D938; Wed, 3 Oct 2012 09:15:44 +0200 (CEST) Message-ID: <506BE618.7050606@suse.com> Date: Wed, 03 Oct 2012 12:45:36 +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 , Jeff Layton Subject: [PATCH] cifs: WARN_ON_ONCE if kernel_sendmsg() returns -ENOSPC Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org kernel_sendmsg() is less likely to return -ENOSPC and it might be a bug to do so. However, in the past there might have been cases where a -ENOSPC was returned from a low level driver. Add a WARN_ON_ONCE() to ensure that it is safe to assume that -ENOSPC is no longer returned. This -ENOSPC specific handling will be removed once we are sure it is no longer returned. Also, avoid setting -ENOSPC to -EAGAIN while at it. Cc: Jeff Layton Signed-off-by: Suresh Jayaraman --- fs/cifs/transport.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) -- 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..afe000f 100644 --- a/fs/cifs/transport.c +++ b/fs/cifs/transport.c @@ -155,6 +155,10 @@ smb_sendv(struct TCP_Server_Info *server, struct kvec *iov, int n_vec) rc = kernel_sendmsg(ssocket, &smb_msg, &iov[first_vec], n_vec - first_vec, total_len); if ((rc == -ENOSPC) || (rc == -EAGAIN)) { + /* + * Catch if a low level driver returns -ENOSPC. + */ + WARN_ON_ONCE(rc == -ENOSPC); i++; /* * If blocking send we try 3 times, since each can block @@ -177,7 +181,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);