From patchwork Thu Feb 1 06:33:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Nan X-Patchwork-Id: 19776 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:106:209c:c626 with SMTP id mn5csp258857dyc; Wed, 31 Jan 2024 23:02:41 -0800 (PST) X-Google-Smtp-Source: AGHT+IGKxIXLM3geti91qmxtrO7RNt7XdBKFtrFhAFl64kcANJz+HFXO2R9qOEfMfeBgF3I+dP6E X-Received: by 2002:a17:90b:610:b0:293:f46e:a354 with SMTP id gb16-20020a17090b061000b00293f46ea354mr3755992pjb.3.1706770961570; Wed, 31 Jan 2024 23:02:41 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706770961; cv=pass; d=google.com; s=arc-20160816; b=eAjSq63pIl4Rzl9iNZmD/osSX4/fKOMFQBk9DTIgi90X8367HZzYjeOFvevMiDk1qx LKREzW0CGzOhkZPlXSEDfkkka1PUzR52C1pi+CZATBRWRDZdTKvSDHWV8sRNJnXtyaqV QvZPXu60976ZTG9PaCcWtwNjM3WSQxluIPq2h9JklYX+jb5Yl/RUkQyGMS8y7XtYcg3z LQG3modyehRa0XdJW4tPpU8uwEYtDKrs0Q2q4/S36Yn8weWR6nWWBZRdDt/6q2H4k+w8 R0TENzW7QDcOr6tqUY+dwwEztIecQQcYwXEHiaBgYoX6kR5e4O01dylxsHaNKzn26+K5 KrRg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=S+45SppXrwrGnd5aLG1OFt9M5Q7A+WQLjA6ZxLoSm/c=; fh=9I/VtexPW38vKKrs2pih3+N3AeeLSwKvoUJPwhrThUw=; b=whZYySBBLBhjnVMjJEyDT9a6ZNnRcjm1ofDWRMBfAwKZwS6SKxXI/VLTH6G+jcfjNf NVuqRfc85WDU8v6uRYDWC1wvIdzUkIck769YaFICLHXticZC83Mbw5kMYZ5HX2u4YQc3 jlzSuMpEpumhEvftzjKpFEmno3ZYG3GQRMebwH2OXjkO9GxA9V4d6i1KdGGxU94JlzZ7 52D+B6SoSGD50QCEEeWG6YFm4rMRue24RLdMEZkwGzPMo9jIl+f1dH2AKbiZb0LW9sWX sBm1H/xpipiVJoAHXY0R5Px1tFnj4GrtI60BMf+JqCkiCnPuEs+HQ/FCxUAX0OUjg3PU LRUQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-47698-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-47698-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCUsEhEtkHziJHWWb8phZ1KHb/m5DfydNENgQ2SMi462GqK+5tmQenBoKKA2oA7oiDye0HMYf9aaAkWgshn4fCFYAZzsfw== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id d21-20020a17090ab31500b00290b1bfb082si2594114pjr.130.2024.01.31.23.02.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 23:02:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-47698-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-47698-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-47698-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id CF476B230C2 for ; Thu, 1 Feb 2024 06:39:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 53C64159574; Thu, 1 Feb 2024 06:38:36 +0000 (UTC) Received: from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com [45.249.212.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BBC80273FE; Thu, 1 Feb 2024 06:38:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706769514; cv=none; b=nLHUiMgvcBAxxczmBSVFSlY+wJFMPSHngLXkb5m765YnALhp6iRlc8P/mhkFZ9ty1rN+ueoP5BqJLosmVYhCLzj1R1Lc2ePaZozyuWMaDpopS6KOMuH0DPk0KJEU7KhSC7/eTBbEPbE+2su1hMLhVgP+pCJJoLpH5LZNRAZkQOU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706769514; c=relaxed/simple; bh=6Ba++b+T2b+uqsY3Gzwucb+I4SNfKuH1Oe2V2c4TUc4=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=NhYFR/uB8GryqJVneoMdordAsZWCu5rSN/qIsRLv07kZYak3BqPzTIOjjQ3Flni+MHC/q1mVPd4gXd3HZZulZYdiqhMMXi0Els1afa95/bVrD3s0aO54XgRNGjpHA2LLCVgeObC4y22HU2TOcomavvJpS0qrAqyNqe3ioOm9vdk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com; spf=pass smtp.mailfrom=huaweicloud.com; arc=none smtp.client-ip=45.249.212.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huaweicloud.com Received: from mail.maildlp.com (unknown [172.19.163.216]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4TQTkT50tpz4f3kKx; Thu, 1 Feb 2024 14:38:25 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.112]) by mail.maildlp.com (Postfix) with ESMTP id 499241A0199; Thu, 1 Feb 2024 14:38:28 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.104.67]) by APP1 (Coremail) with SMTP id cCh0CgAX5g5iPLtllCl+Cg--.15155S4; Thu, 01 Feb 2024 14:38:28 +0800 (CST) From: linan666@huaweicloud.com To: song@kernel.org, neilb@suse.com, mariusz.tkaczyk@linux.intel.com, shli@fb.com Cc: linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org, linan666@huaweicloud.com, yukuai3@huawei.com, yi.zhang@huawei.com, houtao1@huawei.com, yangerkun@huawei.com Subject: [PATCH v5 0/8] bugfix of MD_CLOSING and clean up md_ioctl() Date: Thu, 1 Feb 2024 14:33:56 +0800 Message-Id: <20240201063404.772797-1-linan666@huaweicloud.com> X-Mailer: git-send-email 2.39.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-CM-TRANSID: cCh0CgAX5g5iPLtllCl+Cg--.15155S4 X-Coremail-Antispam: 1UD129KBjvdXoWrurWUArWxuw4fXr1rCrW5trb_yoWfCwc_ZF WkXF98Wr18CF13Ka4YvF1jyrW8tr40934UJF42kr42yw1xJ3W5Zr4DXFsxXw18XayI9FsY 9ryDAw4IyanFqjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbfkFF20E14v26r4j6ryUM7CY07I20VC2zVCF04k26cxKx2IYs7xG 6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8w A2z4x0Y4vE2Ix0cI8IcVAFwI0_Ar0_tr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Gr1j 6F4UJwA2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xvwVC2z280aVCY1x0267AKxVW0oV Cq3wAac4AC62xK8xCEY4vEwIxC4wAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC 0VAKzVAqx4xG6I80ewAv7VC0I7IYx2IY67AKxVWUGVWUXwAv7VC2z280aVAFwI0_Jr0_Gr 1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0Y48IcxkI7VAKI48JM4x0x7Aq67IIx4CEVc8vx2IE rcIFxwACI402YVCY1x02628vn2kIc2xKxwAKzVCY07xG64k0F24l42xK82IYc2Ij64vIr4 1l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8GjcxK 67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r1q6r43MIIYrxkI7VAKI48JMIIF0xvE2Ix0cI 8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I0E14v26r4j6F4UMIIF0xvE42xK8VAv wI8IcIk0rVWrJr0_WFyUJwCI42IY6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I 0E14v26r4j6r4UJbIYCTnIWIevJa73UjIFyTuYvjfUrc_-DUUUU X-CM-SenderInfo: polqt0awwwqx5xdzvxpfor3voofrz/ X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789679067910679695 X-GMAIL-MSGID: 1789679067910679695 From: Li Nan Changes in v5: - add patches 1-4 to clean up md_ioct(), pathc 4 can help us clean up local variable 'clear_md_closing'. - in patches 5 and 7, clean up local variable 'clear_md_closing'. By the way, md_ioctl() is not readable now, I wanna to re-write it later to make it only have one 'switch' like other drivers. Li Nan (8): md: merge the check of capabilities into md_ioctl_valid() md: changed the switch of RAID_VERSION to if md: clean up invalid BUG_ON in md_ioctl md: return directly before setting did_set_md_closing md: Don't clear MD_CLOSING when the raid is about to stop md: factor out a helper to sync mddev md: sync blockdev before stopping raid or setting readonly md: check mddev->pers before calling md_set_readonly() drivers/md/md.c | 149 ++++++++++++++++++++++++++---------------------- 1 file changed, 80 insertions(+), 69 deletions(-)