Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DAOS-14219 dfs: checker should not follow symlinks #13625

Merged
merged 1 commit into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/client/dfs/dfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -6686,7 +6686,7 @@ oit_mark_cb(dfs_t *dfs, dfs_obj_t *parent, const char name[], void *args)
}

/** open the entry name and get the oid */
rc = dfs_lookup_rel(dfs, parent, name, O_RDONLY, &obj, NULL, NULL);
rc = dfs_lookup_rel(dfs, parent, name, O_RDONLY | O_NOFOLLOW, &obj, NULL, NULL);
if (rc) {
D_ERROR("dfs_lookup_rel() of %s failed: %d\n", name, rc);
return rc;
Expand Down
8 changes: 7 additions & 1 deletion src/tests/suite/dfs_unit_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -2503,7 +2503,7 @@ dfs_test_checker(void **state)
test_arg_t *arg = *state;
dfs_t *dfs;
int nr = 100, i;
dfs_obj_t *root, *lf;
dfs_obj_t *root, *lf, *sym;
daos_obj_id_t root_oid;
daos_handle_t root_oh;
daos_handle_t coh;
Expand Down Expand Up @@ -2574,6 +2574,12 @@ dfs_test_checker(void **state)
assert_int_equal(rc, 0);
}

/** create a symlink with a non-existent target in the container */
rc = dfs_open(dfs, NULL, "SL1", S_IFLNK | S_IWUSR | S_IRUSR, O_RDWR | O_CREAT | O_EXCL, 0,
0, "/usr/local", &sym);
assert_int_equal(rc, 0);
rc = dfs_release(sym);

rc = dfs_disconnect(dfs);
assert_int_equal(rc, 0);
/** have to call fini to release the cached container handle for the checker to work */
Expand Down