-
Notifications
You must be signed in to change notification settings - Fork 341
DAOS-18262 common: make sure DAOS file permissions are always 0XXY #17680
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
base: master
Are you sure you want to change the base?
Changes from all commits
8eece70
b72f0bc
2b76e46
1d6435b
11cdd57
a0643f4
7d42b83
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,7 +29,7 @@ type ( | |
| Getfs(device string) (string, error) | ||
| GetfsType(path string) (*system.FsType, error) | ||
| GetDeviceLabel(string) (string, error) | ||
| Mkdir(string, os.FileMode) error | ||
| Mkdir2(string, os.FileMode) error | ||
| Mkfs(req system.MkfsReq) error | ||
| RemoveAll(string) error | ||
| Stat(string) (os.FileInfo, error) | ||
|
|
@@ -196,11 +196,13 @@ func (p *Provider) isUsableFS(fs *system.FsType, path string) bool { | |
| } | ||
|
|
||
| func (p *Provider) setupDataDir(req storage.MetadataFormatRequest) error { | ||
| perms := os.FileMode(0775) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would it make sense to have a constant somewhere indicating these new default perms? Same question applies at the engine level. If we define the permission values in a C header file for the engines, we can import it in our Go package lib/daos.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I did not go all the way. We still use a variety of values e.g. there are directories 0770 and 0775. And I do not want to change it in this PR because I do not want to remove any permissions and I do want not grant more than it was agreed to be granted. For now I created two constants in the Go code: We can discuss next steps in a separate ticket. I think the way is open assuming no opposition will come up. Please note we would have to possibly remove some permissions people were used to have. It is not obvious it would be a desirable change to have one set of permissions for all files and all directories across the project. |
||
|
|
||
| if err := p.sys.RemoveAll(req.DataPath); err != nil { | ||
| return errors.Wrap(err, "removing old control metadata subdirectory") | ||
| } | ||
|
|
||
| if err := p.sys.Mkdir(req.DataPath, 0755); err != nil { | ||
| if err := p.sys.Mkdir2(req.DataPath, perms); err != nil { | ||
| return errors.Wrap(err, "creating control metadata subdirectory") | ||
| } | ||
|
|
||
|
|
@@ -210,7 +212,7 @@ func (p *Provider) setupDataDir(req storage.MetadataFormatRequest) error { | |
|
|
||
| for _, idx := range req.EngineIdxs { | ||
| engPath := storage.ControlMetadataEngineDir(req.DataPath, idx) | ||
| if err := p.sys.Mkdir(engPath, 0755); err != nil { | ||
| if err := p.sys.Mkdir2(engPath, perms); err != nil { | ||
| return errors.Wrapf(err, "creating control metadata engine %d subdirectory", idx) | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a unit test for this would be good practice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.