A data storage method, comprising: receiving, by a metadata server, a first lock request sent by a first client, wherein the first lock request is used to request to lock a first data range of a first file; if the first data range of the first file is not locked, locking, by the metadata server, the first data range of the first file (S302, S303); sending, by the metadata server, a first lock response to the first client, wherein the first lock response is used to indicate that the first data range of the first file is locked by the first client, and the first data range is used by the first client to write data (S304, S305); and if the first data range overlaps a locked data range, allocating, by the metadata server, a data range other than an overlapped part in the first data range to the first client, and sending, by the metadata server, a lock success message including range information of the data range other than the overlapped part in the first data range, to the first client; characterised in that wherein before the receiving, by a metadata server, a first lock request sent by a first client, the method further comprises: receiving, by the metadata server, a second lock request sent by the first client, wherein the second lock request is used to request to lock a first version of the first file; and if the first file is not locked, locking, by the metadata server, the first version of the first file, which prevents modification of another version of the first file within a lease term in which the first version of the first file is locked, and sending a second lock response to the first client, wherein the second lock response is used to indicate that the first version of the first file is locked (S308, S309). receiving, by a metadata server, a first lock request sent by a first client, wherein the first lock request is used to request to lock a first data range of a first file; if the first data range of the first file is not locked, locking, by the metadata server, the first data range of the first file (S302, S303); sending, by the metadata server, a first lock response to the first client, wherein the first lock response is used to indicate that the first data range of the first file is locked by the first client, and the first data range is used by the first client to write data (S304, S305); and if the first data range overlaps a locked data range, allocating, by the metadata server, a data range other than an overlapped part in the first data range to the first client, and sending, by the metadata server, a lock success message including range information of the data range other than the overlapped part in the first data range, to the first client; characterised in that wherein before the receiving, by a metadata server, a first lock request sent by a first client, the method further comprises: receiving, by the metadata server, a second lock request sent by the first client, wherein the second lock request is used to request to lock a first version of the first file; and if the first file is not locked, locking, by the metadata server, the first version of the first file, which prevents modification of another version of the first file within a lease term in which the first version of the first file is locked, and sending a second lock response to the first client, wherein the second lock response is used to indicate that the first version of the first file is locked (S308, S309). receiving, by the metadata server, a second lock request sent by the first client, wherein the second lock request is used to request to lock a first version of the first file; and if the first file is not locked, locking, by the metadata server, the first version of the first file, which prevents modification of another version of the first file within a lease term in which the first version of the first file is locked, and sending a second lock response to the first client, wherein the second lock response is used to indicate that the first version of the first file is locked (S308, S309).