All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vivek Goyal <vgoyal@redhat.com>
To: Misono Tomohiro <misono.tomohiro@jp.fujitsu.com>
Cc: virtio-fs@redhat.com
Subject: Re: [Virtio-fs] [PATCH] virtiofsd: Fix xattr operations
Date: Fri, 10 Jan 2020 15:00:43 -0500	[thread overview]
Message-ID: <20200110200043.GE28043@redhat.com> (raw)
In-Reply-To: <20200110161334.GD28043@redhat.com>

On Fri, Jan 10, 2020 at 11:13:34AM -0500, Vivek Goyal wrote:

[..]
> >      if (size) {
> > @@ -2378,7 +2385,11 @@ static void lo_getxattr(fuse_req_t req, fuse_ino_t ino, const char *name,
> >              goto out_err;
> >          }
> >  
> > -        ret = fgetxattr(fd, name, value, size);
> > +        if (inode->is_regular) {
> > +            ret = fgetxattr(fd, name, value, size);
> > +        } else {
> > +            ret = getxattr(procname, name, value, size);
> > +        }
> 
> Do we need "lgetxattr()" instead of "getxattr()" for symlinks?

Well, lgetxattr() will not work as that will try to work on
/proc/pid/fd/<fdN>" and that's just a /proc file.

> 
> Say I have following setup.
> 
> foo-symlink -> foo.txt
> 
> Now lo_lookup(foo-symlink.txt, O_PATH | O_NOFOLLOW), will get fd on
> symlink, say 3. And proc should show something similar.
> 
> And /proc/self/fd/3 -> /foo-symlink.txt
> 
> Now if we do getxattr(3), will it not resolve symlinks and get xattr value
> from "foo.txt" instead?

That does not happen. We had opened 3, with O_PATH and O_NOFOLLOW. So
looks like all the operations now happen on actual symbolic file and
if this is path to a symlink file, it does not get resolved further.
Is it because of O_NOFOLLOW flag?

Vivek


  reply	other threads:[~2020-01-10 20:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-10  1:07 [Virtio-fs] [PATCH] virtiofsd: Fix xattr operations Misono Tomohiro
2020-01-10 16:13 ` Vivek Goyal
2020-01-10 20:00   ` Vivek Goyal [this message]
2020-01-13 18:38 ` Vivek Goyal
2020-01-13 19:36   ` Miklos Szeredi
2020-01-14  1:17     ` misono.tomohiro
2020-01-14  7:49       ` Miklos Szeredi
2020-01-14 11:34         ` misono.tomohiro
2020-01-14 12:55       ` Vivek Goyal

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=20200110200043.GE28043@redhat.com \
    --to=vgoyal@redhat.com \
    --cc=misono.tomohiro@jp.fujitsu.com \
    --cc=virtio-fs@redhat.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.