Skip to content
This repository has been archived by the owner on Feb 26, 2020. It is now read-only.

Introduced spl_dirname function. #649

Closed
wants to merge 1 commit into from
Closed

Conversation

ab-oe
Copy link

@ab-oe ab-oe commented Sep 8, 2017

Since commit 8bcb77fabd7cbabcad49f58750be8683febee92b in kernel tree the logic for getting parent path doesn't work. The parent points to the file itself instead of its parent path. This results that the cache file for pool is never removed.

The new function returns parent directory where the file is placed. Then kern_path is executed with the parent directory name and the LOOKUP_DIR flag. Returned parent structure will point to correct
parent path.

Addresses: #648

Since commit 8bcb77fabd7cbabcad49f58750be8683febee92b in kernel tree
the logic for getting parent path doesn't work. The parent points to
the file itself instead of its parent path. This results that the cache
file for pool is never removed.

The new function returns parent directory where the file is placed.
Then kern_path is executed with the parent directory name and the
LOOKUP_DIR flag. Returned parent structure will point to correct
parent path.

Signed-off-by: Arkadiusz Bubała <arkadiusz.bubala@open-e.com>
Copy link
Contributor

@behlendorf behlendorf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ab-oe sorry I lost track of this one. These functions have been historically problematic and very lightly used. Perhaps the best thing to do here is outright remove them rather than patch them again. What do you think of this for an alternate fix, openzfs/zfs#6753

if (!dirname)
return (ERR_PTR(-ENOMEM));

rc = kern_path(dirname, LOOKUP_DIR, &parent);
if (rc)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dirname will be leaked in this error path.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. You're right the kfree should be put before the if condition.

@behlendorf
Copy link
Contributor

Closing. Replaced by #661 where this functionality is removed.

@behlendorf behlendorf closed this Oct 19, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants