* [pbs-devel] [PATCH proxmox-backup] datastore: chown base dir on creation
@ 2020-07-09 16:15 Stoiko Ivanov
2020-07-09 19:32 ` [pbs-devel] applied: " Thomas Lamprecht
0 siblings, 1 reply; 2+ messages in thread
From: Stoiko Ivanov @ 2020-07-09 16:15 UTC (permalink / raw)
To: pbs-devel
When creating a new datastore the basedir is only owned by the backup
user if it did not exist beforehand (create_path chowns only if it
creates the directory), and returns false if it did not create the
directory).
This improves the experience when adding a new datastore on a fresh
disk or existing directory (not owned by backup) - backups/pulls can
be run instead of terminating with EPERM.
Tested on my local testinstall with a new disk, and a existing directory:
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
---
src/backup/chunk_store.rs | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/backup/chunk_store.rs b/src/backup/chunk_store.rs
index d21c232d..87000630 100644
--- a/src/backup/chunk_store.rs
+++ b/src/backup/chunk_store.rs
@@ -80,8 +80,9 @@ impl ChunkStore {
let default_options = CreateOptions::new();
- if let Err(err) = create_path(&base, Some(default_options.clone()), Some(options.clone())) {
- bail!("unable to create chunk store '{}' at {:?} - {}", name, base, err);
+ match create_path(&base, Some(default_options.clone()), Some(options.clone())) {
+ Err(err) => bail!("unable to create chunk store '{}' at {:?} - {}", name, base, err),
+ Ok(res) => if ! res { nix::unistd::chown(&base, Some(uid), Some(gid))? },
}
if let Err(err) = create_dir(&chunk_dir, options.clone()) {
--
2.20.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* [pbs-devel] applied: Re: [PATCH proxmox-backup] datastore: chown base dir on creation
2020-07-09 16:15 [pbs-devel] [PATCH proxmox-backup] datastore: chown base dir on creation Stoiko Ivanov
@ 2020-07-09 19:32 ` Thomas Lamprecht
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2020-07-09 19:32 UTC (permalink / raw)
To: Proxmox Backup Server development discussion, Stoiko Ivanov
On 09.07.20 18:15, Stoiko Ivanov wrote:
> When creating a new datastore the basedir is only owned by the backup
> user if it did not exist beforehand (create_path chowns only if it
> creates the directory), and returns false if it did not create the
> directory).
>
> This improves the experience when adding a new datastore on a fresh
> disk or existing directory (not owned by backup) - backups/pulls can
> be run instead of terminating with EPERM.
>
> Tested on my local testinstall with a new disk, and a existing directory:
>
> Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
> ---
> src/backup/chunk_store.rs | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
>
applied, thanks!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-07-09 19:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-09 16:15 [pbs-devel] [PATCH proxmox-backup] datastore: chown base dir on creation Stoiko Ivanov
2020-07-09 19:32 ` [pbs-devel] applied: " Thomas Lamprecht
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox