Skip to content

Commit

Permalink
DAOS-14219 dfs: checker should not follow symlinks (#13625)
Browse files Browse the repository at this point in the history
The DFS checker should mark the symlink oid and not dereference the
symlink value. the value can be invalid anyway and if a valid path in
the container, it would be reachable from the hardlink path.

Signed-off-by: Mohamad Chaarawi <mohamad.chaarawi@intel.com>
  • Loading branch information
mchaarawi committed Jan 22, 2024
1 parent c03333f commit fd618df
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/client/dfs/dfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -6591,7 +6591,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 @@ -2432,7 +2432,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 @@ -2503,6 +2503,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

0 comments on commit fd618df

Please sign in to comment.