linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Eric Biggers <ebiggers3@gmail.com>
Cc: David Howells <dhowells@redhat.com>,
	linux-xfs <linux-xfs@vger.kernel.org>,
	Andreas Dilger <adilger@dilger.ca>,
	Christoph Hellwig <hch@infradead.org>,
	linux-fsdevel@vger.kernel.org, Eric Sandeen <sandeen@sandeen.net>
Subject: Re: The XFS_IOC_FSGEOMETRY ioctl doesn't like fds that are opened O_PATH
Date: Wed, 29 Mar 2017 20:25:14 -0700	[thread overview]
Message-ID: <20170330032514.GE4874@birch.djwong.org> (raw)
In-Reply-To: <20170330025620.GA789@zzz>

On Wed, Mar 29, 2017 at 07:56:20PM -0700, Eric Biggers wrote:
> On Wed, Mar 29, 2017 at 05:23:28PM -0700, Darrick J. Wong wrote:
> > On Thu, Mar 30, 2017 at 12:57:08AM +0100, David Howells wrote:
> > > Should XFS_IOC_FSGEOMETRY work on fds that are opened O_PATH on an XFS
> > > filesystem?  Or should xfs_io not call that ioctl on O_PATH fds?
> > 
> > Given that read/write don't work under O_PATH, I wouldn't expect ioctls
> > to work either.
> > 
> > I tried to write a two line program to call FSGEOMETRY to see what
> > actually happens but got so bogged down in trying to figure out what
> > magic incantation of C headers one needs to pull in the appropriate
> > structure typedefs for an ioctl I wasn't even trying to call that I gave
> > up.
> > 
> > Seriously, what the f*ck do you have to #include just to be able to use
> > O_PATH?
> 
> From open(2):
> 
>       "The O_DIRECT, O_NOATIME, O_PATH, and  O_TMPFILE  flags  are
>       Linux-specific.  One must define _GNU_SOURCE to obtain their definitions."

Ah, thank you.  I missed that, having skipped straight to the section on
O_PATH... ($deity I hate userspace)

> Also, ioctl() with an O_PATH file descriptor always fails with EBADF because
> sys_ioctl() uses fdget() rather than fdget_raw().  The filesystem isn't involved
> at all.  This is intentional, I believe.

Yes, it is.

--D

> 
> - Eric

  reply	other threads:[~2017-03-30  3:25 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-28 14:29 [PATCH] xfs_io: Allow "open -P" to specify O_PATH David Howells
2017-03-29 21:52 ` [PATCH] xfs_io: Allow -P and -L to be given to open for O_PATH and O_NOFOLLOW David Howells
2018-03-02  3:27   ` Eric Sandeen
2017-03-29 23:57 ` The XFS_IOC_FSGEOMETRY ioctl doesn't like fds that are opened O_PATH David Howells
2017-03-30  0:23   ` Darrick J. Wong
2017-03-30  2:56     ` Eric Biggers
2017-03-30  3:25       ` Darrick J. Wong [this message]
2017-03-30  8:03     ` David Howells
2017-03-30 16:29 ` [PATCH] xfs_io: Allow "open -P" to specify O_PATH Eric Sandeen

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=20170330032514.GE4874@birch.djwong.org \
    --to=darrick.wong@oracle.com \
    --cc=adilger@dilger.ca \
    --cc=dhowells@redhat.com \
    --cc=ebiggers3@gmail.com \
    --cc=hch@infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=sandeen@sandeen.net \
    /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).