Skip to content
This repository has been archived by the owner on Nov 8, 2019. It is now read-only.

pmempool info: different outputs when run on unaccessible parts (in sense of permissions) #815

Closed
dsciebu opened this issue Feb 23, 2018 · 2 comments

Comments

@dsciebu
Copy link

dsciebu commented Feb 23, 2018

Let's consider the following poolset file:

PMEMPOOLSET
AUTO /dev/dax0.0
AUTO /dev/dax1.0
OPTION SINGLEHDR

Existence of poolset option is optional :) (with or without it the result is the same).

After creating the poolset file you:

  1. (as root) create poolset with pmempool create obj/blk/log (no difference) e.g.
    pmempool create blk 512 /home/nuser/pool.set
  2. change access permissions of a single part (to 662 or 664) e.g.
    chmod 662 /dev/dax0.0
  3. as another user, run pmempool info on the poolset file e.g.
    runuser -l nuser -c "pmempool info /home/nuser/pool.set"

The sample course:

linux:~/test # chmod 664 /dev/dax1.0
linux:~/test # ll /dev | grep dax
crw-rw-rw- 1 root root    250,   0 Feb  8 11:40 dax0.0
crw-rw-r-- 1 root root    250,   1 Feb  8 11:40 dax1.0
linux:~/test # runuser -l nuser -c "pmempool info /home/nuser/pool.set"
error: opening poolset failed
/home/nuser/pool.set: Permission denied

linux:~/test # chmod 662 /dev/dax1.0
linux:~/test # ll /dev | grep dax
crw-rw-rw- 1 root root    250,   0 Feb  8 11:40 dax0.0
crw-rw--w- 1 root root    250,   1 Feb  8 11:40 dax1.0
linux:~/test # runuser -l nuser -c "pmempool info /home/nuser/pool.set"
error: parsing poolset file failed
/home/nuser/pool.set: Invalid argument

As you can see, depending on part's access rights, you get different return messages from pmempool info:

  • "Permission denied" if the part is read-only for "nuser" and
  • "Invalid argument" if it is write-only.

Found on: pmempool 1.3+b2-919-gaac995ff0

@krzycz krzycz added this to the 1.4 milestone Feb 23, 2018
@krzycz krzycz self-assigned this Feb 23, 2018
krzycz added a commit to krzycz/pmdk that referenced this issue Feb 26, 2018
In some cases, pmempool used to report "Invalid argument" error,
while the actual problem was different, i.e. "Permission denied".

Ref: pmem/issues#815
krzycz added a commit to krzycz/pmdk that referenced this issue Feb 26, 2018
In some cases, pmempool used to report "Invalid argument" error,
while the actual problem was different, i.e. "Permission denied".

Ref: pmem/issues#815
krzycz added a commit to krzycz/pmdk that referenced this issue Feb 26, 2018
In some cases, pmempool used to report "Invalid argument" error,
while the actual problem was different, i.e. "Permission denied".

Ref: pmem/issues#815
krzycz added a commit to krzycz/pmdk that referenced this issue Feb 26, 2018
In some cases, pmempool used to report "Invalid argument" error,
while the actual problem was different, i.e. "Permission denied".

Ref: pmem/issues#815
krzycz added a commit to krzycz/pmdk that referenced this issue Feb 27, 2018
In some cases, pmempool used to report "Invalid argument" error,
while the actual problem was different, i.e. "Permission denied".

Ref: pmem/issues#815
@dsciebu
Copy link
Author

dsciebu commented Mar 2, 2018

After pulling the latest version I checked results of performing pmempool info in conditions described in issue and this is what I got:

linux:~/test # ll /dev | grep dax
crw-rw-rw- 1 root root    250,   0 Feb  8 11:40 dax0.0
crw-rw--w- 1 root root    250,   1 Feb  8 11:40 dax1.0
crw------- 1 root root    250,   3 Feb  8 11:40 dax2.0
crw------- 1 root root    250,   2 Feb  8 11:40 dax3.0
linux:~/test # runuser -l nuser -c "pmempool info /home/nuser/pool1.set"
error: parsing poolset file failed
error: /home/nuser/pool1.set: cannot determine type of pool
linux:~/test # chmod 664 /dev/dax1.0
linux:~/test # ll /dev | grep dax
crw-rw-rw- 1 root root    250,   0 Feb  8 11:40 dax0.0
crw-rw-r-- 1 root root    250,   1 Feb  8 11:40 dax1.0
crw------- 1 root root    250,   3 Feb  8 11:40 dax2.0
crw------- 1 root root    250,   2 Feb  8 11:40 dax3.0
linux:~/test # runuser -l nuser -c "pmempool info /home/nuser/pool1.set"
error: opening poolset failed
/home/nuser/pool1.set: Permission denied

Now the result is even stranger; instead of "Invalid argument" I got "cannot determine type of pool".

Checked on: pmempool 1.4-rc1-44-g82a8572f4

igchor pushed a commit to igchor/pmdk that referenced this issue Mar 5, 2018
In some cases, pmempool used to report "Invalid argument" error,
while the actual problem was different, i.e. "Permission denied".

Ref: pmem/issues#815
@krzycz krzycz modified the milestones: 1.4, 1.5 Mar 29, 2018
@igchor igchor self-assigned this Sep 14, 2018
igchor added a commit to igchor/pmdk that referenced this issue Sep 14, 2018
when run on dev dax with wrong access permissions.

Now, pmempool info prints "Permission denied" when
dev dax is either read only or write only.

Ref: pmem/issues#815
igchor added a commit to igchor/pmdk that referenced this issue Sep 14, 2018
when run on dev dax with wrong access permissions.

Now, pmempool info prints "Permission denied" when
dev dax is either read only or write only.

Ref: pmem/issues#815
igchor added a commit to igchor/pmdk that referenced this issue Sep 14, 2018
When os_open fails for reason other than ENOENT
we should set errno appropriately.

Ref: pmem/issues#815

Now, pmempool info prints "Permission denied" when
dev dax is either read only or write only.
igchor added a commit to igchor/pmdk that referenced this issue Sep 17, 2018
util_file_is_device_dax function missed proper error handling.
New util_file_get_type will check for errors and return -1 on failure
or one of the following values on success:
FILE_TYPE_DEVDAX, FILE_TYPE_NORMAL

Ref: pmem/issues#815

Now, pmempool info prints "Permission denied" when
dev dax is either read only or write only.
igchor added a commit to igchor/pmdk that referenced this issue Sep 18, 2018
util_file_is_device_dax function missed proper error handling.
New util_file_get_type will check for errors and return -1 on failure
or one of the following values on success:
FILE_TYPE_DEVDAX, FILE_TYPE_NORMAL

Ref: pmem/issues#815

Now, pmempool info prints "Permission denied" when
dev dax is either read only or write only.
igchor added a commit to igchor/pmdk that referenced this issue Sep 18, 2018
util_file_is_device_dax function missed proper error handling.
New util_file_get_type will check for errors and return -1 on failure
or one of the following values on success:
FILE_TYPE_DEVDAX, FILE_TYPE_NORMAL

Ref: pmem/issues#815

Now, pmempool info prints "Permission denied" when
dev dax is either read only or write only.
igchor added a commit to igchor/pmdk that referenced this issue Sep 18, 2018
util_file_is_device_dax function missed proper error handling.
New util_file_get_type will check for errors and return -1 on failure
or one of the following values on success:
FILE_TYPE_DEVDAX, FILE_TYPE_NORMAL

Ref: pmem/issues#815

Now, pmempool info prints "Permission denied" when
dev dax is either read only or write only.
igchor added a commit to igchor/pmdk that referenced this issue Sep 21, 2018
util_file_is_device_dax function missed proper error handling.
New util_file_get_type will check for errors and return either
OTHER_ERROR or NOT_EXISTS or one of the following values on success:
TYPE_DEVDAX, TYPE_NORMAL

Ref: pmem/issues#815

Now, pmempool info prints "Permission denied" when
dev dax is either read only or write only.
igchor added a commit to igchor/pmdk that referenced this issue Sep 21, 2018
util_file_is_device_dax function missed proper error handling.
New util_file_get_type will check for errors and return either
OTHER_ERROR or NOT_EXISTS or one of the following values on success:
TYPE_DEVDAX, TYPE_NORMAL

Ref: pmem/issues#815

Now, pmempool info prints "Permission denied" when
dev dax is either read only or write only.
igchor added a commit to igchor/pmdk that referenced this issue Sep 21, 2018
util_file_is_device_dax function missed proper error handling.
New util_file_get_type will check for errors and return either
OTHER_ERROR or NOT_EXISTS or one of the following values on success:
TYPE_DEVDAX, TYPE_NORMAL

Ref: pmem/issues#815

Now, pmempool info prints "Permission denied" when
dev dax is either read only or write only.
igchor added a commit to igchor/pmdk that referenced this issue Sep 21, 2018
util_file_is_device_dax function missed proper error handling.
New util_file_get_type will check for errors and return either
OTHER_ERROR or NOT_EXISTS or one of the following values on success:
TYPE_DEVDAX, TYPE_NORMAL

Ref: pmem/issues#815

Now, pmempool info prints "Permission denied" when
dev dax is either read only or write only.
igchor added a commit to igchor/pmdk that referenced this issue Sep 24, 2018
util_file_is_device_dax function missed proper error handling.
New util_file_get_type will check for errors and return either
OTHER_ERROR or NOT_EXISTS or one of the following values on success:
TYPE_DEVDAX, TYPE_NORMAL

Ref: pmem/issues#815

Now, pmempool info prints "Permission denied" when
dev dax is either read only or write only.
@kkajrewicz
Copy link

Verified on 1.4-rc4-1020-gde2c9dc7a

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants