From patchwork Fri Jun 30 04:31:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?6IOh546u5paH?= X-Patchwork-Id: 698005 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 99ECEEB64D7 for ; Fri, 30 Jun 2023 04:32:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230104AbjF3EcT (ORCPT ); Fri, 30 Jun 2023 00:32:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231269AbjF3EcQ (ORCPT ); Fri, 30 Jun 2023 00:32:16 -0400 Received: from JPN01-TYC-obe.outbound.protection.outlook.com (mail-tycjpn01olkn2094.outbound.protection.outlook.com [40.92.99.94]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1FE451991 for ; Thu, 29 Jun 2023 21:32:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ATYlzzWBSkofK5ujq++6d0pn3MBxokLQG0bwUtXQtm50gKqqqrlGcn71zd/r4xX+7IKtC95wd9256rbN74SQOa1Gp8qlGMu/Uox38+EaELL8dda/3919GgQ+67DmbF7cIEQbxcPNTy0TLXzX3OQBAtBsPSQ/JJP282usG7RZOtZhdsC5NSIYPJ8lXD+0qRpRRB6kWtpJzjBnT8lTWaJstTRBmCgYsn+1CnwhRm9twfCEpSjbS94Q9H5h8ZZb28inGmnY6gwX3oE9RWqatDwn3lZUPhBjPBYDDG8MOBUHlAkJIwfXmOJcQ//Qj4V1Tkq23V1JiAaz4fNprOr0ndOu+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Zz192BCbRWjAyVN7vgp6u7HW6mi9dh3hSsqJYGmrA9c=; b=bwhU4pimwa1GWLPuwXcqff8Mb6SjrV/gSSH6+apR/JZXZ9VdTItEWknx8PSfFaIRoarKeiS4YjY1gRtA1ZZwP4FRvdiPxoLWFtWG6c6Fj5EHb0mFk3RwL/59VWMrPTSS26N8gdCN/32dNxQE9SgO+HxQxFDBBi/ANqDLFwWWZtOXaFhJXV22OQ7IDhmzItndv/9O2qXqW3PUFa/Pcy6D/scEHKl4JnJOrn5FqOs6HXJ63RWdzHstbfnDz06peS4pPumQlqCJIvzab0jqwdwJ9raxLZtWhrNx3jnhSWpqKPfll+dg1BrdLIm094c8Bdnd0h1PPRTSBUUku1SVo3rqUg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Zz192BCbRWjAyVN7vgp6u7HW6mi9dh3hSsqJYGmrA9c=; b=P2OH4J3Nk1buNB84r7In60fsCLinGqi2RLisQ1k3XOkyj04swFYnu67Z7wYFtxRYvULrVU+EmwP47602VeKvimE741HiItyzGBuf+n2oZOf7RU3erLUun9jS9Y/mJVGfmDN9hqaH4rEHQD7jt0vVIyz0kO0/6eLqc3fryWubzZKQzCxWJpqJrDZ7gIMekoDDy9wqCjna6Tj5l+3A0tqPX6eKOYw49QPYLoAw5houRJ3xcRPiZ8HxcaYalDp1rML2PyaKCdPjmcCQ/uF2hO1OM04DvznN+zEar3v3TBZCXQEBhRI8RlsOpH55Wf9Uiq2qLQa9naBQ5LYB8OTWw5TgYg== Received: from OSZP286MB2061.JPNP286.PROD.OUTLOOK.COM (2603:1096:604:180::6) by TYVP286MB3104.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:2ac::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.26; Fri, 30 Jun 2023 04:32:06 +0000 Received: from OSZP286MB2061.JPNP286.PROD.OUTLOOK.COM ([fe80::3bed:4407:7f3d:7387]) by OSZP286MB2061.JPNP286.PROD.OUTLOOK.COM ([fe80::3bed:4407:7f3d:7387%7]) with mapi id 15.20.6521.026; Fri, 30 Jun 2023 04:32:06 +0000 From: Hu Weiwen To: ceph-devel@vger.kernel.org, Xiubo Li , Ilya Dryomov Cc: Venky Shankar , Milind Changire , Hu Weiwen Subject: [PATCH v2 1/4] ceph: refactor mds_namespace comparing Date: Fri, 30 Jun 2023 12:31:14 +0800 Message-ID: X-Mailer: git-send-email 2.37.0.windows.1 In-Reply-To: References: X-TMN: [aQiQDq3aCETGBbhXnpMcc9PsOjEhl6XXei33S5RlWMMHAA21c7qBfkC/4bzYJjAj] X-ClientProxiedBy: TYCP286CA0018.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:263::9) To OSZP286MB2061.JPNP286.PROD.OUTLOOK.COM (2603:1096:604:180::6) X-Microsoft-Original-Message-ID: <20230630043117.808-1-huww98@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: OSZP286MB2061:EE_|TYVP286MB3104:EE_ X-MS-Office365-Filtering-Correlation-Id: 7be1de52-1fbd-4dc0-9bc5-08db7922f550 X-MS-Exchange-SLBlob-MailProps: znQPCv1HvwUykhYCLh9DY1CjAm5WozgfRwn+o4EQ56EuCLDwElT1aTkka6HxDeooC3ez6y8Hf/IyOpoMi5K9qeFOEwkJgPZ318vOcjdxTW/SBP6bbt6p+jxsXDIDUobyF6VhEia03H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b8Q5ZTqhcvpR1mmc2uxeA14HDP9A7a7/TzhUuOr8/0vjibfwJ9bWvlBLPMVPgHk8JSgdkYTU1HhkrDg7wcwnN2JWopule+EflyjYptFqDUQUCcKnvns+Df5heyRjKh0dByIIhuoESdSC5i5l3ds6UqMwGlGNdKUun+2LjAlxXsyasI+D7oW2k/fzjsN4mjqGu2r+pSCGF76Z52B+LqgfLDMSe//TDtGRG2qjHDpEK+GrGHEhz977h5JlxswO8ginoRHzsBGXwHOwEFgxOQqgxvjOCBLhkPK9Pwb+FZynrWCm3Ul8UmnrH9xIFcGkyUZ2FjwNZ6prJ6gtdtvMqU7QaIP0MP4UR5ZRqBUevDZHRLDcRDkRPpzvidcJQY/dAkJJ5jV0BwBO+ohq41QPwx07b01kIH5m5PfPm1Vd7V/uOW4moMmaqbFRanhWDaCT18dtgq5b8APwOId2Bf1aTfdrL2s+knTIKjNQTa3wdif1iaIuLWZModP/B+OHBP6Sw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7be1de52-1fbd-4dc0-9bc5-08db7922f550 X-MS-Exchange-CrossTenant-AuthSource: OSZP286MB2061.JPNP286.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jun 2023 04:32:06.1399 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYVP286MB3104 Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org Same logic, slightly less code. Make the following changes easier. Signed-off-by: Hu Weiwen --- fs/ceph/super.c | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/fs/ceph/super.c b/fs/ceph/super.c index 3fc48b43cab0..9185ff00bb61 100644 --- a/fs/ceph/super.c +++ b/fs/ceph/super.c @@ -235,18 +235,10 @@ static void canonicalize_path(char *path) path[j] = '\0'; } -/* - * Check if the mds namespace in ceph_mount_options matches - * the passed in namespace string. First time match (when - * ->mds_namespace is NULL) is treated specially, since - * ->mds_namespace needs to be initialized by the caller. - */ -static int namespace_equals(struct ceph_mount_options *fsopt, - const char *namespace, size_t len) +/* check if s1 (null terminated) equals to s2 (with length len2) */ +static int strstrn_equals(const char *s1, const char *s2, size_t len2) { - return !(fsopt->mds_namespace && - (strlen(fsopt->mds_namespace) != len || - strncmp(fsopt->mds_namespace, namespace, len))); + return !strncmp(s1, s2, len2) && s1[len2] == '\0'; } static int ceph_parse_old_source(const char *dev_name, const char *dev_name_end, @@ -297,12 +289,13 @@ static int ceph_parse_new_source(const char *dev_name, const char *dev_name_end, ++fs_name_start; /* start of file system name */ len = dev_name_end - fs_name_start; - if (!namespace_equals(fsopt, fs_name_start, len)) + if (!fsopt->mds_namespace) { + fsopt->mds_namespace = kstrndup(fs_name_start, len, GFP_KERNEL); + if (!fsopt->mds_namespace) + return -ENOMEM; + } else if (!strstrn_equals(fsopt->mds_namespace, fs_name_start, len)) { return invalfc(fc, "Mismatching mds_namespace"); - kfree(fsopt->mds_namespace); - fsopt->mds_namespace = kstrndup(fs_name_start, len, GFP_KERNEL); - if (!fsopt->mds_namespace) - return -ENOMEM; + } dout("file system (mds namespace) '%s'\n", fsopt->mds_namespace); fsopt->new_dev_syntax = true; @@ -417,11 +410,12 @@ static int ceph_parse_mount_param(struct fs_context *fc, param->string = NULL; break; case Opt_mds_namespace: - if (!namespace_equals(fsopt, param->string, strlen(param->string))) + if (!fsopt->mds_namespace) { + fsopt->mds_namespace = param->string; + param->string = NULL; + } else if (strcmp(fsopt->mds_namespace, param->string)) { return invalfc(fc, "Mismatching mds_namespace"); - kfree(fsopt->mds_namespace); - fsopt->mds_namespace = param->string; - param->string = NULL; + } break; case Opt_recover_session: mode = result.uint_32; From patchwork Fri Jun 30 04:31:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?6IOh546u5paH?= X-Patchwork-Id: 699265 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EEF0FEB64D7 for ; Fri, 30 Jun 2023 04:32:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230241AbjF3Ecz (ORCPT ); Fri, 30 Jun 2023 00:32:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229910AbjF3Ecx (ORCPT ); Fri, 30 Jun 2023 00:32:53 -0400 Received: from JPN01-OS0-obe.outbound.protection.outlook.com (mail-os0jpn01olkn20821.outbound.protection.outlook.com [IPv6:2a01:111:f403:700c::821]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB3CA1BCC for ; Thu, 29 Jun 2023 21:32:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RN9H9sgGlbjE4TpbpD2lligPmeL6GX39Uy79mJntKLtVz58+coog45Y6CiIf21Ve4H8tyGCf7qxPYdLl23lclIXZ8ECjYB7p4xaTxf4UPkgJdzg3J1WVPahGqGUBSepVMeNy/pAvQSO+us3ZY2eHGexGbtPKWxmWeVK0uxsoPwduywMCmc5NmAfJdI+tmcgqH1pbCsK+Hwftu15vFDapKZtdmFL7AsQB1tbLCJfl8VYd1YV90Qz2izyLGAVC9dz+zBE5yWyucYACGgWzPLJ30vs8/8vb4owYqKP9ZRCklPk4vo8nzUnl4L/byJ32MxSnHVodpKA9a6MdgwNPrNQpBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ti76pspkndoDJEU86V0p3Rb9Qc9FKmes/YA3uPzysD4=; b=UjRpNIH/1++BOXBGlORSlugqpt5arxaPTzdpLCipf+1xfNpP0cgqabCu8WjqttTxdlexFsLVHlIpAYESiO9dAW7ZpyVMqf2RiJRLT422F7nf86WpMDZihWO8fMt4JXIX4v7mYQlPOBCgYs5dilpe13nlhVXcgWRral360NfKPihNb5d/TCD/+UcV8TWte0e85fXWKnQzvaV/cyHUm3mVMcyS9kyD7jTr4WwvcXfajbiuhhaQ8Boe1RPt6yZnxAGHUZdB9g3kFwht40BYEW6G6QNcsBMJ/YSWmX5yLkk+q0zsxcdYe6FX5L5SIr/ai659stxnf4mW7Unz3yPrDWdnmQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ti76pspkndoDJEU86V0p3Rb9Qc9FKmes/YA3uPzysD4=; b=LJTDHl6ST9pzebgtxO6tqOnLT8Y40gPM+11Tk0loC7dlv6tOfQ7VKNlQCAGLqy/s40VzAk8Pw37tySNPqhHVtHwYQ12LtqBP0k/g+y3PSlbPOXFIqK8jPOmdNvG9t2qyw002CS0SjsplpEiYZDqhpuzjmwCHpeOlE2Ouklak9UeSRsPxrOgs9QFlePVACVzJjQWT3Dy2GsWOLj01bfpKfs/JxUD4OTs834ctRPidrqicgmY84kYQEx+5QG66eckmpk4dL3g+IxVVOnvk75URO7dxxvw1zqvMsgyqomEAFSi0cVdXNAF/HtyoxQpybpMg7/HLuyLKp/+SbJHbiTJSjw== Received: from OSZP286MB2061.JPNP286.PROD.OUTLOOK.COM (2603:1096:604:180::6) by TYVP286MB3104.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:2ac::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.26; Fri, 30 Jun 2023 04:32:44 +0000 Received: from OSZP286MB2061.JPNP286.PROD.OUTLOOK.COM ([fe80::3bed:4407:7f3d:7387]) by OSZP286MB2061.JPNP286.PROD.OUTLOOK.COM ([fe80::3bed:4407:7f3d:7387%7]) with mapi id 15.20.6521.026; Fri, 30 Jun 2023 04:32:44 +0000 From: Hu Weiwen To: ceph-devel@vger.kernel.org, Xiubo Li , Ilya Dryomov Cc: Venky Shankar , Milind Changire , Hu Weiwen Subject: [PATCH v2 2/4] ceph: save name and fsid in mount source Date: Fri, 30 Jun 2023 12:31:15 +0800 Message-ID: X-Mailer: git-send-email 2.37.0.windows.1 In-Reply-To: References: X-TMN: [DbI5iPeJsbszmN2HH/q559/L9uesn6UvnCF05SVqOfWBJpeBEg264VgUDjA8AR2s] X-ClientProxiedBy: TYCP286CA0018.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:263::9) To OSZP286MB2061.JPNP286.PROD.OUTLOOK.COM (2603:1096:604:180::6) X-Microsoft-Original-Message-ID: <20230630043117.808-2-huww98@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: OSZP286MB2061:EE_|TYVP286MB3104:EE_ X-MS-Office365-Filtering-Correlation-Id: a3b4daff-8c98-4457-800a-08db79230c12 X-MS-Exchange-SLBlob-MailProps: AZnQBsB9XmriMkceEMr8g80clrkPP2EpPRBdXDaE0qpjX3HoYn6s3vUnZwOFcG9Q/VHNNuGSj2bWRsyrhWJBDiTferCMauL3aN28MPDj4XuPpnlh4fJxMT7N1zvS7g2OQeq52zAS/KmpXSLeo4xMRV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82IsptxArcc4eE8FUbsvdrLC6++1QpTAv8eAqVOOn568SVdvJFQ0lATqpirPAw+RKsEy81edHnein12YYoXHIXKGCATCQNPd173Rwsmyp+Ld4Fdtm7DgW+i1uGeRbz+EvJ/FlseUPFFxr30Hu1SaOrvJmzEIT5h8c0dy6yoUdenjR0vaLCIu9r6DrSz1uyFL1UO7lbNwXRKYQsktWQJojqCUB4dUMFQxquShe14WaiFnnOdavj2ksGHQUvYMfyzMZqQYhguDbTgQjsgNKoonSRYbF19DrK2nY8KExgr32mTH3ZzWIuvFFOulSC0AoL3aAghHmtUizw2mefw4u2ZTD360978VVI1Qi+Dml6nV53rPcmJRrj49Od6yxdqK4o17Z6N0iN9mIWA86L95C2emoEg5EfMdNX+Yx7My9MDlGm1sItUnZE/a+YXuzf8TM74Ln1X2R5Va+XEJu8cjx++qji9XIRcTEPTZkLkWZQVcDg8E83BjMCZqOdnZtq1/psmuPN2mQQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: a3b4daff-8c98-4457-800a-08db79230c12 X-MS-Exchange-CrossTenant-AuthSource: OSZP286MB2061.JPNP286.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jun 2023 04:32:44.3120 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYVP286MB3104 Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org We have name and fsid in the new device syntax. It is confusing that the kernel accept these info but do not take them into account when connecting to the cluster. Although the mount.ceph helper program will extract the name from device spec and pass it as name options, these changes are still useful if we don't have that program installed, or if we want to call `mount()' directly. Signed-off-by: Hu Weiwen --- fs/ceph/super.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/fs/ceph/super.c b/fs/ceph/super.c index 9185ff00bb61..3d36ee4543ed 100644 --- a/fs/ceph/super.c +++ b/fs/ceph/super.c @@ -267,6 +267,7 @@ static int ceph_parse_new_source(const char *dev_name, const char *dev_name_end, struct ceph_fsid fsid; struct ceph_parse_opts_ctx *pctx = fc->fs_private; struct ceph_mount_options *fsopt = pctx->opts; + struct ceph_options *copts = pctx->copts; char *fsid_start, *fs_name_start; if (*dev_name_end != '=') { @@ -285,6 +286,12 @@ static int ceph_parse_new_source(const char *dev_name, const char *dev_name_end, if (ceph_parse_fsid(fsid_start, &fsid)) return invalfc(fc, "Invalid FSID"); + if (!(copts->flags & CEPH_OPT_FSID)) { + copts->fsid = fsid; + copts->flags |= CEPH_OPT_FSID; + } else if (ceph_fsid_compare(&fsid, &copts->fsid)) { + return invalfc(fc, "Mismatching cluster FSID between mount source and options"); + } ++fs_name_start; /* start of file system name */ len = dev_name_end - fs_name_start; @@ -294,10 +301,20 @@ static int ceph_parse_new_source(const char *dev_name, const char *dev_name_end, if (!fsopt->mds_namespace) return -ENOMEM; } else if (!strstrn_equals(fsopt->mds_namespace, fs_name_start, len)) { - return invalfc(fc, "Mismatching mds_namespace"); + return invalfc(fc, "Mismatching mds_namespace between mount source and options"); } dout("file system (mds namespace) '%s'\n", fsopt->mds_namespace); + len = fsid_start - dev_name - 1; + if (!copts->name) { + copts->name = kstrndup(dev_name, len, GFP_KERNEL); + if (!copts->name) + return -ENOMEM; + } else if (!strstrn_equals(copts->name, dev_name, len)) { + return invalfc(fc, "Mismatching cephx name between mount source and options"); + } + dout("cephx name '%s'\n", copts->name); + fsopt->new_dev_syntax = true; return 0; } From patchwork Fri Jun 30 04:31:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?6IOh546u5paH?= X-Patchwork-Id: 698004 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9ECF9EB64D7 for ; Fri, 30 Jun 2023 04:33:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230447AbjF3Edb (ORCPT ); Fri, 30 Jun 2023 00:33:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230308AbjF3Eda (ORCPT ); Fri, 30 Jun 2023 00:33:30 -0400 Received: from JPN01-OS0-obe.outbound.protection.outlook.com (mail-os0jpn01olkn2099.outbound.protection.outlook.com [40.92.98.99]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6E3F1FC3 for ; Thu, 29 Jun 2023 21:33:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WpWkIE7CbdJmoNoRcDADbrApz9UO/AB7W1nJNiIxlv2w0Uvmiv8IIaDLLrZ/knUBn+JWV2sP1SyQkJnlyjYId41f7EQ2JYNZTGlw4oR/NzhL6bmEBD2EeY756harGLmwwE964ALug8Z/BtgopSTWpwRMtwVtTqapjhxc5xBaXyLze4p6RYkLkOnHQFckVADXLBaPgFQu2Xa4yArNEUd1APQDn9LeIr0CTkwOyPlsMX9ufuJG9Nfp6cAXetSLGRRsd1BZPLvYe5PGeEes4+rQtQOTuusaaN1F62skl8Y2qtJt4iU1qhV40ckoBlbA5R/ydJopVUsAEWZmHtr55p4jVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=bMsXIM9bVVm5GBeuG+4pWUUfWaKiaYyoRayiK4bNsxQ=; b=hG6/RsJa0ka7ZWpMvupgIkJwM2fzi3UBD7+R5NjIu028HSbQAZQi4TBJHTHWXRJKr78ROOhA3CDPMe2fMLzlesm9J8dQFOLtk+uLAGkWR9wPSnFEQilLOT0n/j9woikN4N56esDPoV3eAUGdlAXVnuQyfTE2oy0jYbFJ6eZoZt0nlOdanL8sKYqlO5NH6XN3ZrsekPGybW16eAWoI04dJCg1DSZ2H8Ez4ysZPRfmir6zY/P9pVlaxdmMJYn501PdDekakDYZM3NRDMdqUw5c+xta/K9tDBjvo4wE3e1FLQeN6LhSiDkJxS0mG7q1UuqAiyhHSIEx01OELu06cFCahA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=bMsXIM9bVVm5GBeuG+4pWUUfWaKiaYyoRayiK4bNsxQ=; b=rjGhCoaYANBLZDxxVBiZ+OzKYGHpM9NECW4O5cCup8gyWiFo4CHa5eSLr/7zZEHtT7SBSyIA4tr2x7pIZz/2plYQb/CS92WT4cezrxMCMAkc7TcQ5t4DzwbSOvc/eSc5GCg/2ldGUk4gwFlM5z+Q/YiHHi2TmzdEeHpEEqiBw8U1MPHfnaMXJA29iZvHKNc2HFnWEL7WiMOiDQ8By2V5YMHtDtaKPzTRK2UfEf8erEcKoLRCBoPlB8aUM9MIbKMwYAHK6GzjapAchBKVHAM4PC1KqDCDFse5vgw6MrpK310gV3x7GrAb/5BZpWC8xvhKTYYGa/pxxsYR1YCnVNzpPQ== Received: from OSZP286MB2061.JPNP286.PROD.OUTLOOK.COM (2603:1096:604:180::6) by TYVP286MB3104.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:2ac::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.26; Fri, 30 Jun 2023 04:33:25 +0000 Received: from OSZP286MB2061.JPNP286.PROD.OUTLOOK.COM ([fe80::3bed:4407:7f3d:7387]) by OSZP286MB2061.JPNP286.PROD.OUTLOOK.COM ([fe80::3bed:4407:7f3d:7387%7]) with mapi id 15.20.6521.026; Fri, 30 Jun 2023 04:33:25 +0000 From: Hu Weiwen To: ceph-devel@vger.kernel.org, Xiubo Li , Ilya Dryomov Cc: Venky Shankar , Milind Changire , Hu Weiwen Subject: [PATCH v2 3/4] ceph: delay parsing of source after all options Date: Fri, 30 Jun 2023 12:31:17 +0800 Message-ID: X-Mailer: git-send-email 2.37.0.windows.1 In-Reply-To: References: X-TMN: [P9Y1PxySJninHQf5cxCDS0A6JcMs9LcEtsfGvjEKrrwh35RyW/vgLh9tS9D3g8Ub] X-ClientProxiedBy: TYCP286CA0018.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:263::9) To OSZP286MB2061.JPNP286.PROD.OUTLOOK.COM (2603:1096:604:180::6) X-Microsoft-Original-Message-ID: <20230630043117.808-3-huww98@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: OSZP286MB2061:EE_|TYVP286MB3104:EE_ X-MS-Office365-Filtering-Correlation-Id: d7ff26cf-a1cd-4bf5-ebdc-08db79232496 X-MS-Exchange-SLBlob-MailProps: AZnQBsB9XmriMkceEMr8g80clrkPP2EpeK/4mJkdXPOfHrkRcGE0Ejs+d7n1lPbkWzeBH0W8QcUdqzNRZLjywtIHzRNlYeJ3pmDWsFfjR29A9EGi8oR+wQxWa7QLOy8Ldgl/wm3+0YXkQb1JN4Gnt4PY5Pn9e8BQ/Xjodz7XbLJXXC4vY96vmx0ToVjkuQmLUbrB4Gf7TneBbXHOahnZosmAMVJz7SceEFG2UoXe1a3FI/9NIj91A+mlncjBiVm8Gn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vBUeEy2uK/J5D38+fU9zcQQfwUWBnhi+mIYrmsox5SSMlfLw56Q6Lyt7z55dK6SLUR/r//KLO1hNHDheF2ilAVshpvAOyunAj3GE/iq7NCrgVJh2Akyv1VYLKt6qf+X773oCiaJiR2r8igsmB1lVXKe3O52Th/ZY8U3oEdmxR8oyBQRy/8u4JsImbXIazJD/455BtOzPzSvk8QRU5AHXfGH2MNYkJj1x5Oa1tMCDjGIAjjYMey32lo2nyU53iBBkFe3uSehgp1OxR7pV6cSCSTpfU+1kgi+Eq/DBSRDf1P5zOeDaugbkv6KPZN1kngvK2LXf8D3TJzW9J2vGHWnaYrUMWavnXYJsuOUstjZmct/uqp9vFvenXGQgI1ZiZdmpFISZhqFq0wc6dlg== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: d7ff26cf-a1cd-4bf5-ebdc-08db79232496 X-MS-Exchange-CrossTenant-AuthSource: OSZP286MB2061.JPNP286.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jun 2023 04:33:25.3463 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYVP286MB3104 Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org Ensure the name, fsid, and mds_namespace in source are consistent with these in options. Signed-off-by: Hu Weiwen --- fs/ceph/super.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/fs/ceph/super.c b/fs/ceph/super.c index 3d36ee4543ed..e66867efd811 100644 --- a/fs/ceph/super.c +++ b/fs/ceph/super.c @@ -149,7 +149,6 @@ enum { Opt_snapdirname, Opt_mds_namespace, Opt_recover_session, - Opt_source, Opt_mon_addr, /* string args above */ Opt_dirstat, @@ -202,7 +201,6 @@ static const struct fs_parameter_spec ceph_mount_parameters[] = { fsparam_flag_no ("require_active_mds", Opt_require_active_mds), fsparam_u32 ("rsize", Opt_rsize), fsparam_string ("snapdirname", Opt_snapdirname), - fsparam_string ("source", Opt_source), fsparam_string ("mon_addr", Opt_mon_addr), fsparam_u32 ("wsize", Opt_wsize), fsparam_flag_no ("wsync", Opt_wsync), @@ -337,11 +335,11 @@ static int ceph_parse_new_source(const char *dev_name, const char *dev_name_end, * is [:] * is optional, but if present must begin with '/' */ -static int ceph_parse_source(struct fs_parameter *param, struct fs_context *fc) +static int ceph_parse_source(struct fs_context *fc) { struct ceph_parse_opts_ctx *pctx = fc->fs_private; struct ceph_mount_options *fsopt = pctx->opts; - char *dev_name = param->string, *dev_name_end; + const char *dev_name = fc->source, *dev_name_end; int ret; dout("%s '%s'\n", __func__, dev_name); @@ -383,8 +381,6 @@ static int ceph_parse_source(struct fs_parameter *param, struct fs_context *fc) return ret; } - fc->source = param->string; - param->string = NULL; return 0; } @@ -443,10 +439,6 @@ static int ceph_parse_mount_param(struct fs_context *fc, else BUG(); break; - case Opt_source: - if (fc->source) - return invalfc(fc, "Multiple sources specified"); - return ceph_parse_source(param, fc); case Opt_mon_addr: return ceph_parse_mon_addr(param, fc); case Opt_wsize: @@ -1220,6 +1212,10 @@ static int ceph_get_tree(struct fs_context *fc) if (!fc->source) return invalfc(fc, "No source"); + err = ceph_parse_source(fc); + if (err < 0) + return err; + if (fsopt->new_dev_syntax && !fsopt->mon_addr) return invalfc(fc, "No monitor address"); @@ -1301,6 +1297,12 @@ static int ceph_reconfigure_fc(struct fs_context *fc) struct ceph_parse_opts_ctx *pctx = fc->fs_private; struct ceph_mount_options *fsopt = pctx->opts; struct ceph_fs_client *fsc = ceph_sb_to_client(fc->root->d_sb); + int err; + + /* validate source and options are still consistent */ + err = ceph_parse_source(fc); + if (err < 0) + return err; if (fsopt->flags & CEPH_MOUNT_OPT_ASYNC_DIROPS) ceph_set_mount_opt(fsc, ASYNC_DIROPS); From patchwork Fri Jun 30 04:31:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?6IOh546u5paH?= X-Patchwork-Id: 699264 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D90CDEB64D7 for ; Fri, 30 Jun 2023 04:33:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230474AbjF3Edi (ORCPT ); Fri, 30 Jun 2023 00:33:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230333AbjF3Edg (ORCPT ); Fri, 30 Jun 2023 00:33:36 -0400 Received: from JPN01-OS0-obe.outbound.protection.outlook.com (mail-os0jpn01olkn2035.outbound.protection.outlook.com [40.92.98.35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD55F1991 for ; Thu, 29 Jun 2023 21:33:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LqvBnJqs87wm8LzrY2mCwZqQYST0RrGaZtfT5GRaE+VVh6PV1o9i4vKi3RP0I2v6LJER5cuRiLUi+GG5rrtO6BD4l+U14TsURVTdJpIn2CZ7sOhr686YkpDHECdLVYQ1DOGw+1bgkrarVlqdIIgQfoJ8V+Bwqh0hWO7SmgUTYJ3X+0gaOSkihd3RAqpFlbWwUZa4swlX3/3PXXUn7+Nzvb5uXiCsIvWfJGo85lLY9F70U9KHx1ZVfPGU79zHzjmHZdJUEk3k984fPmgb20KTJdrpNuQHqEJQhMywXDW+Sb3TMUhAjA1xv+KYDs4PXGzvwPNeMQmESZSGqTapyCy2FA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=1HRK8LULbCKN8V/de2Xj8SA8CDQeJt/EX5pIMo6RCGs=; b=e9IHgTPercFEhKxPrFBMoFXYh9liw6oqWMVGI2DotDrB2nQv/bGfuxHBwYnl6YWWBjPZWplVccAUCU3F03tPCeVnoMs+Xelplvf03kg3xqvhbB4I3A7VhCv3tD9OsZOldPbYayRzjZJx5LymN1J4m9AOOQnVdCpJHcDly+cnLuviZsxZAMQb6n8dSnMkZ9II11fTaeSu3X8LxxjdvST2kuxtXncWHKOfl8OhBzHkPS7KNFBUgDQq3Z0HP4IRyLJOAl4O7Fz3lN7mIr6fOEYHb44wCYvyTQSpUbobNmuLBhAf2oDj/EDaAb4fviENCRur8JkKOEvj7j15Vu+HU2NFNw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1HRK8LULbCKN8V/de2Xj8SA8CDQeJt/EX5pIMo6RCGs=; b=avjr7/GUznJWxpDiei8TFG3l2lyeVm42y5fTZGYHulmVNM1pm2gxCkOXT/Hl5M2v6GHYpjAHiGaG32FE0jvpaKSF9Z2xv3rS9O3j2t11L9pwIme2dGP8ghXLvCYoK/tvIRoU/Mn95u9tvYXRTVJ4NHJb9NUtdmltBHaqCnueFoNn+inlA9+5auYBcXYij1FjmwNc9ZOfN9YWvevCBv41Mh5jao5krtmSEn7iKYtJJ1EzsW/dvVLfVHCiYH2LTBIhBjR3z81n130bBnrOleoStbolAmQauPvMSN9xt9v2sMxW3g9sPSR4SsaTTKX3qSUSFpfGJECl6nkFZLG1hTLImQ== Received: from OSZP286MB2061.JPNP286.PROD.OUTLOOK.COM (2603:1096:604:180::6) by TYVP286MB3104.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:2ac::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.26; Fri, 30 Jun 2023 04:33:32 +0000 Received: from OSZP286MB2061.JPNP286.PROD.OUTLOOK.COM ([fe80::3bed:4407:7f3d:7387]) by OSZP286MB2061.JPNP286.PROD.OUTLOOK.COM ([fe80::3bed:4407:7f3d:7387%7]) with mapi id 15.20.6521.026; Fri, 30 Jun 2023 04:33:32 +0000 From: Hu Weiwen To: ceph-devel@vger.kernel.org, Xiubo Li , Ilya Dryomov Cc: Venky Shankar , Milind Changire , Hu Weiwen Subject: [PATCH v2 4/4] ceph: allow mds_namespace to appear multiple times Date: Fri, 30 Jun 2023 12:31:18 +0800 Message-ID: X-Mailer: git-send-email 2.37.0.windows.1 In-Reply-To: References: X-TMN: [pAfvguyz4MJYm0DSq8WImqrJ6zbZmkXeIeJAozzvYCOexI5TA3Uoq4M5FZIufYeY] X-ClientProxiedBy: TYCP286CA0018.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:263::9) To OSZP286MB2061.JPNP286.PROD.OUTLOOK.COM (2603:1096:604:180::6) X-Microsoft-Original-Message-ID: <20230630043117.808-4-huww98@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: OSZP286MB2061:EE_|TYVP286MB3104:EE_ X-MS-Office365-Filtering-Correlation-Id: 8f9900f0-dfd8-4df2-bd30-08db7923290c X-MS-Exchange-SLBlob-MailProps: AZnQBsB9XmriMkceEMr8g80clrkPP2EpJyaAv0Smh8r89MNBty/8vPmbTk5mjjiDhN+SoyBvco/lB0n1Nwe5GEY71HqsSsFC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QWTY4M6oTrB4w0vDF6pbcbaT6lcsezNl9bdQzqj++BU4h7IKVTK+JRbSCs/NEVUGUa1vDkfgmcEHk0qHuB913hXaj08vQW1hynjgmFKHDEOqze6JYna0JL9jVYGM8qFIRIcgb2Wkb+Qd5gz+Zg6vMHMT55kLmawursu+Vukytt3BnfwhIWjiVoZNp22eeZDzDClgLVx+PRlA+eqdOjg66ahf6rK+D5Ei/0HU0T0TpPnDMN39NLb7nSthguSqh0BWbRfMGgLnxl637ntu/lPCCtEhf+Sp6xVVX22M7KAJy+Rz9rdsJ4+JhqFbv01jjPap0t4M8z/e3IRhfS49r9BCw4cxHkxknhjI+0Q/RLcU56TMjpkQ0pU4Ig8gmcS32b4QSud9StR9kcze/tw7vzjJ3HkA37Rsct3E+kGrJXEtP/yvfc4HhVanR+5KxlmNi57sKvZLmFBhT09JDk/N6OZ6VQaZ/r/m/JXqDMPVjqZ8e7XOt27wRRazmG7zL7YNR1T8CGE1UPk9+C7VI9kJBm3mYzrRsHaKi9E5cN4CMZw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8f9900f0-dfd8-4df2-bd30-08db7923290c X-MS-Exchange-CrossTenant-AuthSource: OSZP286MB2061.JPNP286.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jun 2023 04:33:32.8653 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYVP286MB3104 Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org To be consistent with other options. It will still be rejected if its final value is inconsistent with mount source. Signed-off-by: Hu Weiwen --- fs/ceph/super.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/fs/ceph/super.c b/fs/ceph/super.c index e66867efd811..96aba62fdcba 100644 --- a/fs/ceph/super.c +++ b/fs/ceph/super.c @@ -423,12 +423,9 @@ static int ceph_parse_mount_param(struct fs_context *fc, param->string = NULL; break; case Opt_mds_namespace: - if (!fsopt->mds_namespace) { - fsopt->mds_namespace = param->string; - param->string = NULL; - } else if (strcmp(fsopt->mds_namespace, param->string)) { - return invalfc(fc, "Mismatching mds_namespace"); - } + kfree(fsopt->mds_namespace); + fsopt->mds_namespace = param->string; + param->string = NULL; break; case Opt_recover_session: mode = result.uint_32;