void SyntheticClient::foo()
{
+ if (1) {
+ dout(0) << "first" << dendl;
+ int fd = client->open("tester", O_WRONLY|O_CREAT);
+ client->write(fd, "hi there", 0, 8);
+ client->close(fd);
+ dout(0) << "sleep" << dendl;
+ sleep(10);
+ dout(0) << "again" << dendl;
+ fd = client->open("tester", O_WRONLY|O_CREAT);
+ client->write(fd, "hi there", 0, 8);
+ client->close(fd);
+ return;
+ }
if (1) {
// open some files
srand(0);
// they have a high request rate.
}
- // okay, i want
- CInode *ref = 0;
-
// retry?
if (req->get_retry_attempt()) {
assert(session);
if (!mdr) return;
mdr->session = session;
- if (ref) {
- dout(10) << "inode op on ref " << *ref << dendl;
- mdr->ref = ref;
- mdr->pin(ref);
- }
-
dispatch_client_request(mdr);
return;
}
CInode* Server::rdlock_path_pin_ref(MDRequest *mdr, bool want_auth)
{
+ dout(10) << "rdlock_path_pin_ref " << *mdr << dendl;
+
// already got ref?
- if (mdr->ref)
+ if (mdr->ref) {
+ if (mdr->trace.size()) {
+ CDentry *last = mdr->trace[mdr->trace.size()-1];
+ assert(last->get_inode() == mdr->ref);
+ }
+ dout(10) << "rdlock_path_pin_ref had " << *mdr->ref << dendl;
return mdr->ref;
+ }
MClientRequest *req = mdr->client_request;
{
MClientRequest *req = mdr->client_request;
+ dout(10) << "rdlock_path_xlock_dentry " << *mdr << dendl;
+
+ if (mdr->ref) {
+ CDentry *last = mdr->trace[mdr->trace.size()-1];
+ assert(last->get_inode() == mdr->ref);
+ dout(10) << "rdlock_path_xlock_dentry had " << *last << " " << *mdr->ref << dendl;
+ return last;
+ }
+
vector<CDentry*> trace;
CDir *dir = traverse_to_auth_dir(mdr, trace, req->get_filepath());
if (!dir) return 0;
bool need_auth = !file_mode_is_readonly(cmode) || (flags & O_TRUNC);
+ dout(7) << "open on " << req->get_filepath() << dendl;
+
CInode *cur = rdlock_path_pin_ref(mdr, need_auth);
if (!cur) return;
}
// pass to regular open handler.
+ mdr->trace.push_back(dn);
+ mdr->ref = dn->get_inode();
handle_client_open(mdr);
return;
}