mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Drokin, Oleg" <oleg.drokin@intel.com>
To: Dan Carpenter <dan.carpenter@oracle.com>,
	"nikitas_angelinas@xyratex.com" <nikitas_angelinas@xyratex.com>,
	"Zhen, Liang" <liang.zhen@intel.com>
Cc: AdrianRemonda <adrianremonda@gmail.com>,
	"open list:STAGING SUBSYSTEM" <devel@driverdev.osuosl.org>,
	"Dilger, Andreas" <andreas.dilger@intel.com>,
	Julia Lawall <Julia.Lawall@lip6.fr>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	open list <linux-kernel@vger.kernel.org>,
	Greg Donald <gdonald@gmail.com>,
	"moderated list:STAGING - LUSTRE..." <HPDD-discuss@ml01.01.org>,
	Joe Perches <joe@perches.com>
Subject: Re: [PATCH 4/4] Staging: lustre: sparse lock warning fix
Date: Thu, 21 May 2015 15:33:34 +0000	[thread overview]
Message-ID: <F5107F47-DCEC-467E-BD2B-9BF4B0B054CD@intel.com> (raw)
In-Reply-To: <20150521151208.GI4150@mwanda>

On May 21, 2015, at 11:12 AM, Dan Carpenter wrote:

> Oh, sorry, I didn't read your patch very carefully.  It won't cause a
> deadlock.  But I'm going to assume it's still not right until lustre
> expert Acks it.

I just took a closer look and it appears original code is buggy and the patch just propagates the bugginess.

If we look at the nrs_policy_put_locked, it eventually ends up in nrs_policy_stop0,
it would hold a lock on whatever happened to be the first policy in the array not NULL.
But nrs_policy_stop0 would unlock the lock on the policy it was called on (already likely a deadlock material) and then relock it.

The problems would arise only if there are more than one nrs policy registered which is theoretically possible, but certainly makes no sense a client (besides, none of the advanced NRS policies
made it in anyway and I almost feel like they just add unnecessary complication in client-only code).

The code looks elaborate enough as if the first policy lock is to be always used as the guardian lock, but then stop0 behavior might be a bug then?
Or it's possible we never end up in stop0 due to nrs state machine?
Let's see what Nikitas and Liang remember about any of this (one of them is the original author of this code, but I am not sure who.)

Nikitas, Liang: The code in question is in nrs_resource_put_safe:
        for (i = 0; i < NRS_RES_MAX; i++) {
                if (pols[i] == NULL)
                        continue;

                if (nrs == NULL) {
                        nrs = pols[i]->pol_nrs;
                        spin_lock(&nrs->nrs_lock);
                }
                nrs_policy_put_locked(pols[i]);
        }

        if (nrs != NULL)
                spin_unlock(&nrs->nrs_lock);


  reply	other threads:[~2015-05-21 15:33 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1431974091-26363-1-git-send-email-adrianremonda@gmail.com>
2015-05-18 18:34 ` [PATCH 1/4] Staging: lustre: sparse static " Adrian Remonda
2015-05-18 18:34   ` [PATCH 2/4] " Adrian Remonda
2015-05-18 18:34     ` [PATCH 3/4] Staging: lustre: Fixed typo Adrian Remonda
2015-05-18 18:34       ` [PATCH 4/4] Staging: lustre: sparse lock warning fix Adrian Remonda
2015-05-18 21:21         ` Dan Carpenter
2015-05-20 16:51           ` Dilger, Andreas
2015-05-20 19:29             ` Dan Carpenter
2015-05-20 19:42               ` Dan Carpenter
2015-05-20 22:51                 ` Dilger, Andreas
2015-05-22 13:38                   ` Dan Carpenter
2015-05-21  8:15           ` AdrianRemonda
2015-05-21 15:12             ` Dan Carpenter
2015-05-21 15:33               ` Drokin, Oleg [this message]
2015-05-22  1:11                 ` Nikitas Angelinas
2015-05-18 21:23   ` [PATCH 1/4] Staging: lustre: sparse static " 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=F5107F47-DCEC-467E-BD2B-9BF4B0B054CD@intel.com \
    --to=oleg.drokin@intel.com \
    --cc=HPDD-discuss@ml01.01.org \
    --cc=Julia.Lawall@lip6.fr \
    --cc=adrianremonda@gmail.com \
    --cc=andreas.dilger@intel.com \
    --cc=dan.carpenter@oracle.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gdonald@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=joe@perches.com \
    --cc=liang.zhen@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nikitas_angelinas@xyratex.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome