diff --git a/daemon/readdir.c b/daemon/readdir.c index 2e44bd0..d1e5644 100644 --- a/daemon/readdir.c +++ b/daemon/readdir.c @@ -190,6 +190,11 @@ static void readdir_copy_full_dir_info( IN PFILE_DIR_INFO_UNION info) { readdir_copy_dir_info(entry, info); + /* for files with the FILE_ATTRIBUTE_REPARSE_POINT attribute, + * EaSize is used instead to specify its reparse tag. this makes + * the 'dir' command to show files as , and triggers a + * FSCTL_GET_REPARSE_POINT to query the symlink target + */ info->fifdi.EaSize = entry->attr_info.type == NF4LNK ? IO_REPARSE_TAG_SYMLINK : 0; } diff --git a/daemon/setattr.c b/daemon/setattr.c index 62ac20c..58b8c8a 100644 --- a/daemon/setattr.c +++ b/daemon/setattr.c @@ -261,7 +261,8 @@ static int handle_nfs41_rename(setattr_upcall_args *args) /* replace the path with the symlink target's */ status = nfs41_symlink_target(dst_session, &dst_dir, &dst_path); if (status) { - eprintf("nfs41_symlink_target() failed with %d\n", status); + eprintf("nfs41_symlink_target() for %s failed with %d\n", + dst_dir.path->path, status); goto out; } @@ -375,7 +376,8 @@ int handle_nfs41_link(setattr_upcall_args *args) /* replace the path with the symlink target's */ status = nfs41_symlink_target(dst_session, &dst_dir, &dst_path); if (status) { - eprintf("nfs41_symlink_target() failed with %d\n", status); + eprintf("nfs41_symlink_target() for %s failed with %d\n", + dst_dir.path->path, status); goto out; } diff --git a/daemon/symlink.c b/daemon/symlink.c index 0373f4b..36ac8c1 100644 --- a/daemon/symlink.c +++ b/daemon/symlink.c @@ -106,7 +106,8 @@ int nfs41_symlink_target( /* read the link */ status = nfs41_readlink(session, file, NFS41_MAX_PATH_LEN, link, &link_len); if (status) { - eprintf("nfs41_readlink() failed with %s\n", nfs_error_string(status)); + eprintf("nfs41_readlink() for %s failed with %s\n", file->path->path, + nfs_error_string(status)); status = ERROR_PATH_NOT_FOUND; goto out; } @@ -115,7 +116,7 @@ int nfs41_symlink_target( /* append any components after the symlink */ if (FAILED(StringCchCatA(link, NFS41_MAX_PATH_LEN, - file->name.name + file->name.len))) { + file->name.name + file->name.len))) { status = ERROR_BUFFER_OVERFLOW; goto out; } @@ -135,7 +136,8 @@ int nfs41_symlink_target( } status = abs_path_link(target, target->path + path_offset, link, link_len); if (status) { - eprintf("abs_path_link() failed with %d\n", status); + eprintf("abs_path_link() for path %s with link %s failed with %d\n", + target->path, link, status); goto out; } out: @@ -238,6 +240,9 @@ int handle_symlink(nfs41_upcall *upcall) if (state->file.fh.len) { /* the check in handle_open() didn't catch that we're creating * a symlink, so we have to remove the file it already created */ + eprintf("handle_symlink: attempting to create a symlink when " + "the file=%s was already created on open; sending REMOVE " + "first\n", state->file.path->path); nfs41_remove(state->session, &state->parent, &state->file.name); } @@ -245,8 +250,8 @@ int handle_symlink(nfs41_upcall *upcall) status = nfs41_create(state->session, NF4LNK, 0777, args->target_set, &state->parent, &state->file); if (status) { - eprintf("nfs41_create() failed with %s\n", - nfs_error_string(status)); + eprintf("nfs41_create() for symlink=%s failed with %s\n", + args->target_set, nfs_error_string(status)); status = map_symlink_errors(status); goto out; } @@ -257,8 +262,8 @@ int handle_symlink(nfs41_upcall *upcall) status = nfs41_readlink(state->session, &state->file, NFS41_MAX_PATH_LEN, args->target_get.path, &len); if (status) { - eprintf("nfs41_readlink() failed with %s\n", - nfs_error_string(status)); + eprintf("nfs41_readlink() for filename=%s failed with %s\n", + state->file.path->path, nfs_error_string(status)); status = map_symlink_errors(status); goto out; }