From: Sage Weil Date: Sat, 27 Oct 2012 22:10:56 +0000 (-0700) Subject: os/FileStore: use _fgetattrs() from _rmattrs() X-Git-Tag: v0.55~188^2~15 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a367e6e99cc48273ea0377c9dd2bad3d53627b34;p=ceph.git os/FileStore: use _fgetattrs() from _rmattrs() Note that we subtly change failure handling to be more strict: if we fail to open the file, we error out; before we ignored errors from _getattr(). Signed-off-by: Sage Weil --- diff --git a/src/os/FileStore.cc b/src/os/FileStore.cc index 084a3436763..333a6df6309 100644 --- a/src/os/FileStore.cc +++ b/src/os/FileStore.cc @@ -4062,16 +4062,24 @@ int FileStore::_rmattrs(coll_t cid, const hobject_t& oid, dout(15) << "rmattrs " << cid << "/" << oid << dendl; map aset; - int r = _getattrs(cid, oid, aset); + int r = 0; + int fd = lfn_open(cid, oid, 0); + if (fd < 0) { + r = -errno; + goto out; + } + r = _fgetattrs(fd, aset, false); if (r >= 0) { for (map::iterator p = aset.begin(); p != aset.end(); p++) { char n[CHAIN_XATTR_MAX_NAME_LEN]; get_attrname(p->first.c_str(), n, CHAIN_XATTR_MAX_NAME_LEN); - r = lfn_removexattr(cid, oid, n); + r = chain_fremovexattr(fd, n); if (r < 0) break; } } + TEMP_FAILURE_RETRY(::close(fd)); + if (g_conf->filestore_xattr_use_omap) { set omap_attrs; Index index; @@ -4092,6 +4100,7 @@ int FileStore::_rmattrs(coll_t cid, const hobject_t& oid, return r; } } + out: dout(10) << "rmattrs " << cid << "/" << oid << " = " << r << dendl; return r; }