diff mbox series

cifs: correct comments explaining internal semaphore usage in the module

Message ID CAH2r5mvmsdai3iCwpohqUeeiW5tPSeiQgCH8DcpicWntc25rNg@mail.gmail.com
State New
Headers show
Series cifs: correct comments explaining internal semaphore usage in the module | expand

Commit Message

Steve French April 9, 2021, 7:51 p.m. UTC
A few of the semaphores had been removed, and one additional one
needed to be noted in the comments.   (Additional updates to the
semaphore/mutex/lock descriptions in the comments in cifsglob.h
could be helpful to make sure they accurately reflect what protects
what).

Signed-off-by: Steve French <stfrench@microsoft.com>
---
 fs/cifs/cifsglob.h | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Aurélien Aptel April 12, 2021, 4:16 p.m. UTC | #1
Steve French <smfrench@gmail.com> writes:
> A few of the semaphores had been removed, and one additional one
> needed to be noted in the comments.   (Additional updates to the
> semaphore/mutex/lock descriptions in the comments in cifsglob.h
> could be helpful to make sure they accurately reflect what protects
> what).

That's a very good idea. A good starting point would be:

  $ grep 'struct[\t ]*mutex\|spinlock_t\|rw_semaphore\|seqlock_t\|rcu_.*lock' fs/cifs/*[ch]

  fs/cifs/cifs_fs_sb.h:   spinlock_t tlink_tree_lock;
  fs/cifs/cifsglob.h:     spinlock_t req_lock;  /* protect the two values above */
  fs/cifs/cifsglob.h:     struct mutex srv_mutex;
  fs/cifs/cifsglob.h:     struct mutex reconnect_mutex; /* prevent simultaneous reconnects */
  fs/cifs/cifsglob.h:     struct mutex session_mutex;
  fs/cifs/cifsglob.h:     spinlock_t iface_lock;
  fs/cifs/cifsglob.h:     struct mutex fid_mutex;
  fs/cifs/cifsglob.h:     spinlock_t open_file_lock; /* protects list above */
  fs/cifs/cifsglob.h:     spinlock_t stat_lock;  /* protects the two fields above */
  fs/cifs/cifsglob.h:     spinlock_t file_info_lock; /* protects four flag/count fields above */
  fs/cifs/cifsglob.h:     struct mutex fh_mutex; /* prevents reopen race after dead ses*/
  fs/cifs/cifsglob.h:     struct mutex            aio_mutex;
  fs/cifs/cifsglob.h:     struct rw_semaphore lock_sem;   /* protect the fields above */
  fs/cifs/cifsglob.h:     spinlock_t      open_file_lock; /* protects openFileList */
  fs/cifs/cifsglob.h:     spinlock_t writers_lock;
  fs/cifs/cifsglob.h:GLOBAL_EXTERN spinlock_t             cifs_tcp_ses_lock;
  fs/cifs/cifsglob.h:GLOBAL_EXTERN spinlock_t GlobalMid_Lock;  /* protects above & list operations */
  fs/cifs/cifsproto.h:extern void cifs_down_write(struct rw_semaphore *sem);
  fs/cifs/dfs_cache.c:    spinlock_t ctx_lock;
  fs/cifs/dir.c:  rcu_read_lock();
  fs/cifs/dir.c:                  rcu_read_unlock();
  fs/cifs/dir.c:  rcu_read_unlock();
  fs/cifs/dir.c:  rcu_read_lock();
  fs/cifs/dir.c:                  rcu_read_unlock();
  fs/cifs/dir.c:  rcu_read_unlock();
  fs/cifs/file.c:cifs_down_write(struct rw_semaphore *sem)
  fs/cifs/smbdirect.h:    spinlock_t lock_new_credits_offered;
  fs/cifs/smbdirect.h:    spinlock_t mr_list_lock;
  fs/cifs/smbdirect.h:    spinlock_t receive_queue_lock;
  fs/cifs/smbdirect.h:    spinlock_t empty_packet_queue_lock;
  fs/cifs/smbdirect.h:    spinlock_t reassembly_queue_lock;

Cheers,
diff mbox series

Patch

diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index f84a839224ae..6cc54a1d4336 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -1792,9 +1792,8 @@  require use of the stronger protocol */
  *
  *  Semaphores
  *  ----------
- *  sesSem     operations on smb session
- *  tconSem    operations on tree connection
- *  fh_sem      file handle reconnection operations
+ *  cifsInodeInfo->lock_sem protects:
+ * the list of locks held by the inode
  *
  ****************************************************************************/