Skip to contentSkip to conversation

Update Client to handle self directories

PATCH Applied Brian Chrisman 2 participants 4 messages May 12, 2011

lore
Share & tools
lore
#0 lore raw

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(-)
#1 lore raw

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
index 10a6829..6ab4643 100644
@@ -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
#2 lore raw

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
index da4b7a2..520fa75 100644
@@ -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
Applied
#3 lore raw
In reply to Brian Chrisman

Applied, 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 stat

 src/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