[CIFS] WARN_ON_ONCE if kernel_sendmsg() returns -ENOSPC
authorSteve French <smfrench@gmail.com>
Mon, 8 Oct 2012 01:00:47 +0000 (20:00 -0500)
committerSteve French <smfrench@gmail.com>
Mon, 8 Oct 2012 01:00:47 +0000 (20:00 -0500)
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.

Reviewed-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Suresh Jayaraman <sjayaraman@suse.com>
Signed-off-by: Steve French <smfrench@gmail.com>
fs/cifs/transport.c

index 2126ab1..76d974c 100644 (file)
@@ -183,6 +183,12 @@ smb_send_kvec(struct TCP_Server_Info *server, struct kvec *iov, size_t n_vec,
                rc = kernel_sendmsg(ssocket, &smb_msg, &iov[first_vec],
                                    n_vec - first_vec, remaining);
                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 (i >= 14 || (!server->noblocksnd && (i > 2))) {
                                cERROR(1, "sends on sock %p stuck for 15 "