Update Client to handle self directories
cover Update Client to handle self directories
libceph lookup of the self-referencing '.' directory fails. Patch makes Client class handle '.' specially like it does '..'. testceph updated to check the special cases of lstat(.) and lstat(/.).
Brian Chrisman (2):
Add analogous special case for "." directory alongside ".." in
_lookup
updated test to cover "." directory stat
src/client/Client.cc | 5 +++++ src/client/testceph.cc | 17 +++++++++++++++++ 2 files changed, 22 insertions(+), 0 deletions(-)
PATCH 1/2 Add analogous special case for "." directory alongside ".." in _lookup
--- src/client/Client.cc | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
src/client/Client.cc +5 -0
@@ -3267,6 +3267,11 @@ int Client::_lookup(Inode *dir, const string& dname, Inode **target) goto done; } + if (dname == ".") { + *target = dir; + goto done; + } + if (dname.length() > NAME_MAX) { r = -ENAMETOOLONG; goto done;
Signature · 1 line
1.7.1
PATCH 2/2 updated test to cover "." directory stat
In reply to Brian Chrisman--- src/client/testceph.cc | 17 +++++++++++++++++ 1 files changed, 17 insertions(+), 0 deletions(-)
src/client/testceph.cc +17 -0
@@ -174,6 +174,23 @@ int main(int argc, const char **argv) if (strncmp((char *) aybabtu, aybabtu_reference,7)) { cerr << "ceph_getxattr error: no match (" << aybabtu << ") should be (" << aybabtu_reference << cpp_strerror(ret) << std::endl; } + cout << "Attempting lstat on '/.'" << std::endl; + ret = ceph_lstat(cmount, "/.", &stbuf); + if (ret) { + cerr << "ceph_lstat error: " << cpp_strerror(ret) << std::endl; + return 1; + } else { + cout << "ceph_lstat: success" << std::endl; + } + cout << "Attempting lstat on '.'" << std::endl; + ret = ceph_lstat(cmount, ".", &stbuf); + if (ret) { + cerr << "ceph_lstat error: " << cpp_strerror(ret) << std::endl; + return 1; + } else { + cout << "ceph_lstat: success" << std::endl; + } + ceph_shutdown(cmount);
Signature · 1 line
1.7.1
Sage Weil
AppliedApplied, thanks!
Quoted 19 lines · Brian Chrisman
libceph lookup of the self-referencing '.' directory fails. Patch makes Client class handle '.' specially like it does '..'. testceph updated to check the special cases of lstat(.) and lstat(/.).
Brian Chrisman (2):
Add analogous special case for "." directory alongside ".." in
_lookup
updated test to cover "." directory statsrc/client/Client.cc | 5 +++++ src/client/testceph.cc | 17 +++++++++++++++++ 2 files changed, 22 insertions(+), 0 deletions(-)--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html