All of lore.kernel.org
 help / color / mirror / Atom feed
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 15:34:22 +0100 (BST)	[thread overview]
Message-ID: <1504091515150.18609@sys953.ldn.framestore.com> (raw)
In-Reply-To: <1428588558.5198.483.camel@montana.filmlight.ltd.uk>

On Thu, 9 Apr 2015, Roger Willcocks wrote:

> The code below works here on a CentOS 6.4 box ('test' is a file at the
> root of the volume):
> 
> $ ./a.out
> hlen = 24
> fd = -1
> $ sudo ./a.out
> hlen = 24
> fd = 4

Yup, and I can reproduce that here on my system, thanks.

It seems the subtlety is rooted here:

>   if (path_to_fshandle("/mnt/disk1", &xfs_handle, &hlen) < 0)
>     exit(4);
> 
>   if (path_to_handle("/mnt/disk1/test", &xfs_handle, &hlen) < 0)
>     exit(5);

This code is correct, and it looks like it's necessary to do 
path_to_fshandle on the file system root, otherwise it does not satisfy 
the precondition of open_by_handle().

So what I was doing:

  path_to_fshandle("/mnt/disk1/test-file" ... );
  ...
  path_to_handle("/mnt/disk1/test-file" ... );

even though it reports the expected success (and returns the right file 
handles), is not enough to allow open_by_handle() to work on a file.

It does leave me needing to have prior knowledge of the mounted filesystem 
root (or look it up); handle_to_fshandle() doesn't achieve the same.

Definitely some oddities here -- but now I have enough to get me started 
though I hope.

Thanks for all the help, and perhaps I can look at some patches to the man 
page as I go.

Thanks

-- 
Mark

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

      reply	other threads:[~2015-04-09 14:34 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
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 [this message]

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=1504091515150.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.