xfs
[Top] [All Lists]

Re: Errors from basic open_by_handle operations

To: Mark Hills <mark.hills@xxxxxxxxxxxxxx>
Subject: Re: Errors from basic open_by_handle operations
From: Roger Willcocks <roger@xxxxxxxxxxxxxxxx>
Date: Thu, 09 Apr 2015 14:09:23 +0100
Cc: xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <1504091316590.18609@xxxxxxxxxxxxxxxxxxxxxxxxx>
References: <1504091316590.18609@xxxxxxxxxxxxxxxxxxxxxxxxx>
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);


On Thu, 2015-04-09 at 13:53 +0100, Mark Hills wrote:
> I am having troubles with elementary file handle functions in libhandle.
> 
> A basic open_by_handle is giving "Bad file descriptor".
> 
> But I am suspicious of a side effect; using path_to_fshandle earlier in 
> the program changes these errors to "Operation not permitted".
> 
> Is there a basic mistake in my use of these calls, or a bug/unmaintained 
> code?
> 
> I am on an XFS filesystem (otherwise the first call fails with 
> 'inappropriate ioctl'). The only documentation I can find is the man page; 
> no mention about initialising the library, and I wasn't able to find any 
> examples.
> 
> I'm on Scientific Linux 6.6 (like RedHat 6, kernel 2.6.32-504.1.3), and 
> also tried updating to the latest xfsprogs from Git, with the same 
> results.
> 
> Many thanks
> 
-- 
Roger Willcocks <roger@xxxxxxxxxxxxxxxx>

<Prev in Thread] Current Thread [Next in Thread>