All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter via Ocfs2-devel <ocfs2-devel@oss.oracle.com>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [bug report] ocfs2/cluster: Pin/unpin o2hb regions
Date: Wed, 19 Jan 2022 14:29:36 +0300	[thread overview]
Message-ID: <20220119112936.GA8111@kili> (raw)

Hello OCFS2 developers,

The patch 58a3158a5d17: "ocfs2/cluster: Pin/unpin o2hb regions" from
Dec 14, 2010, leads to the following Smatch static checker warning:

	./include/linux/fs.h:777 inode_lock()
	warn: sleeping in atomic context

The call tree is:

o2hb_heartbeat_group_drop_item() <- disables preempt
o2hb_region_inc_user() <- disables preempt
-> o2hb_region_pin()
   -> o2nm_depend_item()
      -> configfs_depend_item()
         -> inode_lock()

fs/ocfs2/cluster/heartbeat.c
  2265        static int o2hb_region_pin(const char *region_uuid)
  2266        {
  2267                int ret = 0, found = 0;
  2268                struct o2hb_region *reg;
  2269                char *uuid;
  2270
  2271                assert_spin_locked(&o2hb_live_lock);
                      ^^^^^^^^^^^^^^^^^^

This code is holding a spin lock.

  2272
  2273                list_for_each_entry(reg, &o2hb_all_regions, hr_all_item) {
  2274                        if (reg->hr_item_dropped)
  2275                                continue;
  2276
  2277                        uuid = config_item_name(&reg->hr_item);
  2278
  2279                        /* local heartbeat */
  2280                        if (region_uuid) {
  2281                                if (strcmp(region_uuid, uuid))
  2282                                        continue;
  2283                                found = 1;
  2284                        }
  2285
  2286                        if (reg->hr_item_pinned || reg->hr_item_dropped)
  2287                                goto skip_pin;
  2288
  2289                        /* Ignore ENOENT only for local hb (userdlm domain) */
  2290                        ret = o2nm_depend_item(&reg->hr_item);
                                    ^^^^^^^^^^^^^^^^
The o2nm_depend_item() fucntion cannot succeed without taking a mutex.

  2291                        if (!ret) {
  2292                                mlog(ML_CLUSTER, "Pin region %s\n", uuid);
  2293                                reg->hr_item_pinned = 1;
  2294                        } else {
  2295                                if (ret == -ENOENT && found)
  2296                                        ret = 0;
  2297                                else {
  2298                                        mlog(ML_ERROR, "Pin region %s fails with %d\n",
  2299                                             uuid, ret);
  2300                                        break;
  2301                                }
  2302                        }
  2303        skip_pin:
  2304                        if (found)
  2305                                break;
  2306                }
  2307
  2308                return ret;
  2309        }

regards,
dan carpenter

_______________________________________________
Ocfs2-devel mailing list
Ocfs2-devel@oss.oracle.com
https://oss.oracle.com/mailman/listinfo/ocfs2-devel

             reply	other threads:[~2022-01-19 11:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-19 11:29 Dan Carpenter via Ocfs2-devel [this message]
2022-01-20  2:13 ` [Ocfs2-devel] [bug report] ocfs2/cluster: Pin/unpin o2hb regions Joseph Qi via Ocfs2-devel
  -- strict thread matches above, loose matches on Subject: below --
2023-06-06  8:22 Dan Carpenter via Ocfs2-devel

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=20220119112936.GA8111@kili \
    --to=ocfs2-devel@oss.oracle.com \
    --cc=dan.carpenter@oracle.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.