From: James Simmons <jsimmons@infradead.org>
To: Andreas Dilger <adilger@whamcloud.com>,
Oleg Drokin <green@whamcloud.com>, NeilBrown <neilb@suse.de>
Cc: Lustre Development List <lustre-devel@lists.lustre.org>
Subject: [lustre-devel] [PATCH 8/9] lustre: osc: avoid crash if ocd reset
Date: Mon, 8 Feb 2021 19:54:26 -0500 [thread overview]
Message-ID: <1612832067-1449-9-git-send-email-jsimmons@infradead.org> (raw)
In-Reply-To: <1612832067-1449-1-git-send-email-jsimmons@infradead.org>
From: Andreas Dilger <adilger@whamcloud.com>
Avoid divide-by-zero if OSC obd_connect_data is not fully initialized.
cl_ocd_grant_param is only set after cl_max_extent_pages is OK to use.
WC-bug-id: https://jira.whamcloud.com/browse/LU-14283
Lustre-commit: 1ec58a2e6ef98ba ("LU-14283 osc: avoid crash if ocd reset")
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/41225
Reviewed-by: John L. Hammond <jhammond@whamcloud.com>
Reviewed-by: Wang Shilong <wshilong@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
fs/lustre/include/obd.h | 8 +++++---
fs/lustre/osc/osc_request.c | 11 +++++------
2 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/fs/lustre/include/obd.h b/fs/lustre/include/obd.h
index de62005..9957105 100644
--- a/fs/lustre/include/obd.h
+++ b/fs/lustre/include/obd.h
@@ -206,6 +206,11 @@ struct client_obd {
*/
u32 cl_dom_min_inline_repsize;
+ /* checksumming for data sent over the network */
+ unsigned int cl_checksum:1, /* 0 = disabled, 1 = enabled */
+ cl_checksum_dump:1, /* same */
+ cl_ocd_grant_param:1;
+ /* supported checksum types that are worked out at connect time */
enum lustre_sec_part cl_sp_me;
enum lustre_sec_part cl_sp_to;
struct sptlrpc_flavor cl_flvr_mgc; /* fixed flavor of mgc->mgs */
@@ -334,9 +339,6 @@ struct client_obd {
struct list_head cl_flight_waiters;
u32 cl_rpcs_in_flight;
- /* checksumming for data sent over the network */
- unsigned int cl_checksum:1, /* 0 = disabled, 1 = enabled */
- cl_checksum_dump:1; /* same */
/* supported checksum types that are worked out at connect time */
u32 cl_supp_cksum_types;
/* checksum algorithm to be used */
diff --git a/fs/lustre/osc/osc_request.c b/fs/lustre/osc/osc_request.c
index 8d3688f..be722c9 100644
--- a/fs/lustre/osc/osc_request.c
+++ b/fs/lustre/osc/osc_request.c
@@ -702,7 +702,7 @@ static void osc_announce_cached(struct client_obd *cli, struct obdo *oa,
oa->o_valid |= bits;
spin_lock(&cli->cl_loi_list_lock);
- if (OCD_HAS_FLAG(&cli->cl_import->imp_connect_data, GRANT_PARAM))
+ if (cli->cl_ocd_grant_param)
oa->o_dirty = cli->cl_dirty_grant;
else
oa->o_dirty = cli->cl_dirty_pages << PAGE_SHIFT;
@@ -735,8 +735,7 @@ static void osc_announce_cached(struct client_obd *cli, struct obdo *oa,
nrpages *= cli->cl_max_rpcs_in_flight + 1;
nrpages = max(nrpages, cli->cl_dirty_max_pages);
undirty = nrpages << PAGE_SHIFT;
- if (OCD_HAS_FLAG(&cli->cl_import->imp_connect_data,
- GRANT_PARAM)) {
+ if (cli->cl_ocd_grant_param) {
int nrextents;
/*
@@ -1070,10 +1069,10 @@ void osc_init_grant(struct client_obd *cli, struct obd_connect_data *ocd)
~chunk_mask) & chunk_mask;
/* determine maximum extent size, in #pages */
size = (u64)ocd->ocd_grant_max_blks << ocd->ocd_grant_blkbits;
- cli->cl_max_extent_pages = size >> PAGE_SHIFT;
- if (!cli->cl_max_extent_pages)
- cli->cl_max_extent_pages = 1;
+ cli->cl_max_extent_pages = (size >> PAGE_SHIFT) ? : 1;
+ cli->cl_ocd_grant_param = 1;
} else {
+ cli->cl_ocd_grant_param = 0;
cli->cl_grant_extent_tax = 0;
cli->cl_chunkbits = PAGE_SHIFT;
cli->cl_max_extent_pages = DT_MAX_BRW_PAGES;
--
1.8.3.1
_______________________________________________
lustre-devel mailing list
lustre-devel@lists.lustre.org
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
next prev 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 ` [lustre-devel] [PATCH 3/9] lustre: obdclass: connect vs disconnect race James Simmons
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 ` James Simmons [this message]
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-9-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 \
/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).