|
22 | 22 | #include <fcntl.h> |
23 | 23 | #include <algorithm> |
24 | 24 | #include <memory> |
| 25 | +#include <errno.h> |
25 | 26 |
|
26 | 27 | #include "src/chunkserver/datastore/chunkserver_datastore.h" |
27 | 28 | #include "src/chunkserver/datastore/chunkserver_chunkfile.h" |
@@ -207,7 +208,7 @@ CSErrorCode CSChunkFile::Open(bool createFile) { |
207 | 208 | if (rc != 0 && rc != -EEXIST) { |
208 | 209 | LOG(ERROR) << "Error occured when create file." |
209 | 210 | << " filepath = " << chunkFilePath; |
210 | | - return CSErrorCode::InternalError; |
| 211 | + return rc == -ENOSPC ? CSErrorCode::NoSpaceError : CSErrorCode::InternalError; |
211 | 212 | } |
212 | 213 | } |
213 | 214 | int rc = -1; |
@@ -400,7 +401,7 @@ CSErrorCode CSChunkFile::Write(SequenceNum sn, |
400 | 401 | << "ChunkID: " << chunkId_ |
401 | 402 | << ",request sn: " << sn |
402 | 403 | << ",chunk sn: " << metaPage_.sn; |
403 | | - return CSErrorCode::InternalError; |
| 404 | + return rc == -ENOSPC ? CSErrorCode::NoSpaceError : CSErrorCode::InternalError; |
404 | 405 | } |
405 | 406 | // If it is a clone chunk, the bitmap will be updated |
406 | 407 | CSErrorCode errorCode = flush(); |
@@ -478,7 +479,7 @@ CSErrorCode CSChunkFile::Paste(const char * buf, off_t offset, size_t length) { |
478 | 479 | << "ChunkID: " << chunkId_ |
479 | 480 | << ", offset: " << offset |
480 | 481 | << ", length: " << length; |
481 | | - return CSErrorCode::InternalError; |
| 482 | + return rc == -ENOSPC ? CSErrorCode::NoSpaceError : CSErrorCode::InternalError; |
482 | 483 | } |
483 | 484 | } |
484 | 485 |
|
|
0 commit comments