mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@redhat.com>
To: Eric Blake <ebb9@byu.net>
Cc: linux-kernel@vger.kernel.org
Subject: Re: make getdents/readdir POSIX compliant wrt mount-point  dirent.d_ino
Date: Wed, 4 Nov 2009 15:22:34 -0500	[thread overview]
Message-ID: <20091104152234.1d4b2b81@tlielax.poochiereds.net> (raw)
In-Reply-To: <loom.20090903T164650-995@post.gmane.org>

On Thu, 3 Sep 2009 14:50:52 +0000 (UTC)
Eric Blake <ebb9@byu.net> wrote:

> Ulrich Drepper <drepper <at> gmail.com> writes:
> 
> > I guess that this is really a difficult way to solve.  I wouldn't want
> > to pay for something which is hardly ever really used.
> > 
> > But there are programs out there which would like to use the inode
> > uniqueness.  Therefore the next best thing to do is perhaps to return
> > a flag in the getdents information (in d_type, perhaps) to indicate
> > that this is a mount point and/or that there are multiple ways to
> > access the file in question.  Then programs which can use the inode
> > information can be watching for this flag and enter the slow path only
> > if it's set.
> 
> An alternative to a flag in d_type might be setting d_ino to a sentinel value
> (there is plenty of existing code that refuses to use a readdir entry with d_ino
> of 0, so it would have to be something else; but maybe -1 would work).  But I
> definitely like your idea of making it obvious to the application (whether by
> d_ino or d_type) when it is necessary to use lstat to validate the inode number,
> and promising that if the flag is not set then d_ino is correct.
> 

The only problem with those schemes is that they assume that you're
using getdents. If you just lstat something then it's not clear.

It seems like a better scheme might be to do something that makes this
clear when using an lstat call too. Maybe we could coopt a bit in the
st_mode?

S_IFXDEV          020000

That's outside of the S_IFMT mask, so it shouldn't break S_IS* checks,
right?

-- 
Jeff Layton <jlayton@redhat.com>

  reply	other threads:[~2009-11-04 20:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-01 13:07 Jim Meyering
2009-09-01 20:19 ` Theodore Tso
2009-09-01 22:03   ` Ulrich Drepper
2009-09-03 14:50     ` Eric Blake
2009-11-04 20:22       ` Jeff Layton [this message]
2009-11-04 19:29     ` Jim Meyering
2009-11-05 19:48       ` Theodore Tso
2009-11-05 23:28         ` Jim Meyering

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=20091104152234.1d4b2b81@tlielax.poochiereds.net \
    --to=jlayton@redhat.com \
    --cc=ebb9@byu.net \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®