Re: Errors from basic open_by_handle operations

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx
http://oss.sgi.com/mailman/listinfo/xfs




[Index of Archives]     [Linux XFS Devel]     [Linux Filesystem Development]     [Filesystem Testing]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux