From cf8fe3f05c9ce0fce1dfe21715676d3657706c22 Mon Sep 17 00:00:00 2001 From: Sebastien Ponce Date: Mon, 30 Mar 2015 15:15:30 +0200 Subject: [PATCH 1/2] XrdCeph : Custom treatment for '/' in stats Answer was ENOENT so far, as it should. It will now answer that this dir exists, so that listing of '/' is authorized and lists all content of the object store --- src/XrdCeph/XrdCephOss.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/XrdCeph/XrdCephOss.cc b/src/XrdCeph/XrdCephOss.cc index a3ec4a78c38..b25e7171d22 100644 --- a/src/XrdCeph/XrdCephOss.cc +++ b/src/XrdCeph/XrdCephOss.cc @@ -108,7 +108,15 @@ int XrdCephOss::Stat(const char* path, int opts, XrdOucEnv* env) { try { - return ceph_posix_stat(env, path, buff); + if (!strcmp(path, "/")) { + // special case of a stat made by the locate interface + // we intend to then list all files + memset(buff, 0, sizeof(*buff)); + buff->st_mode = S_IFDIR | 0700; + return 0; + } else { + return ceph_posix_stat(env, path, buff); + } } catch (std::exception e) { XrdCephEroute.Say("stat : invalid syntax in file parameters"); return -EINVAL; From 5343952431f3be788c1c7da4e5e6e88dfcea3542 Mon Sep 17 00:00:00 2001 From: Sebastien Ponce Date: Mon, 30 Mar 2015 15:38:11 +0200 Subject: [PATCH 2/2] XrdCeph : fixed retrieval of IoCtx. This triggered EINVAL answer to all stats call --- src/XrdCeph/XrdCephPosix.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/XrdCeph/XrdCephPosix.cc b/src/XrdCeph/XrdCephPosix.cc index d822c2447df..4f17fb7fa21 100644 --- a/src/XrdCeph/XrdCephPosix.cc +++ b/src/XrdCeph/XrdCephPosix.cc @@ -425,7 +425,11 @@ static librados::IoCtx* getIoCtx(const CephFile& file) { if (0 == striper) { return 0; } - return g_ioCtx[file.pool]; + std::stringstream ss; + ss << file.userId << '@' << file.pool << ',' << file.nbStripes << ',' + << file.stripeUnit << ',' << file.objectSize; + std::string userAtPool = ss.str(); + return g_ioCtx[userAtPool]; } void ceph_posix_disconnect_all() {