From: Dan Carpenter <dan.carpenter@linaro.org>
To: Kent Overstreet <kent.overstreet@linux.dev>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
linux-bcachefs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [GIT PULL] bcachefs changes for 6.11, v2
Date: Tue, 27 Aug 2024 21:25:56 +0300 [thread overview]
Message-ID: <da03e2a7-0293-4b28-9a08-6c0fad51b9a3@stanley.mountain> (raw)
In-Reply-To: <ltl35vocjtma5an2yo7digcdpcsvf6clrvcd4vdkf67gwabogf@syqzgnw5rodw>
On Tue, Aug 27, 2024 at 12:23:22PM -0400, Kent Overstreet wrote:
> On Tue, Aug 27, 2024 at 01:53:55PM GMT, Dan Carpenter wrote:
> > On Thu, Jul 19, 2024 at 06:36:50PM -0400, Kent Overstreet wrote:
> > > bcachefs: Unlock trans when waiting for user input in fsck
> >
> > Hello Kent Overstreet,
> >
> > ommit 889fb3dc5d6f ("bcachefs: Unlock trans when waiting for user
> > input in fsck") from May 29, 2024 (linux-next), leads to the
> > following (UNPUBLISHED) Smatch static checker warning:
> >
> > fs/bcachefs/error.c:129 bch2_fsck_ask_yn() error: double unlocked 'trans' (orig line 113)
> >
> > fs/bcachefs/error.c
> > 102 static enum ask_yn bch2_fsck_ask_yn(struct bch_fs *c, struct btree_trans *trans)
> > 103 {
> > 104 struct stdio_redirect *stdio = c->stdio;
> > 105
> > 106 if (c->stdio_filter && c->stdio_filter != current)
> > 107 stdio = NULL;
> > 108
> > 109 if (!stdio)
> > 110 return YN_NO;
> > 111
> > 112 if (trans)
> > 113 bch2_trans_unlock(trans);
> > ^^^^^^^^^^^^^^^^^^^^^^^^^
> > Unlock
> >
> > 114
> > 115 unsigned long unlock_long_at = trans ? jiffies + HZ * 2 : 0;
> > 116 darray_char line = {};
> > 117 int ret;
> > 118
> > 119 do {
> > 120 unsigned long t;
> > 121 bch2_print(c, " (y,n, or Y,N for all errors of this type) ");
> > 122 rewait:
> > 123 t = unlock_long_at
> > 124 ? max_t(long, unlock_long_at - jiffies, 0)
> > 125 : MAX_SCHEDULE_TIMEOUT;
> > 126
> > 127 int r = bch2_stdio_redirect_readline_timeout(stdio, &line, t);
> > 128 if (r == -ETIME) {
> > 129 bch2_trans_unlock_long(trans);
> > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> > Double unlock
>
> Those are different types of unlocks.
>
What tripped the static checker up is that bch2_trans_unlock_long() calls
bch2_trans_unlock().
fs/bcachefs/btree_locking.c
815 void bch2_trans_unlock_long(struct btree_trans *trans)
816 {
817 bch2_trans_unlock(trans);
818 bch2_trans_srcu_unlock(trans);
819 }
But looking at it now, I guess if we call bch2_trans_unlock() twice the second
unlock is a no-op. Thanks!
regards,
dan carpenter
prev parent reply other threads:[~2024-08-27 18:26 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-18 22:36 Kent Overstreet
2024-07-18 22:39 ` Kent Overstreet
2024-07-19 1:04 ` pr-tracker-bot
2024-07-19 1:04 ` pr-tracker-bot
2024-08-27 10:53 ` Dan Carpenter
2024-08-27 16:23 ` Kent Overstreet
2024-08-27 18:25 ` Dan Carpenter [this message]
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=da03e2a7-0293-4b28-9a08-6c0fad51b9a3@stanley.mountain \
--to=dan.carpenter@linaro.org \
--cc=kent.overstreet@linux.dev \
--cc=linux-bcachefs@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
/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
all inboxes | Powered by JetHome®