* LOOKUPPARENT
@ 2014-03-06 22:44 Sage Weil
2014-03-07 0:15 ` LOOKUPPARENT Yan, Zheng
0 siblings, 1 reply; 2+ messages in thread
From: Sage Weil @ 2014-03-06 22:44 UTC (permalink / raw)
To: ceph-devel, zheng.z.yan
Hey Zheng,
The recent patch that changed LOOKUPPARENT probably broke getcwd() in
Client.cc:
void Client::getcwd(string& dir)
{
filepath path;
ldout(cct, 10) << "getcwd " << *cwd << dendl;
Inode *in = cwd;
while (in != root) {
assert(in->dn_set.size() < 2); // dirs can't be hard-linked
Dentry *dn = in->get_first_parent();
if (!dn) {
// look it up
ldout(cct, 10) << "getcwd looking up parent for " << *in << dendl;
MetaRequest *req = new MetaRequest(CEPH_MDS_OP_LOOKUPPARENT);
filepath path(in->ino);
req->set_filepath(path);
req->set_inode(in);
int res = make_request(req, -1, -1);
if (res < 0)
break;
// start over
path = filepath();
in = cwd;
continue;
}
path.push_front_dentry(dn->name);
in = dn->dir->parent_inode;
}
dir = "/";
dir += path.get_path();
}
The old version would return the diri + dentry + in, the new version just
returns dir. I don't see an old user in the kernel code, but I wonder if
we should
- keep the old semantics (diri + dentry + in) and make the kernel
essentially ignore this information, or
- change getcwd to use LOOKUPINO + WANT_DENTRY to make it work.
?
sage
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: LOOKUPPARENT
2014-03-06 22:44 LOOKUPPARENT Sage Weil
@ 2014-03-07 0:15 ` Yan, Zheng
0 siblings, 0 replies; 2+ messages in thread
From: Yan, Zheng @ 2014-03-07 0:15 UTC (permalink / raw)
To: Sage Weil, ceph-devel
On 03/07/2014 06:44 AM, Sage Weil wrote:
> Hey Zheng,
>
> The recent patch that changed LOOKUPPARENT probably broke getcwd() in
> Client.cc:
>
> void Client::getcwd(string& dir)
> {
> filepath path;
> ldout(cct, 10) << "getcwd " << *cwd << dendl;
>
> Inode *in = cwd;
> while (in != root) {
> assert(in->dn_set.size() < 2); // dirs can't be hard-linked
> Dentry *dn = in->get_first_parent();
> if (!dn) {
> // look it up
> ldout(cct, 10) << "getcwd looking up parent for " << *in << dendl;
> MetaRequest *req = new MetaRequest(CEPH_MDS_OP_LOOKUPPARENT);
> filepath path(in->ino);
> req->set_filepath(path);
> req->set_inode(in);
> int res = make_request(req, -1, -1);
> if (res < 0)
> break;
>
> // start over
> path = filepath();
> in = cwd;
> continue;
> }
> path.push_front_dentry(dn->name);
> in = dn->dir->parent_inode;
> }
> dir = "/";
> dir += path.get_path();
> }
>
> The old version would return the diri + dentry + in, the new version just
> returns dir. I don't see an old user in the kernel code, but I wonder if
> we should
>
> - keep the old semantics (diri + dentry + in) and make the kernel
> essentially ignore this information, or
>
> - change getcwd to use LOOKUPINO + WANT_DENTRY to make it work.
I prefer to change getcwd. The problem of old LOOKUPPARENT semantic is that
client can't lock the parent inode in advance, This breaks VFS locking rules
for lookup.
I added the getcwd fix to https://github.com/ceph/ceph/pull/1385
Regards
Yan, Zheng
>
> ?
> sage
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-03-07 0:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-06 22:44 LOOKUPPARENT Sage Weil
2014-03-07 0:15 ` LOOKUPPARENT Yan, Zheng
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.