Loading src/client/gkfs_metadata.cpp +44 −42 Original line number Diff line number Diff line Loading @@ -610,17 +610,20 @@ gkfs_rename(const string& old_path, const string& new_path) { } return 0; } errno = EPERM; // Destination exists: remove it first (POSIX rename must atomically replace destination) auto is_dir_new = S_ISDIR(md_new->mode()); auto rm_err = gkfs::rpc::forward_remove(new_path, is_dir_new, CTX->get_replicas(), md_new->size()); if(rm_err) { errno = rm_err; return -1; } else { } } if(!md_old.value().target_path().empty()) { // the file is a renamed one, we need to get the metadata of the // original file. (There will be only one level) original_path = md_old.value().target_path(); if(!S_ISLNK(md_old->mode())) { md_old = gkfs::utils::get_metadata(original_path, false); Loading Loading @@ -656,7 +659,6 @@ gkfs_rename(const string& old_path, const string& new_path) { errno); return -1; } } fprintf(stderr, "GKFS_RENAME: success returning 0\n"); return 0; } Loading Loading
src/client/gkfs_metadata.cpp +44 −42 Original line number Diff line number Diff line Loading @@ -610,17 +610,20 @@ gkfs_rename(const string& old_path, const string& new_path) { } return 0; } errno = EPERM; // Destination exists: remove it first (POSIX rename must atomically replace destination) auto is_dir_new = S_ISDIR(md_new->mode()); auto rm_err = gkfs::rpc::forward_remove(new_path, is_dir_new, CTX->get_replicas(), md_new->size()); if(rm_err) { errno = rm_err; return -1; } else { } } if(!md_old.value().target_path().empty()) { // the file is a renamed one, we need to get the metadata of the // original file. (There will be only one level) original_path = md_old.value().target_path(); if(!S_ISLNK(md_old->mode())) { md_old = gkfs::utils::get_metadata(original_path, false); Loading Loading @@ -656,7 +659,6 @@ gkfs_rename(const string& old_path, const string& new_path) { errno); return -1; } } fprintf(stderr, "GKFS_RENAME: success returning 0\n"); return 0; } Loading