File mounting method, system and device, computer equipment and readable storage medium
By using the authorization information of the target subdirectory in the file mounting method to create a virtual super block and a target subdirectory super block, the problem of low file system security in multi-tenant scenarios is solved, and data isolation and data access between tenants are achieved. Improvement of efficiency.
Patent Information
- Application Number
- CN202410855377.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-28
- Publication Date
- 2024-09-17
AI Technical Summary
Existing file mounting methods have low security issues in multi-tenant scenarios, causing each tenant to access the entire file system of any tenant.
Determine the target directory in the client through the target subdirectory authorization information sent by the server, create a virtual super block and a target subdirectory super block, establish an association between the target subdirectory and the target directory, and mount the target subdirectory in the target directory. to reduce the file information accessible to tenants and ensure the isolation of data between tenants.
The security of the file mounting method is improved, the isolation of data between tenants is ensured, the data access time is shortened, and the data access efficiency is improved.
Smart Images

Figure CN118656346A
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a file mounting method, system, device, computer equipment, computer-readable storage medium and computer program product. Background Art
[0002] To improve the capacity and performance of the file system, the file mount method is usually used to mount the files on the storage system in the server to the target directory of the POSIX (Portable Operating System Interface) client, so that the POSIX client can access and use multiple different file systems at the same time.
[0003] The current file mounting method obtains the authorization information of the file system that has been authorized by the storage system. The authorization information must include the complete directory information of the file system. Then, the association relationship between the root directory of the file system and the target directory is established based on the complete directory information, so that the root directory of the file system is mounted under the target directory.
[0004] However, in the current file mounting method, in a multi-tenant application scenario, mounting a file system will allow each tenant to access the entire file system of any tenant. Therefore, the current file mounting method has low security. Summary of the invention
[0005] Based on this, it is necessary to provide a file mounting method, system, apparatus, computer device, computer-readable storage medium and computer program product to address the above technical issues.
[0006] In a first aspect, the present application provides a file mounting method, which is applied to a client and includes:
[0007] Determine the target directory in the client according to the authorization information of the target subdirectory sent by the server, and create a virtual super block;
[0008] Acquire metadata information of the target subdirectory, and create a target subdirectory super block corresponding to the target subdirectory according to the metadata information of the target subdirectory;
[0009] The target subdirectory is mounted on the target directory according to the virtual super block and the target subdirectory super block.
[0010] The above file mounting method determines the target directory and creates a virtual super block through the authorization information of the target subdirectory, clarifies the mount point of the target subdirectory, and creates a target subdirectory super block corresponding to the target subdirectory according to the metadata information of the target subdirectory, and obtains the target subdirectory super block storing the target subdirectory information. Then, the target subdirectory is mounted on the target directory through the virtual super block and the target subdirectory super block. By mounting the target subdirectory, the file information accessible to the tenant is reduced, thereby ensuring the isolation of data between tenants and improving the security of the file mounting method.
[0011] In one embodiment, determining the target directory in the client according to the authorization information of the target subdirectory sent by the server and creating a virtual super block includes:
[0012] Receiving authorization information of a target subdirectory sent by a server, and determining a target directory in the client;
[0013] According to the authorization information, a virtual super block corresponding to the target subdirectory is created in the virtual file system;
[0014] Send the authorization information to the server, and receive the authentication result returned by the server; the authorization information is used to verify whether the server authorizes the target subdirectory, and obtain the authentication result;
[0015] In a case where the authentication result indicates that the server authorizes the target sub-directory, the virtual super block is updated based on the target directory.
[0016] In this embodiment, the target subdirectory is authenticated according to the authorization information, thereby ensuring the security of the target subdirectory and improving the security of the file mounting method. A virtual superblock of the target subdirectory is created according to the authorization information, and when the authentication is passed, the virtual superblock is updated based on the target directory, and an association relationship between the target directory and the virtual superblock is established, so that the target subdirectory can be mounted on the target directory based on the virtual superblock later.
[0017] In one embodiment, the authorization information includes a storage system name of the storage system where the target subdirectory is located and a target file system name of the target file system where the target subdirectory is located; after updating the virtual super block based on the target directory, the method further includes:
[0018] According to the storage system name and the target file system name, checking whether there is a target super block corresponding to the target file system in the client module;
[0019] If the target super block does not exist, create the target super block;
[0020] The metadata information of the target file system is obtained from the server, and the target super block is initialized according to the metadata information of the target file system.
[0021] In this embodiment, when the target super block does not exist in the virtual file system, the metadata information of the target file system is obtained, and the target super block is created according to the metadata information of the target file system, so as to facilitate the subsequent access to the target subdirectory based on the target super block. Moreover, the metadata information in the target super block is the original file system metadata architecture, and the original function of the file system is not affected.
[0022] In one embodiment, the authorization information includes a subdirectory path of the target subdirectory, and obtaining metadata information of the target subdirectory and creating a target subdirectory superblock corresponding to the target subdirectory according to the metadata information of the target subdirectory includes:
[0023] Creating a target subdirectory superblock corresponding to the target subdirectory, and obtaining first directory entry information of the target file system where the target subdirectory is located from the server;
[0024] Acquire metadata information of the target subdirectory from the server according to the first directory item information and the subdirectory path;
[0025] Initialize the target subdirectory super block according to the metadata information of the target subdirectory.
[0026] In this embodiment, the target subdirectory super block corresponding to the target subdirectory is created through the metadata information of the target subdirectory, so as to realize the storage of the target subdirectory information on the client, and facilitate the subsequent mounting of the target subdirectory. In addition, the target subdirectory super block has no special restrictions on the depth of the subdirectory path to be mounted, as long as the subdirectory path length meets the Linux (operating system kernel) default path length, which is convenient and flexible to use, and expands the scope of application of the file mounting method.
[0027] In one embodiment, mounting the target subdirectory on the target directory according to the virtual super block and the target subdirectory super block includes:
[0028] Pointing the first pointer of the virtual super block to the second directory entry information of the target subdirectory in the metadata information, so as to associate the target directory with the target subdirectory;
[0029] The second pointer of the virtual super block is pointed to the target sub-directory super block, so that the target sub-directory is mounted on the target directory.
[0030] In this embodiment, by establishing an association relationship between the target directory and the target subdirectory, the target subdirectory is mounted on the target directory. By mounting the target subdirectory, the file information accessible to the tenant is reduced, and the access path of other subdirectories in the file system is blocked, thereby ensuring the isolation of data between tenants and improving the security of the file mounting method. In addition, by mounting the target subdirectory on the target directory, the target subdirectory can be directly accessed through the target directory, which shortens the time to access the target subdirectory and improves data access efficiency.
[0031] In a second aspect, the present application also provides a file mounting device, including:
[0032] The server is used to send the authorization information of the target subdirectory to the client and to perform authorization marking on the metadata information of the target subdirectory;
[0033] The client is used to determine the target directory in the client according to the authorization information of the target subdirectory sent by the server; obtain the metadata information of the target subdirectory, and create a target subdirectory super block corresponding to the target subdirectory according to the metadata information of the target subdirectory; and establish an association relationship between the target subdirectory and the target directory according to the metadata information and the target subdirectory super block, so that the target subdirectory is mounted on the target directory.
[0034] In this embodiment, the server sends the authorization information of the target subdirectory to the client, so that the client can mount the target subdirectory later. Then, the server performs authorization marking on the metadata information of the target subdirectory, thereby preventing the target subdirectory from being deleted on the server side and ensuring that the target subdirectory can be successfully accessed through the client. In addition, the client determines the target directory and creates a virtual super block through the authorization information of the target subdirectory, clarifies the mount point of the target subdirectory, and creates a target subdirectory super block corresponding to the target subdirectory based on the metadata information of the target subdirectory, thereby obtaining a target subdirectory super block storing the target subdirectory information. Then, the target subdirectory is mounted on the target directory through the virtual super block and the target subdirectory super block. By mounting the target subdirectory, the file information accessible to the tenant is reduced, thereby ensuring the isolation of data between tenants and improving the security of the file mounting method.
[0035] In a third aspect, the present application further provides a file mounting device, including:
[0036] A determination module, used to determine the target directory in the client according to the authorization information of the target subdirectory sent by the server, and to create a virtual super block;
[0037] A creation module, used for acquiring metadata information of the target subdirectory, and creating a target subdirectory super block corresponding to the target subdirectory according to the metadata information of the target subdirectory;
[0038] A module is established, for mounting the target subdirectory on the target directory according to the virtual super block and the target subdirectory super block.
[0039] In a fourth aspect, the present application further provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0040] Determine the target directory in the client according to the authorization information of the target subdirectory sent by the server, and create a virtual super block;
[0041] Acquire metadata information of the target subdirectory, and create a target subdirectory super block corresponding to the target subdirectory according to the metadata information of the target subdirectory;
[0042] The target subdirectory is mounted on the target directory according to the virtual super block and the target subdirectory super block.
[0043] In a fifth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the following steps are implemented:
[0044] Determine the target directory in the client according to the authorization information of the target subdirectory sent by the server, and create a virtual super block;
[0045] Acquire metadata information of the target subdirectory, and create a target subdirectory super block corresponding to the target subdirectory according to the metadata information of the target subdirectory;
[0046] The target subdirectory is mounted on the target directory according to the virtual super block and the target subdirectory super block.
[0047] In a sixth aspect, the present application further provides a computer program product, including a computer program, which implements the following steps when executed by a processor:
[0048] Determine the target directory in the client according to the authorization information of the target subdirectory sent by the server, and create a virtual super block;
[0049] Acquire metadata information of the target subdirectory, and create a target subdirectory super block corresponding to the target subdirectory according to the metadata information of the target subdirectory;
[0050] The target subdirectory is mounted on the target directory according to the virtual super block and the target subdirectory super block.
[0051] The above-mentioned file mounting method, system, device, computer equipment, computer-readable storage medium and computer program product determine the target directory in the client according to the authorization information of the target subdirectory sent by the server, and create a virtual super block; obtain the metadata information of the target subdirectory, and create a target subdirectory super block corresponding to the target subdirectory according to the metadata information of the target subdirectory; mount the target subdirectory on the target directory according to the virtual super block and the target subdirectory super block. With this method, the target directory is determined and a virtual super block is created through the authorization information of the target subdirectory, the mount point of the target subdirectory is clarified, and the target subdirectory super block corresponding to the target subdirectory is created according to the metadata information of the target subdirectory, and the target subdirectory super block storing the target subdirectory information is obtained. Then, the target subdirectory is mounted on the target directory through the virtual super block and the target subdirectory super block. By mounting the target subdirectory, the file information accessible to the tenant is reduced, thereby ensuring the isolation of data between tenants and improving the security of the file mounting method. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0053] Figure 1 An application environment diagram of a file mounting method in an embodiment;
[0054] Figure 2 A schematic diagram of the architecture of a POSIX client in one embodiment;
[0055] Figure 3 A schematic diagram showing data after a target file system is mounted in the prior art in one embodiment;
[0056] Figure 4 A schematic diagram of a process flow of a file mounting method in an embodiment;
[0057] Figure 5 A schematic diagram of a process of creating a virtual super block and determining a target directory in one embodiment;
[0058] Figure 6 A schematic diagram of a process for determining a target super block in one embodiment;
[0059] Figure 7 A schematic diagram of a process of creating a target subdirectory superblock in one embodiment;
[0060] Figure 8 A schematic diagram of a process of mounting a target subdirectory to a target directory in one embodiment;
[0061] Fig. 9 A schematic diagram of the relationship between vsb and client module superblock in an exemplary embodiment;
[0062] Fig.10 It is a schematic diagram showing data after subdirectory is mounted in an exemplary embodiment;
[0063] Fig.11 is a structural block diagram of a file mounting device in an embodiment;
[0064] FIG. 12 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0065] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0066] The file mounting method provided in the embodiment of the present application can be applied to Figure 1 In the file mounting system 100 shown, the file mounting system 100 includes a server 110 and a client 120. The server 110 includes a storage system, and the storage system includes a target file system. The client 120 is a POSIX client. Multiple POSIX clients and storage systems form a cluster. Figure 2 This is a schematic diagram of the POSIX client architecture. Figure 2 As shown, the POSIX client includes a management module and a client module. The management module runs in the user state and is responsible for handling the management work of interacting with the storage system in the server 110; the client module runs in the kernel state and is presented to the outside with a standard POSIX file system interface, is responsible for processing the business requests sent by the VFS (Virtual File Systems) layer, and interacts with the storage system for data according to a specific protocol.
[0067] In traditional technology, POSIX clients only support mounting the entire target file system. In an exemplary embodiment, the storage system on the server 110 first authorizes the target file system to a POSIX client. That is, the storage system sends the authorization information of the target file system to the POSIX client. The authorization information must contain the complete directory information of the target file system. The management module on the POSIX client issues a mount command based on the authorization information. The mount command is called by the system, and the VFS calls the client module mount function to mount the target file system to the target directory. That is, an association relationship is established between the target directory and the root directory of the target file system. After the POSIX client mounts the target file system, the tenants of the POSIX client share all the data in the target file system. Figure 3 This is a schematic diagram showing data after the target file system is mounted in the prior art. Figure 3 As shown in the figure, the root directory fs of the target file system is mounted to the target directory / mnt / fs / of the POSIX client, and all the data of the target file system can be read under the target directory ( / mnt / fs / directory). Based on this, in a multi-tenant application scenario, mounting the target file system will allow each tenant to access the entire target file system of any tenant. Therefore, the current file mounting method has low security.
[0068] Based on the above-mentioned traditional technology, the file mounting method provided by the embodiment of the present application determines the target directory and creates a virtual super block through the authorization information of the target subdirectory, clarifies the mount point of the target subdirectory, and creates a target subdirectory super block corresponding to the target subdirectory according to the metadata information of the target subdirectory, and obtains the target subdirectory super block storing the target subdirectory information. Then, the target subdirectory is mounted on the target directory through the virtual super block and the target subdirectory super block. By mounting the target subdirectory, the file information accessible to the tenant is reduced, thereby ensuring the isolation of data between tenants and improving the security of the file mounting method.
[0069] Before introducing the specific embodiments of the present application, the professional terms involved in the present application are explained first:
[0070] 1. Virtual super block, full name struct super_block, abbreviated as vsb, is a container for the metadata of the file system in the virtual file system in the client;
[0071] 2. Virtual File System, or VFS for short, exists in the client and is an important part of the Linux (operating system kernel) operating system. The virtual file system provides a unified interface that allows users and applications to access different types of file systems in the same way.
[0072] 3. fsb (file system block, super block) refers to the memory structure of the file system super block in the client module in the client.
[0073] 4. subsb (subdirectory system block) is the memory structure of the subdirectory super block in the client module in the client.
[0074] In an exemplary embodiment, Figure 4 As shown, a file mounting method is provided, which is applied to Figure 1 The client 120 (hereinafter referred to as the client) in the embodiment is taken as an example to illustrate, and the steps include the following steps 402 to 406. Among them:
[0075] Step 402: determine the target directory in the client according to the authorization information of the target subdirectory sent by the server, and create a virtual super block.
[0076] The target subdirectory is the subdirectory to be mounted. The target directory is the mount point of the target subdirectory in the client. The client includes a client module and a virtual file system. The target superblock is a container of metadata of the target file system where the target subdirectory in the client module is located. The virtual superblock is a container of the target subdirectory in the virtual file system.
[0077] In implementation, when the server needs to mount the target subdirectory, the server will authorize the target subdirectory to the client. That is, the server sends the authorization information of the target subdirectory to the client. The client receives the authorization information of the target subdirectory sent by the server and determines the target directory. Then, the client creates a virtual super block corresponding to the target subdirectory in the virtual file system. The client authenticates the authorization information and obtains the authentication result, so that the mounting of the target subdirectory can be started if the authentication result is authentication passed. The client updates the virtual super block according to the target directory, thereby establishing an association relationship between the target directory and the virtual super block.
[0078] Step 404: Obtain metadata information of the target subdirectory, and create a target subdirectory super block corresponding to the target subdirectory according to the metadata information of the target subdirectory.
[0079] The authorization information includes the subdirectory path of the target subdirectory. The subdirectory path is used to access the target subdirectory. The first directory entry information is the dentry information of the root directory of the target file system. The directory entry information is dentry (structdentry), which is the dentry structure of the file or directory.
[0080] In implementation, the client creates a target subdirectory superblock corresponding to the target subdirectory. The client obtains the first directory entry information of the target file system from the server. Then, the client obtains the metadata information of the target subdirectory according to the first directory entry information and the subdirectory path, thereby initializing the target subdirectory superblock according to the metadata information of the target subdirectory, so that the target subdirectory superblock contains the metadata information of the target subdirectory.
[0081] Step 406, mounting the target subdirectory on the target directory according to the virtual super block and the target subdirectory super block.
[0082] The metadata information includes the second directory item information of the target subdirectory.
[0083] In implementation, the client points the first pointer of the virtual superblock corresponding to the target subdirectory to the second directory entry information, thereby associating the target subdirectory with the target directory. Then, the client points the second pointer of the virtual superblock to the target subdirectory superblock, thereby mounting the target subdirectory on the target directory.
[0084] In the above file mounting method, the target directory is determined and a virtual super block is created through the authorization information of the target subdirectory, the mount point of the target subdirectory is clarified, and the target subdirectory super block corresponding to the target subdirectory is created according to the metadata information of the target subdirectory, and the target subdirectory super block storing the target subdirectory information is obtained. Then, the target subdirectory is mounted on the target directory through the virtual super block and the target subdirectory super block. By mounting the target subdirectory, the file information accessible to the tenant is reduced, thereby ensuring the isolation of data between tenants and improving the security of the file mounting method.
[0085] In an exemplary embodiment, Figure 5 As shown, the specific processing process of step 402 includes steps 502 to 508. Among them:
[0086] Step 502: Receive authorization information of the target subdirectory sent by the server, and determine the target directory in the client.
[0087] The authorization information includes the storage system name of the storage system where the target subdirectory is located, the target file system name of the target file system where the target subdirectory is located, the path of the target directory, and the subdirectory path of the target subdirectory.
[0088] In implementation, the server constructs authorization information of the target subdirectory based on the storage system name of the storage system where the target subdirectory is located, the target file system name of the target file system where the target subdirectory is located, and the subdirectory path. Then, the server sends the authorization information of the target subdirectory to be mounted to the client. The client receives the authorization information of the target subdirectory sent by the server. The client determines the target directory according to the path of the target directory contained in the authorization information.
[0089] Step 504: Create a virtual super block corresponding to the target subdirectory in the virtual file system according to the authorization information.
[0090] In implementation, the client creates a new virtual super block in the virtual file system and initializes the virtual super block according to the authorization information, so that the virtual super block contains the authorization information of the target subdirectory.
[0091] In an exemplary embodiment, the client includes a management module, a virtual file system and a client module. When the client needs to access the target subdirectory in the server, the target subdirectory needs to be mounted on the client to facilitate the client access. The storage system in the server authorizes the target subdirectory to the client. The management module in the client constructs a mount command based on the authorization information and sends it to the virtual file system in the client. The mount command is called by the system in the client, and the virtual file system calls the mount function of the client module to start mounting the target subdirectory. Among them, the parameters of the mount command include information such as the storage system name of the storage system, the target file system name of the target file system where the target subdirectory is located, and the subdirectory path of the target subdirectory. At the same time, the virtual file system creates a virtual super block corresponding to the target subdirectory according to the mount command to prepare for the subsequent mounting of the target subdirectory.
[0092] Step 506: Send the authorization information to the server and receive the authentication result returned by the server.
[0093] The authorization information is used to verify whether the server authorizes the target subdirectory and obtain the authentication result.
[0094] In implementation, the client sends the authorization information of the target subdirectory to the server so that the server performs authentication processing on the target subdirectory and obtains an authentication result. Then, the client receives the authentication result sent by the server. If the authentication result is authentication passed, it indicates that the server has authorized the target subdirectory. If the authentication result is authentication failed, it indicates that the server has not authorized the target subdirectory.
[0095] In an optional embodiment, when the authentication result indicates that the server does not authorize the target subdirectory, the client determines that the mounting of the target subdirectory fails and stops executing the file mounting method.
[0096] Step 508: When the authentication result indicates that the server authorizes the target sub-directory, update the virtual super block based on the target directory.
[0097] In implementation, the client updates the virtual super block based on the path of the target directory to establish an association relationship between the target directory and the virtual super block.
[0098] In this embodiment, the target subdirectory is authenticated according to the authorization information, thereby ensuring the security of the target subdirectory and improving the security of the file mounting method. A virtual superblock of the target subdirectory is created according to the authorization information, and when the authentication is passed, the virtual superblock is updated based on the target directory, and an association relationship between the target directory and the virtual superblock is established, so that the target subdirectory can be mounted on the target directory based on the virtual superblock later.
[0099] In an exemplary embodiment, the authorization information includes the storage system name of the storage system where the target subdirectory is located and the target file system name of the target file system where the target subdirectory is located. If the authentication is passed, the client also needs to determine whether there is a target super block of the target file system in the client module. Figure 6 As shown, after step 508 is executed, the specific processing process of the file mounting method includes steps 602 to 606. Among them:
[0100] Step 602: Check whether there is a target super block corresponding to the target file system in the client module according to the storage system name and the target file system name.
[0101] The fsb of the target super block is the memory structure of the target super block, and the fsb stores the metadata information of the target file system. The metadata information of the target file system includes but is not limited to the target file system name and the storage system name.
[0102] In implementation, the client queries whether the fsb of the target super block corresponding to the target file system exists in the client module according to the storage system name and the target file system name. If the fsb of the target super block exists in the client module, it indicates that the target super block exists in the client module. If the fsb of the target super block does not exist in the client module, it indicates that the target super block does not exist in the client module.
[0103] In an optional embodiment, if the target super block exists in the client module, the client continues to execute step 702. The specific processing process of step 702 has been described in detail in the following embodiment and will not be repeated in the embodiment of the present application.
[0104] Step 604: If the target super block does not exist, create a target super block.
[0105] In implementation, if the fsb of the target super block does not exist in the client module, the client creates the fsb of the target super block.
[0106] Step 606: Obtain metadata information of the target file system from the server, and initialize the target super block according to the metadata information of the target file system.
[0107] In implementation, the client obtains metadata information of the target file system from the server, and then stores the metadata information of the target file system in the fsb of the target super block, completes the initialization of the target super block, and associates the target super block with the target file system.
[0108] In this embodiment, when the target super block does not exist in the virtual file system, the metadata information of the target file system is obtained, and the target super block is created according to the metadata information of the target file system, so as to facilitate the subsequent access to the target subdirectory based on the target super block. Moreover, the metadata information in the target super block is the original file system metadata architecture, and the original function of the file system is not affected.
[0109] In an exemplary embodiment, the authorization information includes the subdirectory path of the target subdirectory, such as Figure 7 As shown, the specific processing process of step 404 includes steps 702 to 706. Among them:
[0110] Step 702: Create a target subdirectory super block corresponding to the target subdirectory, and obtain the first directory entry information of the target file system where the target subdirectory is located from the server.
[0111] Among them, subsb is the memory structure of the target subdirectory super block.
[0112] In implementation, the client creates a subsb of the target subdirectory superblock corresponding to the target subdirectory, so that the subsb of the target subdirectory superblock can store metadata information of the target subdirectory. Then, the client sends a request to the server to obtain the first target item information of the target file system from the server.
[0113] Step 704: Obtain metadata information of the target subdirectory from the server according to the first directory entry information and the subdirectory path.
[0114] The subdirectory path starts with the root directory and ends with the subdirectory. The first directory entry information is the dentry of the target file system.
[0115] In implementation, the client starts from the root directory and searches for the directory entry information and metadata information of the next-level directory based on the first directory entry information, the metadata information of the target file system, and the directory name of the next-level directory in the sub-directory path until the metadata information and directory entry information of all directories on the sub-directory path are obtained.
[0116] For example, the subdirectory path is dir1 / dir2 / dir3. The target subdirectory is dir3, and the target file system where the target subdirectory is located is fs. To mount the target subdirectory dir3, you need to obtain the metadata information of dir3. The client creates the target super block fsb corresponding to the target file system fs in the client module, obtains the metadata information of the target file system from the server to fill fsb, and thus completes the initialization of the target super block fsb. The client goes to the server to search for the dentry and metadata information of dir1 based on the dentry of fsb, the metadata information of fsb, and the directory name dir1. Then, the client goes to the server to search for the dentry of dir2 and the metadata information of dir2 based on the dentry of dir1, the metadata information of dir1, and the directory name dir2. Then, the client goes to the server to search for the dentry of dir3 and the metadata information of dir3 based on the dentry of dir2, the metadata information of dir2, and the directory name dir3.
[0117] Step 706: Initialize the target subdirectory super block according to the metadata information of the target subdirectory.
[0118] In implementation, the metadata information of the target subdirectory of the client is stored in the subsb of the target subdirectory superblock, thereby realizing the initialization of the target subdirectory superblock. By storing the metadata information of the target subdirectory, it is convenient to subsequently establish the association relationship between the target subdirectory and the target directory, so that the target subdirectory can be accessed through the target directory. The establishment of the association relationship between the target subdirectory and the target directory is detailed in the following embodiment.
[0119] In this embodiment, the target subdirectory super block corresponding to the target subdirectory is created through the metadata information of the target subdirectory, so as to realize the storage of the target subdirectory information on the client, and facilitate the subsequent mounting of the target subdirectory. In addition, the target subdirectory super block has no special restrictions on the depth of the subdirectory path to be mounted, as long as the subdirectory path length meets the Linux (operating system kernel) default path length, which is convenient and flexible to use, and expands the scope of application of the file mounting method.
[0120] In an exemplary embodiment, Figure 8 As shown, the specific processing process of establishing the association relationship between the target subdirectory and the target directory according to the metadata information and the target subdirectory super block in step 406 includes steps 802 to 804. Among them:
[0121] Step 802: point the first pointer of the virtual super block to the second directory entry information of the target subdirectory in the metadata information, so as to associate the target directory with the target subdirectory.
[0122] The first pointer is the s_root pointer, which is the pointer of the root directory node of the mount point. The metadata information of the target subdirectory includes the second directory entry information of the target subdirectory.
[0123] In implementation, the client assigns the second directory entry information of the target sub-directory to the first pointer of the virtual super block corresponding to the target sub-directory, so that the target directory is associated with the target sub-directory through the virtual super block.
[0124] In an exemplary embodiment, the client assigns the second directory entry information (dentry) of the target subdirectory to s_root of the vsb (virtual super block).
[0125] Step 804, point the second pointer of the virtual super block to the target sub-directory super block, so that the target sub-directory is mounted on the target directory.
[0126] The second pointer is the s_fs_info pointer, and the s_fs_info pointer is used to point to the super block of a specific file system.
[0127] In implementation, the client assigns the target subdirectory superblock to the second pointer of the virtual superblock corresponding to the target subdirectory, so that the target subdirectory is mounted on the target directory. Specifically, the client assigns subsb of the target subdirectory superblock to s_fs_info of vsb (virtual superblock).
[0128] In an exemplary embodiment, the present application newly adds a subsb of a subdirectory superblock, which is used to store and manage subdirectory information, including the path of the subdirectory in the storage system, etc. When mounting a subdirectory, the client module of the client uses the subdirectory path to perform authentication and check whether the subdirectory is authorized.
[0129] Fig. 9 FIG. 1 is a schematic diagram showing the relationship between the vsb and the client module super block in an exemplary embodiment. Fig. 9As shown in the figure, when mounting a subdirectory, the s_root of the virtual superblock (vsb) in the VFS no longer points to the dentry (directory entry) of the file system, but to the dentry of the subdirectory, and the s_fs_info of the vsb no longer points to the superblock fsb of the file system, but to the subsb of the superblock of the subdirectory. In this way, the root directory corresponding to the mount point (mounted directory) is a subdirectory, and the user program can directly access the data under the mounted subdirectory through the mount point, but cannot access other data in the file system. Fig.10 FIG. 1 is a schematic diagram showing data after a subdirectory is mounted in an exemplary embodiment. Fig.10 As shown in the figure, after the directory dir1 is mounted to the client's / mnt / dir / , only a and b can be read in the / mnt / dir / directory.
[0130] In an exemplary embodiment, the management module in the client periodically obtains authorization information from the storage system in the server. If the authorized subdirectory is added or deleted, the management module will automatically mount or umount (unmount) the corresponding subdirectory. In addition, the present application supports mounting multiple subdirectories in a file system to a POSIX client and mounting the file system to another client at the same time. It also supports multiple forms such as mounting only subdirectories to the client or only mounting the file system to the client, and the mounted subdirectory can be modified.
[0131] In this embodiment, by establishing an association relationship between the target directory and the target subdirectory, the target subdirectory is mounted on the target directory. By mounting the target subdirectory, the file information accessible to the tenant is reduced, thereby ensuring the isolation of data between tenants and improving the security of the file mounting method. In addition, by mounting the target subdirectory on the target directory, the target subdirectory can be directly accessed through the target directory, which shortens the time to access the target subdirectory and improves data access efficiency.
[0132] In an exemplary embodiment, Figure 1 As shown, a file mounting system 100 is provided, and the file mounting system 100 includes: a server 110, which is used to send the authorization information of the target subdirectory to the client 120, and to perform authorization marking on the metadata information of the target subdirectory; the client 120, which is used to determine the target directory in the client 120 according to the authorization information of the target subdirectory sent by the server 110, and to create a virtual super block; obtain the metadata information of the target subdirectory, and create a target subdirectory super block corresponding to the target subdirectory according to the metadata information of the target subdirectory; and mount the target subdirectory on the target directory according to the virtual super block and the target subdirectory super block.
[0133] In implementation, when the target subdirectory in the server 110 needs to be mounted, the server 110 sends the authorization information of the target subdirectory to the client 120. Then, the server 110 sets an authorization mark on the metadata information of the target subdirectory. The authorization mark can give the operator a prompt that the target subdirectory has been mounted when the operator operates the target subdirectory in the server 110, thereby avoiding the operator from deleting the target subdirectory after the target subdirectory is authorized. The specific processing process of the client 120 has been described in detail in the above embodiment, and the embodiment of the present application will not be repeated here.
[0134] In an optional embodiment, the authorization mark limits the deletion operation of the target subdirectory. Specifically, the server 110 sets the authorization mark on the metadata information of the target subdirectory. After the authorization mark is set, the target subdirectory cannot be deleted. Therefore, by setting the authorization mark on the metadata information of the target subdirectory, it is avoided that the operator deletes the target subdirectory after the target subdirectory is authorized.
[0135] In this embodiment, the server sends the authorization information of the target subdirectory to the client, so that the client can mount the target subdirectory later. Then, the server performs authorization marking on the metadata information of the target subdirectory, thereby preventing the target subdirectory from being deleted on the server side and ensuring that the target subdirectory can be successfully accessed through the client. In addition, the client determines the target directory and creates a virtual super block through the authorization information of the target subdirectory, clarifies the mount point of the target subdirectory, and creates a target subdirectory super block corresponding to the target subdirectory based on the metadata information of the target subdirectory, thereby obtaining a target subdirectory super block storing the target subdirectory information. Then, the target subdirectory is mounted on the target directory through the virtual super block and the target subdirectory super block. By mounting the target subdirectory, the file information accessible to the tenant is reduced, thereby ensuring the isolation of data between tenants and improving the security of the file mounting method.
[0136] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0137] Based on the same inventive concept, the embodiment of the present application also provides a file mounting device for implementing the file mounting method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations of one or more file mounting device embodiments provided below can refer to the limitations of the file mounting method above, and will not be repeated here.
[0138] In an exemplary embodiment, Fig.11 As shown, a file mounting device 1100 is provided, comprising: a determination module 1101, a creation module 1102 and an establishment module 1103, wherein:
[0139] The determination module 1101 is used to determine the target directory in the client according to the authorization information of the target sub-directory sent by the server, and to create a virtual super block.
[0140] The creation module 1102 is used to obtain metadata information of the target subdirectory and create a target subdirectory super block corresponding to the target subdirectory according to the metadata information of the target subdirectory.
[0141] Establishing module 1103, used for mounting the target subdirectory on the target directory according to the virtual super block and the target subdirectory super block.
[0142] In an exemplary embodiment, the determining module 1101 includes:
[0143] The first receiving submodule is used to receive the authorization information of the target subdirectory sent by the server and determine the target directory in the client.
[0144] The first determination submodule is used to create a virtual super block corresponding to the target subdirectory in the virtual file system according to the authorization information.
[0145] The first sending submodule is used to send the authorization information to the server and receive the authentication result returned by the server; the authorization information is used to verify whether the server authorizes the target subdirectory to obtain the authentication result.
[0146] The second determination submodule is used to update the virtual super block based on the target directory when the authentication result indicates that the server authorizes the target subdirectory.
[0147] In an exemplary embodiment, the authorization information includes the storage system name of the storage system where the target subdirectory is located and the target file system name of the target file system where the target subdirectory is located; the file mounting device 1100 also includes:
[0148] The checking module is used to check whether a target super block corresponding to the target file system exists in the client module according to the storage system name and the target file system name.
[0149] The second creation module is used to create a target super block if the target super block does not exist.
[0150] The initialization module is used to obtain metadata information of the target file system from the server and initialize the target super block according to the metadata information of the target file system.
[0151] In an exemplary embodiment, the authorization information includes a subdirectory path of a target subdirectory, and the creation module 1102 includes:
[0152] The first creation submodule is used to create a target subdirectory super block corresponding to the target subdirectory, and obtain the first directory entry information of the target file system where the target subdirectory is located from the server.
[0153] The first acquisition submodule is used to acquire metadata information of a target subdirectory from a server according to the first directory item information and the subdirectory path.
[0154] The first initialization submodule is used to initialize the target subdirectory super block according to the metadata information of the target subdirectory.
[0155] In an exemplary embodiment, the establishment module 1103 includes:
[0156] The third determining submodule is used to point the first pointer of the virtual super block to the second directory entry information of the target subdirectory in the metadata information, so as to associate the target directory with the target subdirectory.
[0157] The fourth determining submodule is used to point the second pointer of the virtual super block to the target subdirectory super block, so that the target subdirectory is mounted on the target directory.
[0158] Each module in the above-mentioned file mounting device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module above.
[0159] In an exemplary embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be shown in FIG12. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit, and an input device. The processor, the memory, and the input / output interface are connected via a system bus, and the communication interface, the display unit, and the input device are connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner may be implemented through WIFI, a mobile cellular network, near field communication (NFC) or other technologies. When the computer program is executed by the processor, a file mounting method is implemented. The display unit of the computer device is used to form a visually visible picture, which may be a display screen, a projection device, or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse.
[0160] Those skilled in the art will understand that the structure shown in FIG. 12 is merely a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.
[0161] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.
[0162] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0163] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0164] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.
[0165] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0166] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A file mounting method, characterized in that: The method is applied to a client, and the method comprises: Determine the target directory in the client according to the authorization information of the target subdirectory sent by the server, and create a virtual super block; Acquire metadata information of the target subdirectory, and create a target subdirectory super block corresponding to the target subdirectory according to the metadata information of the target subdirectory; The target subdirectory is mounted on the target directory according to the virtual super block and the target subdirectory super block.
2. The method according to claim 1, characterized in that The step of determining the target directory in the client according to the authorization information of the target subdirectory sent by the server and creating a virtual super block includes: Receiving authorization information of a target subdirectory sent by a server, and determining a target directory in the client; According to the authorization information, a virtual super block corresponding to the target subdirectory is created in the virtual file system; Send the authorization information to the server, and receive the authentication result returned by the server; the authorization information is used to verify whether the server authorizes the target subdirectory, and obtain the authentication result; In a case where the authentication result indicates that the server authorizes the target sub-directory, the virtual super block is updated based on the target directory.
3. The method according to claim 2, characterized in that The authorization information includes the storage system name of the storage system where the target subdirectory is located and the target file system name of the target file system where the target subdirectory is located; After updating the virtual super block based on the target directory, the method further includes: According to the storage system name and the target file system name, checking whether there is a target super block corresponding to the target file system in the client module; If the target super block does not exist, create the target super block; The metadata information of the target file system is obtained from the server, and the target super block is initialized according to the metadata information of the target file system.
4. The method according to claim 1, characterized in that The authorization information includes the subdirectory path of the target subdirectory, and the step of obtaining the metadata information of the target subdirectory and creating a target subdirectory superblock corresponding to the target subdirectory according to the metadata information of the target subdirectory includes: Creating a target subdirectory superblock corresponding to the target subdirectory, and obtaining first directory entry information of the target file system where the target subdirectory is located from the server; Acquire metadata information of the target subdirectory from the server according to the first directory item information and the subdirectory path; Initialize the target subdirectory super block according to the metadata information of the target subdirectory.
5. The method according to claim 1, characterized in that The step of mounting the target subdirectory on the target directory according to the virtual super block and the target subdirectory super block includes: Pointing the first pointer of the virtual super block to the second directory entry information of the target subdirectory in the metadata information, so as to associate the target directory with the target subdirectory; The second pointer of the virtual super block is pointed to the target sub-directory super block, so that the target sub-directory is mounted on the target directory.
6. A file mounting system, characterized in that: The system comprises: The server is used to send the authorization information of the target subdirectory to the client and to perform authorization marking on the metadata information of the target subdirectory; The client is used to determine the target directory in the client according to the authorization information of the target subdirectory sent by the server, and create a virtual super block; obtain the metadata information of the target subdirectory, and create a target subdirectory super block corresponding to the target subdirectory according to the metadata information of the target subdirectory; and mount the target subdirectory on the target directory according to the virtual super block and the target subdirectory super block.
7. A file mounting device, characterized in that: The device comprises: A determination module, used to determine the target directory in the client according to the authorization information of the target subdirectory sent by the server, and to create a virtual super block; A creation module, used for acquiring metadata information of the target subdirectory, and creating a target subdirectory super block corresponding to the target subdirectory according to the metadata information of the target subdirectory; A module is established, for mounting the target subdirectory on the target directory according to the virtual super block and the target subdirectory super block.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 5 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.
