mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Ingo Molnar <mingo@elte.hu>,
	Peter Zijlstra <peterz@infradead.org>,
	Steve French <sfrench@us.ibm.com>
Subject: [Patch RFC 20/37] cifs: convert semaphore to mutex
Date: Sun, 26 Jul 2009 08:18:39 -0000	[thread overview]
Message-ID: <20090726081555.873287270@linutronix.de> (raw)
In-Reply-To: <20090726081459.455111897@linutronix.de>

[-- Attachment #1: cifs-convert-sema-to-mutex.patch --]
[-- Type: text/plain, Size: 5108 bytes --]

pSesInfo->sesSem is used as mutex so make it a mutex.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Steve French <sfrench@us.ibm.com>
---
 fs/cifs/cifsglob.h |    2 +-
 fs/cifs/cifssmb.c  |   18 +++++++++---------
 fs/cifs/connect.c  |    8 ++++----
 fs/cifs/misc.c     |    2 +-
 4 files changed, 15 insertions(+), 15 deletions(-)

Index: linux-2.6-tip/fs/cifs/cifsglob.h
===================================================================
--- linux-2.6-tip.orig/fs/cifs/cifsglob.h
+++ linux-2.6-tip/fs/cifs/cifsglob.h
@@ -203,7 +203,7 @@ struct cifsUidInfo {
 struct cifsSesInfo {
 	struct list_head smb_ses_list;
 	struct list_head tcon_list;
-	struct semaphore sesSem;
+	struct mutex sesSem;
 #if 0
 	struct cifsUidInfo *uidInfo;	/* pointer to user info */
 #endif
Index: linux-2.6-tip/fs/cifs/cifssmb.c
===================================================================
--- linux-2.6-tip.orig/fs/cifs/cifssmb.c
+++ linux-2.6-tip/fs/cifs/cifssmb.c
@@ -154,7 +154,7 @@ small_smb_init(int smb_command, int wct,
 			nls_codepage = load_nls_default();
 		/* need to prevent multiple threads trying to
 		simultaneously reconnect the same SMB session */
-			down(&tcon->ses->sesSem);
+			mutex_lock(&tcon->ses->sesSem);
 			if (tcon->ses->need_reconnect)
 				rc = cifs_setup_session(0, tcon->ses,
 							nls_codepage);
@@ -162,7 +162,7 @@ small_smb_init(int smb_command, int wct,
 				mark_open_files_invalid(tcon);
 				rc = CIFSTCon(0, tcon->ses, tcon->treeName,
 					      tcon, nls_codepage);
-				up(&tcon->ses->sesSem);
+				mutex_unlock(&tcon->ses->sesSem);
 				/* BB FIXME add code to check if wsize needs
 				   update due to negotiated smb buffer size
 				   shrinking */
@@ -196,7 +196,7 @@ small_smb_init(int smb_command, int wct,
 					}
 				}
 			} else {
-				up(&tcon->ses->sesSem);
+				mutex_unlock(&tcon->ses->sesSem);
 			}
 			unload_nls(nls_codepage);
 
@@ -301,7 +301,7 @@ smb_init(int smb_command, int wct, struc
 			nls_codepage = load_nls_default();
 		/* need to prevent multiple threads trying to
 		simultaneously reconnect the same SMB session */
-			down(&tcon->ses->sesSem);
+			mutex_lock(&tcon->ses->sesSem);
 			if (tcon->ses->need_reconnect)
 				rc = cifs_setup_session(0, tcon->ses,
 							nls_codepage);
@@ -309,7 +309,7 @@ smb_init(int smb_command, int wct, struc
 				mark_open_files_invalid(tcon);
 				rc = CIFSTCon(0, tcon->ses, tcon->treeName,
 					      tcon, nls_codepage);
-				up(&tcon->ses->sesSem);
+				mutex_unlock(&tcon->ses->sesSem);
 				/* BB FIXME add code to check if wsize needs
 				update due to negotiated smb buffer size
 				shrinking */
@@ -343,7 +343,7 @@ smb_init(int smb_command, int wct, struc
 					}
 				}
 			} else {
-				up(&tcon->ses->sesSem);
+				mutex_unlock(&tcon->ses->sesSem);
 			}
 			unload_nls(nls_codepage);
 
@@ -765,13 +765,13 @@ CIFSSMBLogoff(const int xid, struct cifs
 	if (!ses || !ses->server)
 		return -EIO;
 
-	down(&ses->sesSem);
+	mutex_lock(&ses->sesSem);
 	if (ses->need_reconnect)
 		goto session_already_dead; /* no need to send SMBlogoff if uid
 					      already closed due to reconnect */
 	rc = small_smb_init(SMB_COM_LOGOFF_ANDX, 2, NULL, (void **)&pSMB);
 	if (rc) {
-		up(&ses->sesSem);
+		mutex_unlock(&ses->sesSem);
 		return rc;
 	}
 
@@ -786,7 +786,7 @@ CIFSSMBLogoff(const int xid, struct cifs
 	pSMB->AndXCommand = 0xFF;
 	rc = SendReceiveNoRsp(xid, ses, (struct smb_hdr *) pSMB, 0);
 session_already_dead:
-	up(&ses->sesSem);
+	mutex_unlock(&ses->sesSem);
 
 	/* if session dead then we do not need to do ulogoff,
 		since server closed smb session, no sense reporting
Index: linux-2.6-tip/fs/cifs/connect.c
===================================================================
--- linux-2.6-tip.orig/fs/cifs/connect.c
+++ linux-2.6-tip/fs/cifs/connect.c
@@ -2331,13 +2331,13 @@ try_mount_again:
 		 */
 		cifs_put_tcp_session(srvTcp);
 
-		down(&pSesInfo->sesSem);
+		mutex_lock(&pSesInfo->sesSem);
 		if (pSesInfo->need_reconnect) {
 			cFYI(1, ("Session needs reconnect"));
 			rc = cifs_setup_session(xid, pSesInfo,
 						cifs_sb->local_nls);
 		}
-		up(&pSesInfo->sesSem);
+		mutex_unlock(&pSesInfo->sesSem);
 	} else if (!rc) {
 		cFYI(1, ("Existing smb sess not found"));
 		pSesInfo = sesInfoAlloc();
@@ -2380,12 +2380,12 @@ try_mount_again:
 		}
 		pSesInfo->linux_uid = volume_info->linux_uid;
 		pSesInfo->overrideSecFlg = volume_info->secFlg;
-		down(&pSesInfo->sesSem);
+		mutex_lock(&pSesInfo->sesSem);
 
 		/* BB FIXME need to pass vol->secFlgs BB */
 		rc = cifs_setup_session(xid, pSesInfo,
 					cifs_sb->local_nls);
-		up(&pSesInfo->sesSem);
+		mutex_unlock(&pSesInfo->sesSem);
 	}
 
 	/* search for existing tcon to this server share */
Index: linux-2.6-tip/fs/cifs/misc.c
===================================================================
--- linux-2.6-tip.orig/fs/cifs/misc.c
+++ linux-2.6-tip/fs/cifs/misc.c
@@ -80,7 +80,7 @@ sesInfoAlloc(void)
 		++ret_buf->ses_count;
 		INIT_LIST_HEAD(&ret_buf->smb_ses_list);
 		INIT_LIST_HEAD(&ret_buf->tcon_list);
-		init_MUTEX(&ret_buf->sesSem);
+		mutex_init(&ret_buf->sesSem);
 	}
 	return ret_buf;
 }



  parent reply	other threads:[~2009-07-26  8:20 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-26  8:17 [Patch RFC 00/37] Cleanup init_MUTEX[_LOCKED] / DECLARE_MUTEX Thomas Gleixner
2009-07-26  8:17 ` [Patch RFC 01/37] semaphore: Add DEFINE_SEMAPHORE, semaphore_init, semaphore_init_locked Thomas Gleixner
2009-07-26 23:04   ` Daniel Walker
2009-07-27 15:25     ` Christoph Hellwig
2009-07-27 15:32       ` Thomas Gleixner
2009-07-27 15:24   ` Christoph Hellwig
2009-07-26  8:17 ` [Patch RFC 02/37] input: keyboard/hil_kbd: semaphore cleanup Thomas Gleixner
2009-07-28  7:36   ` Dmitry Torokhov
2009-07-26  8:17 ` [Patch RFC 03/37] input: misc/hp_sdc_rtc: " Thomas Gleixner
2009-07-26  8:17 ` [Patch RFC 04/37] input: mouse/hil_ptr: " Thomas Gleixner
2009-07-26  8:17 ` [Patch RFC 05/37] input: serio/hil_mlc: " Thomas Gleixner
2009-07-26  8:17 ` [Patch RFC 06/37] input: serio/hp_sdc: " Thomas Gleixner
2009-07-26  8:17 ` [Patch RFC 07/37] net: 3c527: " Thomas Gleixner
2009-07-26  8:17 ` [Patch RFC 08/37] hamradio: 6pack: " Thomas Gleixner
2009-07-26  8:17 ` [Patch RFC 09/37] hamradio: mkiss: " Thomas Gleixner
2009-07-26  8:17 ` [Patch RFC 10/37] net: ppp_async: " Thomas Gleixner
2009-07-26  8:18 ` [Patch RFC 11/37] parport: " Thomas Gleixner
2009-07-26  8:18 ` [Patch RFC 12/37] ibmphp-hpc: " Thomas Gleixner
2009-07-26  8:18 ` [Patch RFC 13/37] s390: cio/crw: " Thomas Gleixner
2009-07-27 11:45   ` Martin Schwidefsky
2009-07-26  8:18 ` [Patch RFC 14/37] scsi: aacraid " Thomas Gleixner
2009-07-26 20:11   ` James Bottomley
2009-07-26 22:21     ` Thomas Gleixner
2009-07-26  8:18 ` [Patch RFC 15/37] bluetooth: Convert hdev->req_lock to mutex Thomas Gleixner
2009-07-26 21:36   ` Marcel Holtmann
2009-07-26 22:04     ` Thomas Gleixner
2009-07-26  8:18 ` [Patch RFC 16/37] smbfs: Convert server->sem " Thomas Gleixner
2009-07-26  8:18 ` [Patch RFC 17/37] hpfs: Convert sbi->hpfs_creation_de " Thomas Gleixner
2009-07-26  8:18 ` [Patch RFC 18/37] hpfsplus: Convert tree_lock " Thomas Gleixner
2009-07-26  8:18 ` [Patch RFC 19/37] hfs: " Thomas Gleixner
2009-07-26  8:18 ` Thomas Gleixner [this message]
2009-07-27  1:14   ` [Patch RFC 20/37] cifs: convert semaphore " Jeff Layton
2009-07-30 21:09   ` Christoph Hellwig
2009-07-30 22:43     ` Steven French
2009-07-26  8:18 ` [Patch RFC 21/37] affs: use semaphore_init instead of init_MUTEX Thomas Gleixner
2009-07-30 21:14   ` Christoph Hellwig
2009-07-26  8:18 ` [Patch RFC 22/37] usb: ftdi-elan: Convert "mutex" to semaphore Thomas Gleixner
2009-07-26  8:18 ` [Patch RFC 23/37] usb: gadgetfs: Convert semaphore to mutex Thomas Gleixner
2009-07-26 22:56   ` Daniel Walker
2009-07-26  8:19 ` [Patch RFC 24/37] xfs: semaphore cleanup Thomas Gleixner
2009-07-27 15:25   ` Christoph Hellwig
2009-07-26  8:19 ` [Patch RFC 25/37] net: wan/cosa.c: Convert "mutex" to semaphore Thomas Gleixner
2009-07-26  8:19 ` [Patch RFC 26/37] irda: semaphore cleanup Thomas Gleixner
2009-07-26  8:19 ` [Patch RFC 27/37] mmc: Convert "mutex" to semaphore Thomas Gleixner
2009-07-26  8:19 ` [Patch RFC 28/37] dvb: " Thomas Gleixner
2009-07-26  8:19 ` [Patch RFC 29/37] infiniband: Make user_mad semaphore a real one Thomas Gleixner
2009-07-27 16:26   ` Roland Dreier
2009-07-27 16:28     ` Thomas Gleixner
2009-07-26  8:19 ` [Patch RFC 30/37] drivers/base: Convert dev->sem to mutex Thomas Gleixner
2009-07-26  8:19 ` [Patch RFC 31/37] ia64: salinfo: semaphore_init instead of init_MUTEX Thomas Gleixner
2009-07-26  8:19 ` [Patch RFC 32/37] drivers/macintosh/adb: Do not claim that the semaphore is a mutex Thomas Gleixner
2009-07-26  8:20 ` [Patch RFC 33/37] arm: w90x900: convert semaphore to mutex Thomas Gleixner
2009-07-27  3:11   ` Wan ZongShun
2009-07-26  8:20 ` [Patch RFC 34/37] printk: Make console_sem a semaphore not a pseudo mutex Thomas Gleixner
2009-07-26  8:20 ` [Patch RFC 35/37] staging: Bulk convert the semaphore mess Thomas Gleixner
2009-07-26  8:20 ` [Patch RFC 36/37] fs: Convert bd_mount_sem to mutex Thomas Gleixner
2009-07-27 15:26   ` Christoph Hellwig
2009-07-27 15:30     ` Thomas Gleixner
2009-07-27 16:42       ` Daniel Walker
2009-07-26  8:20 ` [Patch RFC 37/37] semaphore: Remove mutex emulation Thomas Gleixner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090726081555.873287270@linutronix.de \
    --to=tglx@linutronix.de \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=sfrench@us.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome