lustre-devel-lustre.org archive mirror
 help / color / mirror / Atom feed
From: James Simmons <jsimmons@infradead.org>
To: Andreas Dilger <adilger@whamcloud.com>,
	Oleg Drokin <green@whamcloud.com>, NeilBrown <neilb@suse.de>
Cc: Wang Shilong <wshilong@ddn.com>,
	Lustre Development List <lustre-devel@lists.lustre.org>
Subject: [lustre-devel] [PATCH 3/9] lustre: obdclass: connect vs disconnect race
Date: Mon,  8 Feb 2021 19:54:21 -0500	[thread overview]
Message-ID: <1612832067-1449-4-git-send-email-jsimmons@infradead.org> (raw)
In-Reply-To: <1612832067-1449-1-git-send-email-jsimmons@infradead.org>

From: Wang Shilong <wshilong@ddn.com>

There might be a possible race if setup (connect)
and cleanup (disconnect) are tangled together(similar
comments in osc_disconnect()):

  Thread1:                              Thread2:
    connecting                            class_cleanup
      ptlrpc_connect_interpret
                                            obd->obd_setup = 0
      obd_import_event
        if (obd->obd_set_up)
            osc_init_grant() /*skipped*/
        ptlrpc_activate_import..

And If RPC was waked up and send out before
class_disconnect_exports(), It might hit divide zero crash
in osc_announce_cached() because @cl_max_extent_pages is zero.

The problem is we clear @obd_setup too early, It should be cleared
when OBD is really shutdown.

Fixes: cfd750 ("lustre: obdclass: obd_device improvement")
WC-bug-id: https://jira.whamcloud.com/browse/LU-14283
Lustre-commit: 4f689a30fb5d870 ("LU-14283 obdclass: connect vs disconnect race")
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Reviewed-on: https://review.whamcloud.com/41256
Reviewed-by: Sebastien Buisson <sbuisson@ddn.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: John L. Hammond <jhammond@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 fs/lustre/obdclass/obd_config.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/fs/lustre/obdclass/obd_config.c b/fs/lustre/obdclass/obd_config.c
index 09dee7b..8f062bb 100644
--- a/fs/lustre/obdclass/obd_config.c
+++ b/fs/lustre/obdclass/obd_config.c
@@ -467,10 +467,6 @@ static int class_cleanup(struct obd_device *obd, struct lustre_cfg *lcfg)
 	}
 	/* Leave this on forever */
 	obd->obd_stopping = 1;
-	/* function can't return error after that point, so clear setup flag
-	 * as early as possible to avoid finding via obd_devs / hash
-	 */
-	obd->obd_set_up = 0;
 	spin_unlock(&obd->obd_dev_lock);
 
 	while (obd->obd_conn_inprogress > 0)
-- 
1.8.3.1

_______________________________________________
lustre-devel mailing list
lustre-devel@lists.lustre.org
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org

  parent reply	other threads:[~2021-02-09  0:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-09  0:54 [lustre-devel] [PATCH 0/9] Sync to OpenSFS as of Feb 8, 2021 James Simmons
2021-02-09  0:54 ` [lustre-devel] [PATCH 1/9] lustre: llite: send file mode with rename RPC James Simmons
2021-02-09  0:54 ` [lustre-devel] [PATCH 2/9] lustre: flr: skip unknown FLR component types James Simmons
2021-02-09  0:54 ` James Simmons [this message]
2021-02-09  0:54 ` [lustre-devel] [PATCH 4/9] lustre: osc: correctly update size/kms for fallocate James Simmons
2021-02-09  0:54 ` [lustre-devel] [PATCH 5/9] lustre: ldlm: don't change GROUP lock GID on client James Simmons
2021-02-09  0:54 ` [lustre-devel] [PATCH 6/9] lustre: sec: get rid of bad rss-counter state messages James Simmons
2021-02-09  0:54 ` [lustre-devel] [PATCH 7/9] lustre: obdclass: add option %H for jobid James Simmons
2021-02-09  0:54 ` [lustre-devel] [PATCH 8/9] lustre: osc: avoid crash if ocd reset James Simmons
2021-02-09  0:54 ` [lustre-devel] [PATCH 9/9] lustre: lov: return stripe_count=1 instead of 0 for DoM files James Simmons

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=1612832067-1449-4-git-send-email-jsimmons@infradead.org \
    --to=jsimmons@infradead.org \
    --cc=adilger@whamcloud.com \
    --cc=green@whamcloud.com \
    --cc=lustre-devel@lists.lustre.org \
    --cc=neilb@suse.de \
    --cc=wshilong@ddn.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;
as well as URLs for NNTP newsgroup(s).