linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: Al Viro <viro@ZenIV.linux.org.uk>
Cc: dhowells@redhat.com, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Linus Torvalds <torvalds@linux-foundation.org>,
	linux-security-module@vger.kernel.org, miklos@szeredi.hu
Subject: Re: [RFC] readlink()-related oddities
Date: Fri, 20 Nov 2015 09:59:05 +0000	[thread overview]
Message-ID: <22313.1448013545@warthog.procyon.org.uk> (raw)
In-Reply-To: <20151119232635.GI22011@ZenIV.linux.org.uk>

Al Viro <viro@ZenIV.linux.org.uk> wrote:

> 3) normally, readlink(2) fails for non-symlinks.  Moreover, according to
> POSIX it should do so (with -EINVAL).  There is a pathological case when
> it succeeds for a directory, though.  Namely, one of the kinds of AFS
> "mountpoints".

All AFS mountpoints are magic symlinks that are specially interpreted by the
client as far as I'm aware.  I'm not sure why the designers didn't just select
a different file type for them, but they didn't.

Unfortunately, it means that iget has to read the contents of the symlinks :-/

> stat(2) reports those as directories, stepping into them leads to
> automounting a directory there (why do we have ->open() for them, BTW?).

I think I put that in to make sure the open() syscall returned EREMOTE rather
than another error if you tried to open it.  It can probably be removed
because with the d_automount code you can't ever get there I think - unless
you can pass AT_NO_AUTOMOUNT to openat().

> How the hell is userland supposed to guess to call readlink(2) on those
> suckers to get the information of what'll get automounted there if we step
> upon them?

There's an AFS userspace command that could be used to query a mountpoint that
was going to use it.  However, I suspect readlink() will now always trigger
the automount.  This is one of the things OpenAFS uses pioctl() for - but
since I'm not allowed to add that to the kernel, I have to find some other way
of doing it.

> And could we please get rid of that kludge?  David?

Sure.

David

  parent reply	other threads:[~2015-11-20  9:59 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-19 23:26 [RFC] readlink()-related oddities Al Viro
2015-11-20  2:13 ` Linus Torvalds
2015-11-20  2:57   ` Al Viro
2015-11-20  3:09     ` Linus Torvalds
2015-11-20  3:16       ` Linus Torvalds
2015-11-20  3:24         ` Al Viro
2015-11-20 10:00   ` David Howells
2015-11-20  9:59 ` David Howells [this message]
2015-11-20 16:08   ` Al Viro
2015-11-20 16:26   ` David Howells
2015-11-20 22:33   ` Al Viro

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=22313.1448013545@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=torvalds@linux-foundation.org \
    --cc=viro@ZenIV.linux.org.uk \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).