address lock imbalance warnings in smbdirect.c

"Linux Kernel Mailing List" <[email protected]>
Newsgroups gmane.linux.kernel.commits.head
Message-ID <[email protected]>
Web:        https://git.kernel.org/torvalds/c/f9de151bf2b8055563b85ff6896fd86891bbe6c5
Commit:     f9de151bf2b8055563b85ff6896fd86891bbe6c5
Parent:     ade7db991b47ab3016a414468164f4966bd08202
Refname:    refs/heads/master
Author:     Steve French <[email protected]>
AuthorDate: Sat Feb 3 19:45:07 2018 -0600
Committer:  Steve French <[email protected]>
CommitDate: Wed Feb 7 09:36:43 2018 -0600

    address lock imbalance warnings in smbdirect.c
    
    Although at least one of these was an overly strict sparse warning
    in the new smbdirect code, it is cleaner to fix - so no warnings.
    
    Signed-off-by: Steve French <[email protected]>
    Reviewed-by: Ronnie Sahlberg <[email protected]>
---
 fs/cifs/smbdirect.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/fs/cifs/smbdirect.c b/fs/cifs/smbdirect.c
index 5130492847eb..91710eb571fb 100644
--- a/fs/cifs/smbdirect.c
+++ b/fs/cifs/smbdirect.c
@@ -217,9 +217,10 @@ static void smbd_destroy_rdma_work(struct work_struct *work)
 			spin_unlock_irqrestore(
 				&info->reassembly_queue_lock, flags);
 			put_receive_buffer(info, response);
-		}
+		} else
+			spin_unlock_irqrestore(&info->reassembly_queue_lock, flags);
 	} while (response);
-	spin_unlock_irqrestore(&info->reassembly_queue_lock, flags);
+
 	info->reassembly_data_length = 0;
 
 	log_rdma_event(INFO, "free receive buffers\n");
@@ -1934,15 +1935,16 @@ again:
 				 * No need to lock if we are not at the
 				 * end of the queue
 				 */
-				if (!queue_length)
+				if (queue_length)
+					list_del(&response->list);
+				else {
 					spin_lock_irq(
 						&info->reassembly_queue_lock);
-				list_del(&response->list);
-				queue_removed++;
-				if (!queue_length)
+					list_del(&response->list);
 					spin_unlock_irq(
 						&info->reassembly_queue_lock);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.