All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: sprasad@microsoft.com
Cc: linux-cifs@vger.kernel.org
Subject: [bug report] cifs: avoid use of global locks for high contention data
Date: Mon, 1 Aug 2022 16:03:17 +0300	[thread overview]
Message-ID: <YufPFRNZtOSbuVY+@kili> (raw)

Hello Shyam Prasad N,

The patch fe67bd563ec2: "cifs: avoid use of global locks for high
contention data" from Jul 27, 2022, leads to the following Smatch
static checker warning:

fs/cifs/connect.c:4641 cifs_tree_connect()
warn: inconsistent returns '&tcon->tc_lock'.
  Locked on  : 4587
  Unlocked on: 4641

fs/cifs/connect.c
  4570  int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon, const struct nls_table *nlsc)
  4571  {
  4572          int rc;
  4573          struct TCP_Server_Info *server = tcon->ses->server;
  4574          const struct smb_version_operations *ops = server->ops;
  4575          struct super_block *sb = NULL;
  4576          struct cifs_sb_info *cifs_sb;
  4577          struct dfs_cache_tgt_list tl = DFS_CACHE_TGT_LIST_INIT(tl);
  4578          char *tree;
  4579          struct dfs_info3_param ref = {0};
  4580  
  4581          /* only send once per connect */
  4582          spin_lock(&tcon->tc_lock);
                           ^^^^^^^^^^^^^

  4583          if (tcon->ses->ses_status != SES_GOOD ||
  4584              (tcon->status != TID_NEW &&
  4585              tcon->status != TID_NEED_TCON)) {
  4586                  spin_unlock(&tcon->ses->ses_lock);
                                     ^^^^^^^^^^^^^^^^^^^
Originally this used to take a lock and then unlock it again but now it
unlocks a different lock.

  4587                  return 0;
  4588          }
  4589          tcon->status = TID_IN_TCON;
  4590          spin_unlock(&tcon->tc_lock);
  4591  

regards,
dan carpenter

             reply	other threads:[~2022-08-01 13:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-01 13:03 Dan Carpenter [this message]
2022-08-01 15:42 ` [bug report] cifs: avoid use of global locks for high contention data Steve French

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=YufPFRNZtOSbuVY+@kili \
    --to=dan.carpenter@oracle.com \
    --cc=linux-cifs@vger.kernel.org \
    --cc=sprasad@microsoft.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.