All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: Mike Snitzer <snitzer@redhat.com>,
	device-mapper development <dm-devel@redhat.com>
Subject: Regression introduced with commit 2a0b4682e09d76 ("dm: convert dm_dev_internal.count from atomic_t to refcount_t)
Date: Thu, 1 Feb 2018 15:54:23 +0100	[thread overview]
Message-ID: <00c5e0f4-fe95-a7b4-bdc8-cd1bec442834@suse.de> (raw)

Hi Mike,

yet another refcount_t regression:

--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -451,15 +451,15 @@ int dm_get_device(struct dm_target *ti, const char
*path, fmode_t mode,
                        return r;
                }

-               atomic_set(&dd->count, 0);
+               refcount_set(&dd->count, 1);
                list_add(&dd->list, &t->devices);

        } else if (dd->dm_dev->mode != (mode | dd->dm_dev->mode)) {
                r = upgrade_mode(dd, mode, t->md);
                if (r)
                        return r;
+               refcount_inc(&dd->count);
        }
-       atomic_inc(&dd->count);

        *result = dd->dm_dev;
        return 0;

is _NOT_ an equivalent modification.
If the second 'if' claus is not taken, the reference count is never
increased and the system goes 'boom'.

Will be sending a patch shortly.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		   Teamlead Storage & Networking
hare@suse.de			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel

             reply	other threads:[~2018-02-01 14:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-01 14:54 Hannes Reinecke [this message]
     [not found] <ac8161a5-22b7-4e3a-ad19-a300f1a0ee74@email.android.com>
2018-02-01 16:16 ` Regression introduced with commit 2a0b4682e09d76 ("dm: convert dm_dev_internal.count from atomic_t to refcount_t) Hannes Reinecke
2018-02-01 16:40   ` Mike Snitzer
2018-02-01 17:54     ` Hannes Reinecke

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=00c5e0f4-fe95-a7b4-bdc8-cd1bec442834@suse.de \
    --to=hare@suse.de \
    --cc=dm-devel@redhat.com \
    --cc=snitzer@redhat.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.