From patchwork Mon Sep 30 18:56:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Simmons X-Patchwork-Id: 11167331 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BB45713B1 for ; Mon, 30 Sep 2019 19:08:12 +0000 (UTC) Received: from pdx1-mailman02.dreamhost.com (pdx1-mailman02.dreamhost.com [64.90.62.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A260B224EF for ; Mon, 30 Sep 2019 19:08:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A260B224EF Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lustre-devel-bounces@lists.lustre.org Received: from pdx1-mailman02.dreamhost.com (localhost [IPv6:::1]) by pdx1-mailman02.dreamhost.com (Postfix) with ESMTP id B6AB2602DC5; Mon, 30 Sep 2019 12:01:39 -0700 (PDT) X-Original-To: lustre-devel@lists.lustre.org Delivered-To: lustre-devel-lustre.org@pdx1-mailman02.dreamhost.com Received: from smtp4.ccs.ornl.gov (smtp4.ccs.ornl.gov [160.91.203.40]) by pdx1-mailman02.dreamhost.com (Postfix) with ESMTP id 2AD1F5C3B82 for ; Mon, 30 Sep 2019 11:57:39 -0700 (PDT) Received: from star.ccs.ornl.gov (star.ccs.ornl.gov [160.91.202.134]) by smtp4.ccs.ornl.gov (Postfix) with ESMTP id BAF7E1005F97; Mon, 30 Sep 2019 14:56:57 -0400 (EDT) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id B9E96B5; Mon, 30 Sep 2019 14:56:57 -0400 (EDT) From: James Simmons To: Andreas Dilger , Oleg Drokin , NeilBrown Date: Mon, 30 Sep 2019 14:56:25 -0400 Message-Id: <1569869810-23848-127-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1569869810-23848-1-git-send-email-jsimmons@infradead.org> References: <1569869810-23848-1-git-send-email-jsimmons@infradead.org> Subject: [lustre-devel] [PATCH 126/151] lustre: obd: add check to obd_statfs X-BeenThere: lustre-devel@lists.lustre.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "For discussing Lustre software development." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexander Boyko , Lustre Development List MIME-Version: 1.0 Errors-To: lustre-devel-bounces@lists.lustre.org Sender: "lustre-devel" From: Alexander Boyko The race could happened between mount and lctl get_param. Because procfs files are ready before a full obd initialization. For example: 3372:0:(dt_object.h:2509:dt_statfs()) ASSERTION( dev ) 3372:0:(dt_object.h:2509:dt_statfs()) LBUG Pid: 3372, comm: lctl Call Trace: libcfs_call_trace+0x4e/0x60[libcfs] lbug_with_loc+0x4c/0xb0[libcfs] tgt_statfs_internal+0x2ea/0x350[ptlrpc] ofd_statfs+0x66/0x470 [ofd] lprocfs_filesfree_seq_show+0xf6/0x520 [obdclass] ofd_filesfree_seq_show+0x12/0x20 [ofd] The patch adds a check of completed obd_setup to obd_statfs(). WC-bug-id: https://jira.whamcloud.com/browse/LU-10650 ray-bug-id: LUS-2665 Lustre-commit: 4f40429775c4 ("LU-10650 obd: add check to obd_statfs") Signed-off-by: Alexander Boyko Reviewed-on: https://review.whamcloud.com/31243 Reviewed-by: Alexey Lyashkov Reviewed-by: Andriy Skulysh Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- fs/lustre/include/obd_class.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/lustre/include/obd_class.h b/fs/lustre/include/obd_class.h index dd07ec5..0bbf777 100644 --- a/fs/lustre/include/obd_class.h +++ b/fs/lustre/include/obd_class.h @@ -924,6 +924,10 @@ static inline int obd_statfs(const struct lu_env *env, struct obd_export *exp, if (!obd) return -EINVAL; + rc = obd_check_dev_active(obd); + if (rc) + return rc; + if (!obd->obd_type || !obd->obd_type->typ_dt_ops->statfs) { CERROR("%s: no %s operation\n", obd->obd_name, __func__); return -EOPNOTSUPP;