From: Samuel Just Date: Fri, 1 Apr 2016 23:57:48 +0000 (-0700) Subject: LFNIndex: ensure that lfn and directory attrs are written atomically X-Git-Tag: v10.1.2~7^2~7 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=73778f1eb9ac8f597e16762b17d516c449b08c6e;p=ceph.git LFNIndex: ensure that lfn and directory attrs are written atomically We leave skip_chain_cleanup = false since the object may have been written using code that split the lfn attr over multiple attrs. Signed-off-by: Samuel Just --- diff --git a/src/os/filestore/LFNIndex.cc b/src/os/filestore/LFNIndex.cc index 4842837c305..bcd22ffa20d 100644 --- a/src/os/filestore/LFNIndex.cc +++ b/src/os/filestore/LFNIndex.cc @@ -529,9 +529,10 @@ int LFNIndex::add_attr_path(const vector &path, { string full_path = get_full_path_subdir(path); maybe_inject_failure(); - return chain_setxattr(full_path.c_str(), mangle_attr_name(attr_name).c_str(), - reinterpret_cast(attr_value.c_str()), - attr_value.length()); + return chain_setxattr( + full_path.c_str(), mangle_attr_name(attr_name).c_str(), + reinterpret_cast(attr_value.c_str()), + attr_value.length()); } int LFNIndex::get_attr_path(const vector &path, @@ -853,14 +854,16 @@ int LFNIndex::lfn_created(const vector &path, << " moving old name to alt attr " << string(buf, r) << ", new name is " << full_name << dendl; - r = chain_setxattr(full_path.c_str(), get_alt_lfn_attr().c_str(), - buf, r); + r = chain_setxattr( + full_path.c_str(), get_alt_lfn_attr().c_str(), + buf, r); if (r < 0) return r; } - return chain_setxattr(full_path.c_str(), get_lfn_attr().c_str(), - full_name.c_str(), full_name.size()); + return chain_setxattr( + full_path.c_str(), get_lfn_attr().c_str(), + full_name.c_str(), full_name.size()); } int LFNIndex::lfn_unlink(const vector &path,