[email protected]:
> I will dive into these two problems,
> - the return code of "encode_fh()"
> - supporting name_to_handle_at()
> when I have enough time.
> Unfortunately I am busy in these days, and I don't know when it will be.
I have took a glance at "encode_fh()" and name_to_handle_at(), and found
that aufs has nothing necessary to support it.
- the protocol around the return code of "encode_fh()" is unchanged.
- aufs already supports name_to_handle_at().
Also I looked at systemd and found the suspicous code around handling
the error of name_to_handle_at().
- systemd calls name_to_handle_at()
- name_to_handle_at() calls aufs's "encode_fh()"
- "encode_fh()" return an error since your branch fs is NFS which
doesn't support exporting via NFS.
- name_to_handle_at() gets 255 from aufs and returns EOVERFLOW to
userspace.
linux/fs/fhandle.c:do_sys_name_to_handle()
/* we ask for a non connected handle */
retval = exportfs_encode_fh(path->dentry,
(struct fid *)handle->f_handle,
&handle_dwords, 0); // which calls
aufs's "encode_fh()"
:::
if ((handle->handle_bytes > f_handle.handle_bytes) ||
(retval == 255) || (retval == -ENOSPC)) {
/* As per old exportfs_encode_fh documentation
* we could return ENOSPC to indicate overflow
* But file system returned 255 always. So handle
* both the values
*/
/*
* set the handle size to zero so we copy only
* non variable part of the file_handle
*/
handle_bytes = 0;
retval = -EOVERFLOW;
} else
retval = 0;
- systemd gets EOVERFLOW from name_to_handle_at(), but it doesn't handle
this error code.
systemd/src/shared/path-util.c:path_is_mount_point()
r = name_to_handle_at(AT_FDCWD, t, h, &mount_id, allow_symlink ?
AT_SYMLINK_FOLLOW : 0);
if (r < 0) {
if (errno == ENOSYS || errno == ENOTSUP)
/* This kernel or file system does not support
* name_to_handle_at(), hence fallback to the
* traditional stat() logic */
goto fallback;
if (errno == ENOENT)
return 0;
return -errno;
}
:::
r = name_to_handle_at(AT_FDCWD, parent, h, &mount_id_parent, 0);
:::
if (r < 0) {
/* The parent can't do name_to_handle_at() but the
* directory we are interested in can? If so, it must
* be a mount point */
if (errno == ENOTSUP)
return 1;
return -errno;
}
Although I didn't read the systemd's fallback routine, my current
conclusion is,
- as long as systemd doesn't handle EOVERFLOW (and doesn't go into the
fallback routine), systemd will not work with many(? a few?) fs, I am
afraid.
- if systemd support EOVERFLOW, aufs can co-work with systemd. the "nfs
branch is not exportable" message will be still produced, but systemd
will go into its fallback routine.
- since systemd has "configure" script and if you disable
CONFIG_FHANDLE, then systemd will not try calling name_to_handle_at().
And it will go into the fallback routine. and you will be happy too.
J. R. Okajima
------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov