mirror of
https://github.com/s3fs-fuse/s3fs-fuse.git
synced 2025-01-03 05:00:15 +00:00
Fixed ref-count when error occurred.
This commit is contained in:
parent
cbf072bc55
commit
62dcda6a56
@ -814,11 +814,17 @@ int FdEntity::Open(headers_t* pmeta, ssize_t size, time_t time, bool no_fd_lock_
|
|||||||
// truncate temporary file size
|
// truncate temporary file size
|
||||||
if(-1 == ftruncate(fd, static_cast<size_t>(size))){
|
if(-1 == ftruncate(fd, static_cast<size_t>(size))){
|
||||||
S3FS_PRN_ERR("failed to truncate temporary file(%d) by errno(%d).", fd, errno);
|
S3FS_PRN_ERR("failed to truncate temporary file(%d) by errno(%d).", fd, errno);
|
||||||
|
if(0 < refcnt){
|
||||||
|
refcnt--;
|
||||||
|
}
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
// resize page list
|
// resize page list
|
||||||
if(!pagelist.Resize(static_cast<size_t>(size), false)){
|
if(!pagelist.Resize(static_cast<size_t>(size), false)){
|
||||||
S3FS_PRN_ERR("failed to truncate temporary file information(%d).", fd);
|
S3FS_PRN_ERR("failed to truncate temporary file information(%d).", fd);
|
||||||
|
if(0 < refcnt){
|
||||||
|
refcnt--;
|
||||||
|
}
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2148,6 +2154,9 @@ FdEntity* FdManager::Open(const char* path, headers_t* pmeta, ssize_t size, time
|
|||||||
|
|
||||||
// open
|
// open
|
||||||
if(0 != ent->Open(pmeta, size, time, no_fd_lock_wait)){
|
if(0 != ent->Open(pmeta, size, time, no_fd_lock_wait)){
|
||||||
|
if(close){
|
||||||
|
ent->Close();
|
||||||
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if(close){
|
if(close){
|
||||||
|
Loading…
Reference in New Issue
Block a user