All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Yan, Zheng" <zheng.z.yan@intel.com>
To: Sage Weil <sage@inktank.com>, ceph-devel@vger.kernel.org
Subject: Re: LOOKUPPARENT
Date: Fri, 07 Mar 2014 08:15:44 +0800	[thread overview]
Message-ID: <53190FB0.2060902@intel.com> (raw)
In-Reply-To: <alpine.DEB.2.00.1403061441340.3593@cobra.newdream.net>

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
> 


      reply	other threads:[~2014-03-07  0:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-06 22:44 LOOKUPPARENT Sage Weil
2014-03-07  0:15 ` Yan, Zheng [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53190FB0.2060902@intel.com \
    --to=zheng.z.yan@intel.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=sage@inktank.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.