All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: Shyam Prasad N <sprasad@microsoft.com>
Cc: linux-cifs@vger.kernel.org
Subject: [bug report] cifs: serialize initialization and cleanup of cfid
Date: Mon, 5 May 2025 17:27:32 +0300	[thread overview]
Message-ID: <aBjK1G1igZ0UWaRk@stanley.mountain> (raw)

Hello Shyam Prasad N,

Commit 62adfb82c199 ("cifs: serialize initialization and cleanup of
cfid") from Apr 29, 2025 (linux-next), leads to the following Smatch
static checker warning:

	fs/smb/client/cached_dir.c:492 drop_cached_dir_by_name()
	warn: sleeping in atomic context

fs/smb/client/cached_dir.c
    476 void drop_cached_dir_by_name(const unsigned int xid, struct cifs_tcon *tcon,
    477                              const char *name, struct cifs_sb_info *cifs_sb)
    478 {
    479         struct cached_fid *cfid = NULL;
    480         int rc;
    481 
    482         rc = open_cached_dir(xid, tcon, name, cifs_sb, true, &cfid);
    483         if (rc) {
    484                 cifs_dbg(FYI, "no cached dir found for rmdir(%s)\n", name);
    485                 return;
    486         }
    487         spin_lock(&cfid->fid_lock);
                ^^^^^^^^^^^^^^^^^^^^^^^^^^
    488         if (cfid->has_lease) {
    489                 /* mark as invalid */
    490                 cfid->has_lease = false;
    491                 kref_put(&cfid->refcount, smb2_close_cached_fid);
                                                  ^^^^^^^^^^^^^^^^^^^^^^
The patch adds mutex but the issue is that drop_cached_dir_by_name()
is holding a spinlock and we can't take a mutex if we're already holding
a spinlock.

--> 492         }
    493         spin_unlock(&cfid->fid_lock);
    494         close_cached_dir(cfid);
    495 }

regards,
dan carpenter

             reply	other threads:[~2025-05-05 14:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-05 14:27 Dan Carpenter [this message]
2025-05-16 11:06 ` [bug report] cifs: serialize initialization and cleanup of cfid Shyam Prasad N
  -- strict thread matches above, loose matches on Subject: below --
2025-05-05 14:27 Dan Carpenter

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=aBjK1G1igZ0UWaRk@stanley.mountain \
    --to=dan.carpenter@linaro.org \
    --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.