opendir_cb: use attributes from the nested mount in opendir

When opendir_cb encounters an entry that refers to a nested mount, then
replace the attributes with those attributes we collected for this export
during the mount and return those instead.

This makes traversing a director that crosses into a different filesystem
on the server transparent to the client.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
libnfs-4.0.0-vitalif
Ronnie Sahlberg 2015-01-17 11:32:31 -08:00
parent 27348486f6
commit 1eea1c4647
1 changed files with 16 additions and 0 deletions

View File

@ -3856,6 +3856,22 @@ static void nfs_opendir_cb(struct rpc_context *rpc, int status, void *command_da
if (entry->name_attributes.attributes_follow)
attr = &entry->name_attributes.post_op_attr_u.attributes;
if (attr == NULL) {
struct nested_mounts *mnt;
int splen = strlen(data->saved_path);
/* No name attributes. Is it a nested mount then?*/
for(mnt = nfs->nested_mounts; mnt; mnt = mnt->next) {
if (strncmp(data->saved_path, mnt->path, splen))
continue;
if (mnt->path[splen] != '/')
continue;
if (strcmp(mnt->path + splen + 1, entry->name))
continue;
attr = &mnt->attr;
break;
}
}
if (attr) {
nfsdirent->type = attr->type;