diff mbox

cifs: WARN_ON_ONCE if kernel_sendmsg() returns -ENOSPC

Message ID 506C6058.6060008@suse.com (mailing list archive)
State New, archived
Headers show

Commit Message

Suresh Jayaraman Oct. 3, 2012, 3:57 p.m. UTC
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.


Cc: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Suresh Jayaraman <sjayaraman@suse.com>
---

 fs/cifs/transport.c |    6 ++++++
 1 file changed, 6 insertions(+)

--
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

Comments

Jeff Layton Oct. 3, 2012, 4:24 p.m. UTC | #1
On Wed, 03 Oct 2012 21:27:12 +0530
Suresh Jayaraman <sjayaraman@suse.com> wrote:

> 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.
> 
> 
> Cc: Jeff Layton <jlayton@redhat.com>
> Signed-off-by: Suresh Jayaraman <sjayaraman@suse.com>
> ---
> 
>  fs/cifs/transport.c |    6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c
> index d9b639b..c613fca 100644
> --- a/fs/cifs/transport.c
> +++ b/fs/cifs/transport.c
> @@ -155,6 +155,12 @@ 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. This
> +			 * WARN_ON will be removed by 3.10 if no one reports
> +			 * seeing this.
> +			 */
> +			WARN_ON_ONCE(rc == -ENOSPC);
>  			i++;
>  			/*
>  			 * If blocking send we try 3 times, since each can block
> --
> 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

LGTM

Reviewed-by: Jeff Layton <jlayton@redhat.com>
--
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
Steve French Oct. 3, 2012, 7:16 p.m. UTC | #2
merged into cifs-2.6.git

On Wed, Oct 3, 2012 at 11:24 AM, Jeff Layton <jlayton@redhat.com> wrote:
> On Wed, 03 Oct 2012 21:27:12 +0530
> Suresh Jayaraman <sjayaraman@suse.com> wrote:
>
>> 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.
>>
>>
>> Cc: Jeff Layton <jlayton@redhat.com>
>> Signed-off-by: Suresh Jayaraman <sjayaraman@suse.com>
>> ---
>>
>>  fs/cifs/transport.c |    6 ++++++
>>  1 file changed, 6 insertions(+)
>>
>> diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c
>> index d9b639b..c613fca 100644
>> --- a/fs/cifs/transport.c
>> +++ b/fs/cifs/transport.c
>> @@ -155,6 +155,12 @@ 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. This
>> +                      * WARN_ON will be removed by 3.10 if no one reports
>> +                      * seeing this.
>> +                      */
>> +                     WARN_ON_ONCE(rc == -ENOSPC);
>>                       i++;
>>                       /*
>>                        * If blocking send we try 3 times, since each can block
>> --
>> 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
>
> LGTM
>
> Reviewed-by: Jeff Layton <jlayton@redhat.com>
diff mbox

Patch

diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c
index d9b639b..c613fca 100644
--- a/fs/cifs/transport.c
+++ b/fs/cifs/transport.c
@@ -155,6 +155,12 @@  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. This
+			 * WARN_ON will be removed by 3.10 if no one reports
+			 * seeing this.
+			 */
+			WARN_ON_ONCE(rc == -ENOSPC);
 			i++;
 			/*
 			 * If blocking send we try 3 times, since each can block