mirror of
https://github.com/s3fs-fuse/s3fs-fuse.git
synced 2024-12-23 01:08:54 +00:00
Merge pull request #898 from gaul/rename-before-close
Flush file before renaming
This commit is contained in:
commit
b2141313e2
@ -1471,6 +1471,7 @@ static int rename_directory(const char* from, const char* to)
|
|||||||
// does a safe copy - copies first and then deletes old
|
// does a safe copy - copies first and then deletes old
|
||||||
for(mn_cur = mn_head; mn_cur; mn_cur = mn_cur->next){
|
for(mn_cur = mn_head; mn_cur; mn_cur = mn_cur->next){
|
||||||
if(!mn_cur->is_dir){
|
if(!mn_cur->is_dir){
|
||||||
|
// TODO: call s3fs_rename instead?
|
||||||
if(!nocopyapi && !norenameapi){
|
if(!nocopyapi && !norenameapi){
|
||||||
result = rename_object(mn_cur->old_path, mn_cur->new_path);
|
result = rename_object(mn_cur->old_path, mn_cur->new_path);
|
||||||
}else{
|
}else{
|
||||||
@ -1523,6 +1524,12 @@ static int s3fs_rename(const char* from, const char* to)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// flush pending writes if file is open
|
||||||
|
FdEntity *entity = FdManager::get()->ExistOpen(from);
|
||||||
|
if(entity != NULL){
|
||||||
|
entity->Flush(true);
|
||||||
|
}
|
||||||
|
|
||||||
// files larger than 5GB must be modified via the multipart interface
|
// files larger than 5GB must be modified via the multipart interface
|
||||||
if(S_ISDIR(buf.st_mode)){
|
if(S_ISDIR(buf.st_mode)){
|
||||||
result = rename_directory(from, to);
|
result = rename_directory(from, to);
|
||||||
|
@ -500,8 +500,7 @@ function add_all_tests {
|
|||||||
add_tests test_chown
|
add_tests test_chown
|
||||||
add_tests test_list
|
add_tests test_list
|
||||||
add_tests test_remove_nonempty_directory
|
add_tests test_remove_nonempty_directory
|
||||||
# TODO: broken: https://github.com/s3fs-fuse/s3fs-fuse/issues/145
|
add_tests test_rename_before_close
|
||||||
#add_tests test_rename_before_close
|
|
||||||
add_tests test_multipart_upload
|
add_tests test_multipart_upload
|
||||||
add_tests test_multipart_copy
|
add_tests test_multipart_copy
|
||||||
add_tests test_special_characters
|
add_tests test_special_characters
|
||||||
|
Loading…
Reference in New Issue
Block a user