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/KmpXSLeo4xMRVR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IsptxArcc4eE8FUbsvdrLC6++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; }