From: Mark Hills <mark.hills@framestore.com>
To: Roger Willcocks <roger@filmlight.ltd.uk>
Cc: xfs@oss.sgi.com
Subject: Re: Errors from basic open_by_handle operations
Date: Thu, 9 Apr 2015 14:36:58 +0100 (BST) [thread overview]
Message-ID: <1504091422580.18609@sys953.ldn.framestore.com> (raw)
In-Reply-To: <1428584963.5198.478.camel@montana.filmlight.ltd.uk>
On Thu, 9 Apr 2015, Roger Willcocks wrote:
> There's a small gotcha - the filesystem itself has to have been opened:
>
> void *xfs_handle = 0;
> size_t hlen = 0;
>
> /* xfs library needs the filesystem to have been opened */
>
> if (path_to_fshandle(mountpoint, &xfs_handle, &hlen) < 0) {
> /* error */
> exit(4);
> }
>
> free(xfs_handle);
Thank you Roger, that moves me one step but not to success
Now I know "Operation not permitted" is the correct message I assume that
use of XFS file handles requires root.
But even as root, I cannot open a file with O_RDONLY:
$ sudo ./test-xfs ~/scratch/tmp/xfs/file.c ; echo $?
Handle 8 bytes: bd2c94ba959858
Handle 24 bytes: bd2c94ba959858e0000000870000000
readlink_by_handle: Not a directory
open_by_handle: Not a directory
0
I am able to do open_by_handle(O_RDONLY) on a directory though:
$ sudo ./test-xfs ~/scratch/tmp/xfs/directory ; echo $?
Handle 8 bytes: bd2c94ba959858
Handle 24 bytes: bd2c94ba959858e0000000880000000
readlink_by_handle: Invalid argument
0
and a readlink_by_handle on a symlink works:
$ sudo ./test-xfs ~/scratch/tmp/xfs/link.c ; echo $?
Handle 8 bytes: bd2c94ba959858
Handle 24 bytes: bd2c94ba959858e0000000860000000
Link: fortress.c
open_by_handle: Operation not permitted
0
Switching to O_RDWR does not succeed in opening a file either, and also
stops the directory case.
It seems possible flags are getting mangled and are not what I think they
mean. The docs state the call as analogous to open(); is the 'oflags'
argument actually ready to accept O_RDONLY etc. or some other set of
flags? Because it seems like I can't actually open a file here.
Many thanks
--
Mark
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2015-04-09 13:37 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-09 12:53 Errors from basic open_by_handle operations Mark Hills
2015-04-09 13:09 ` Roger Willcocks
2015-04-09 13:36 ` Mark Hills [this message]
2015-04-09 13:27 ` Dave Chinner
2015-04-09 13:31 ` [PATCH] libhandle: document the need for path_to_handle tinguely
2015-04-13 0:25 ` Dave Chinner
2015-04-09 14:09 ` Errors from basic open_by_handle operations Roger Willcocks
2015-04-09 14:34 ` Mark Hills
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=1504091422580.18609@sys953.ldn.framestore.com \
--to=mark.hills@framestore.com \
--cc=roger@filmlight.ltd.uk \
--cc=xfs@oss.sgi.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.