MANAGING METADATA FOR DATA IN A COPY RELATIONSHIP
1. Field of the Invention The present invention relates to a computer program product, system, and method for managing metadata for data in a copy relationship. 2. Description of the Related Art In a storage environment, source volumes may be mirrored to target volumes to provide redundant copies of data. The source and target volumes may be in different storage devices to provide further redundancy. A point-in-time copy replicates data in a manner that appears instantaneous and allows a host to continue accessing the source volume while actual data transfers to the copy volume are deferred to a later time. The point-in-time copy appears instantaneous because complete is returned to the copy operation in response to generating the relationship data structures without copying the data. The point-in-time copy relationships that are immediately established in response to the point-in-time copy command include a bitmap or other data structure indicating the location of blocks in the volume at either the source volume or the copy volume. Point-in-time copy techniques, such as the IBM FlashCopy® (FlashCopy is a registered trademark of International Business Machines, Corp. or “IBM”), typically defer the transfer of the source volume tracks in the copy relationship to the corresponding target volume until a write operation is requested to that data block on the source volume. Data transfers may also proceed as a background copy process with minimal impact on system performance. Further, a source track in the copy relationship may be copied to the corresponding target track in the copy relationship in response to a read request to the corresponding target track. A command to withdraw the copy relationship may be submitted. To implement a copy relationship withdraw operation, the target metadata for all the target volume tracks in the copy relationship is discarded in the target storage system and any target tracks in the copy relationship, modified or unmodified, residing in cache, are demoted, i.e., discarded. As part of the copy relationship withdraw operation, access to the target volume is quiesced until all the metadata for the target volume in the target storage is discarded. Following the withdraw operation, the target metadata for a requested target track needs to be rebuilt when the target track is subsequently requested because all the metadata for the target volume in the target storage was discarded during the copy relationship withdraw operation. The target metadata for the target volume is discarded to prevent a mismatch of the target metadata data in the target storage and the target tracks described by the metadata. This mismatch may occur if at the time of the withdraw operation, target metadata for modified target tracks in cache is destaged to the target storage before the modified target tracks. For this reason, during the copy withdraw operation, all target metadata in the volume is discarded to avoid this mismatch of the target storage having target metadata having information that is inconsistent with the corresponding target tracks in the target storage. There is a need in the art for improved techniques for managing metadata in the storage system and cache. Provided are a computer program product, system, and method for managing metadata for data in a copy relationship copied from a source storage to a target storage. Information is maintained on a copy relationship of source data in the source storage and target data in the target storage. The source data is copied from the source storage to the cache to copy to target data in the target storage indicated in the copy relationship. Target metadata is generated for the target data comprising the source data copied to the cache. An access request to requested target data comprising the target data in the cache is processed and access is provided to the requested target data in the cache. A determination is made as to whether the requested target data in the cache has been destaged to the target storage. The target metadata for the requested target data in the target storage is discarded in response to determining that the requested target data in the cache has not been destaged to the target storage. The source data 18 The storage server 2 may receive read and write requests directed to the target storage 4 The storages 4 In The network 22 may comprise a Wide Area Network (WAN), Local Area Network (LAN), Storage Area Network (SAN), wireless network, the Internet, an Intranet, peer-to-peer network, etc. The storage server 2 may connect to the storages 4 The copy relationship 50 may represent a logical or virtual copy operation, such as FlashClopy, where the initial copy operation is completed instantaneously upon creating the copy relationship 50 data structures, and the source data 54 may be copied in the background over to the target data 56 as part of background copy processes that seek to minimize impact on the server 2 resources and performance. If (at block 202) the requested target data 18 With the embodiment of Described embodiments provide techniques for managing target metadata in the cache so as to limit the amount of target metadata that needs to be discarded if the copy relationship is withdrawn by discarding target metadata for requested target data in the cache that has not been destaged. In this way, the amount of target metadata that needs to be discarded at the time of the copy withdrawal operation is reduced to avoid delays that could adversely affect server performance because I/O activity to target storage data may be queisced during the time required to discard the target metadata as part of the copy withdrawal operation. The described operations may be implemented as a method, apparatus or computer program product using standard programming and/or engineering techniques to produce software, firmware, hardware, or any combination thereof. Accordingly, aspects of the embodiments may take the form of an entirely hardware embodiment, an entirely software embodiment (including firmware, resident software, micro-code, etc.) or an embodiment combining software and hardware aspects that may all generally be referred to herein as a “circuit,” “module” or “system.” Furthermore, aspects of the embodiments may take the form of a computer program product embodied in one or more computer readable medium(s) having computer readable program code embodied thereon. Any combination of one or more computer readable medium(s) may be utilized. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain or store a program for use by or in connection with an instruction execution system, apparatus, or device. A computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing. Computer program code for carrying out operations for aspects of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C++ or the like and conventional procedural programming languages, such as the “C” programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet Service Provider). Aspects of the present invention are described above with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and/or block diagrams, and combinations of blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions/acts specified in the flowchart and/or block diagram block or blocks. These computer program instructions may also be stored in a computer readable medium that can direct a computer, other programmable data processing apparatus, or other devices to function in a particular manner, such that the instructions stored in the computer readable medium produce an article of manufacture including instructions which implement the function/act specified in the flowchart and/or block diagram block or blocks. The computer program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other devices to cause a series of operational steps to be performed on the computer, other programmable apparatus or other devices to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide processes for implementing the functions/acts specified in the flowchart and/or block diagram block or blocks. The variables “a” and “b” when used to represent a variable number of an element may indicate any number of instances of the element, and may indicate different integer numbers when used with different elements or when used with different instances of the same element. For instance variables “a” and “b” used to indicate a number of a source storage and target storage may indicate the same or different number of these elements. The terms “an embodiment”, “embodiment”, “embodiments”, “the embodiment”, “the embodiments”, “one or more embodiments”, “some embodiments”, and “one embodiment” mean “one or more (but not all) embodiments of the present invention(s)” unless expressly specified otherwise. The terms “including”, “comprising”, “having” and variations thereof mean “including but not limited to”, unless expressly specified otherwise. The enumerated listing of items does not imply that any or all of the items are mutually exclusive, unless expressly specified otherwise. The terms “a”, “an” and “the” mean “one or more”, unless expressly specified otherwise. Devices that are in communication with each other need not be in continuous communication with each other, unless expressly specified otherwise. In addition, devices that are in communication with each other may communicate directly or indirectly through one or more intermediaries. A description of an embodiment with several components in communication with each other does not imply that all such components are required. On the contrary a variety of optional components are described to illustrate the wide variety of possible embodiments of the present invention. Further, although process steps, method steps, algorithms or the like may be described in a sequential order, such processes, methods and algorithms may be configured to work in alternate orders. In other words, any sequence or order of steps that may be described does not necessarily indicate a requirement that the steps be performed in that order. The steps of processes described herein may be performed in any order practical. Further, some steps may be performed simultaneously. When a single device or article is described herein, it will be readily apparent that more than one device/article (whether or not they cooperate) may be used in place of a single device/article. Similarly, where more than one device or article is described herein (whether or not they cooperate), it will be readily apparent that a single device/article may be used in place of the more than one device or article or a different number of devices/articles may be used instead of the shown number of devices or programs. The functionality and/or the features of a device may be alternatively embodied by one or more other devices which are not explicitly described as having such functionality/features. Thus, other embodiments of the present invention need not include the device itself. The illustrated operations of The foregoing description of various embodiments of the invention has been presented for the purposes of illustration and description. It is not intended to be exhaustive or to limit the invention to the precise form disclosed. Many modifications and variations are possible in light of the above teaching. It is intended that the scope of the invention be limited not by this detailed description, but rather by the claims appended hereto. The above specification, examples and data provide a complete description of the manufacture and use of the composition of the invention. Since many embodiments of the invention can be made without departing from the spirit and scope of the invention, the invention resides in the claims herein after appended. Provided are a computer program product, system, and method for managing metadata for data in a copy relationship copied from a source storage to a target storage. Information is maintained on a copy relationship of source data in the source storage and target data in the target storage. The source data is copied from the source storage to the cache to copy to target data in the target storage indicated in the copy relationship. Target metadata is generated for the target data comprising the source data copied to the cache. An access request to requested target data comprising the target data in the cache is processed and access is provided to the requested target data in the cache. A determination is made as to whether the requested target data in the cache has been destaged to the target storage. The target metadata for the requested target data in the target storage is discarded in response to determining that the requested target data in the cache has not been destaged to the target storage. 1. A computer program product for managing data being copied from a source storage to a target storage, the computer program product comprising a computer readable storage medium having computer readable program code embodied therein that executes to communicate with the source storage, the target storage and a cache and to perform operations, the operations comprising:
maintaining information on a copy relationship of source data in the source storage and target data in the target storage; copying source data from the source storage to the cache to copy to target data in the target storage indicated in the copy relationship; generating target metadata for the target data comprising the source data copied to the cache; processing an access request to requested target data comprising the target data in the cache; providing access to the requested target data in the cache; determining whether the requested target data in the cache has been destaged to the target storage; and discarding the target metadata for the requested target data in the target storage in response to determining that the requested target data in the cache has not been destaged to the target storage. 2. The computer program product of 3. The computer program product of 4. The computer program product of receiving a subsequent read request to the requested target data after completing the processed read request; rebuilding target metadata for the requested target data for the subsequent read request; providing access to the requested target data in the cache for the subsequent read request; determining whether the requested target data in the cache has been destaged to the target storage; and discarding the rebuilt target metadata for the requested target data in the target storage in response to determining that the requested target data in the cache has not been destaged to the target storage. 5. The computer program product of retaining the target metadata for the requested target data in the cache to destage to the target storage in response to determining that the requested target data has been destaged to the target storage. 6. The computer program product of receiving a request to withdraw the copy relationship; and demoting the target data in the cache in the copy relationship in response to receiving the request to withdraw the copy relationship. 7. The computer program product of receiving a write request to write data to the target data in the copy relationship; updating the target data in the cache with the write data; generating target metadata for the updated target data in the cache; and indicating in a data structure the updated target data in the cache, wherein the indication is removed in response to destaging the updated target data and the metadata for the updated target data to the target storage. 8. The computer program product of receiving a request to withdraw the copy relationship; demoting the target data in the cache indicated in the copy relationship in response to receiving the request to withdraw the copy relationship; and discarding the target metadata data in the target storage for the target data indicated in the data structure. 9. The computer program product of determining that an attempt to destage the target data to the target storage has failed; and discarding the target metadata in the target storage for the target data whose destage failed in response to determining that the destage of the target data failed. 10. A system in communication with a source storage and a target storage, comprising:
a processor; a cache; a computer readable storage medium having computer readable program code embodied therein executed by the processor to perform operations, the operations comprising:
maintaining information on a copy relationship of source data in the source storage and target data in the target storage; copying source data from the source storage to the cache to copy to target data in the target storage indicated in the copy relationship; generating target metadata for the target data comprising the source data copied to the cache; processing an access request to requested target data comprising the target data in the cache; providing access to the requested target data in the cache;
determining whether the requested target data in the cache has been destaged to the target storage; and discarding the target metadata for the requested target data in the target storage in response to determining that the requested target data in the cache has not been destaged to the target storage. 11. The system of 12. The system of receiving a subsequent read request to the requested target data after completing the processed read request; rebuilding target metadata for the requested target data for the subsequent read request; providing access to the requested target data in the cache for the subsequent read request; determining whether the requested target data in the cache has been destaged to the target storage; and discarding the rebuilt target metadata for the requested target data in the target storage in response to determining that the requested target data in the cache has not been destaged to the target storage. 13. The system of retaining the target metadata for the requested target data in the cache to destage to the target storage in response to determining that the requested target data has been destaged to the target storage. 14. The system of receiving a request to withdraw the copy relationship; and demoting the target data in the cache in the copy relationship in response to receiving the request to withdraw the copy relationship. 15. The system of receiving a write request to write data to the target data in the copy relationship; updating the target data in the cache with the write data; generating target metadata for the updated target data in the cache; and indicating in a data structure the updated target data in the cache, wherein the indication is removed in response to destaging the updated target data and the metadata for the updated target data to the target storage. 16. A method, comprising:
maintaining information on a copy relationship of source data in a source storage and target data in a target storage; copying source data from the source storage to a cache to copy to target data in the target storage indicated in the copy relationship; generating target metadata for the target data comprising the source data copied to the cache; processing an access request to requested target data comprising the target data in the cache; providing access to the requested target data in the cache; determining whether the requested target data in the cache has been destaged to the target storage; and discarding the target metadata for the requested target data in the target storage in response to determining that the requested target data in the cache has not been destaged to the target storage. 17. The method of 18. The method of receiving a subsequent read request to the requested target data after completing the processed read request; rebuilding target metadata for the requested target data for the subsequent read request; providing access to the requested target data in the cache for the subsequent read request; determining whether the requested target data in the cache has been destaged to the target storage; and discarding the rebuilt target metadata for the requested target data in the target storage in response to determining that the requested target data in the cache has not been destaged to the target storage. 19. The method of retaining the target metadata for the requested target data in the cache to destage to the target storage in response to determining that the requested target data has been destaged to the target storage. 20. The method of receiving a request to withdraw the copy relationship; and demoting the target data in the cache in the copy relationship in response to receiving the request to withdraw the copy relationship. 21. The method of receiving a write request to write data to the target data in the copy relationship; updating the target data in the cache with the write data; generating target metadata for the updated target data in the cache; and indicating in a data structure the updated target data in the cache, wherein the indication is removed in response to destaging the updated target data and the metadata for the updated target data to the target storage. BACKGROUND OF THE INVENTION
SUMMARY
BRIEF DESCRIPTION OF THE DRAWINGS
DETAILED DESCRIPTION