Skip to contentSkip to conversation

Change path of file lock in spdk_pci_device_claim

SPDK swf504 at 163.com 2 participants 3 messages Nov 11, 2020 – Nov 12, 2020

lore
Share & tools
lore

swf504 at 163.com

#0 lore raw

Hi SPDK team,
I notice that the posix lock file locate in '/tmp' directory which no safe in running linux system,
user maybe delete files in /tmp directory or remout the tmpfs, and that cause the posix lock inactive. This is a serious fatal because the application can't detect the file change, After a new application start and the spdk_pci_device_claim function still return true, that means multi application maybe probe same controller, Unexpect behavior or controller init hung maybe happen during controller colliding.

Is there special reason the need locate in '/tmp', if not, I suggest locate in '/var/run' directory. Need your comment!

Br,
Weifeng Su

#1 lore raw

Hi Weifeng,

There's no special reason to locate these files in /tmp. /var/run or /var/tmp would be fine. We already put the JSON-RPC domain socket in /var/tmp, so moving it there would make it more consistent.

Note that the lock files have same ownership as the SPDK process. If someone has privileges to delete the lock file or remount tmpfs, there are many other things they could do to affect the running SPDK process. They could even delete the lock file from the new location.

-Jim

On 11/11/20, 1:43 AM, "swf504(a)163.com" <swf504(a)163.com> wrote:

Hi SPDK team,
I notice that the posix lock file locate in '/tmp' directory which no safe in running linux system,
user maybe delete files in /tmp directory or remout the tmpfs, and that cause the posix lock inactive. This is a serious fatal because the application can't detect the file change, After a new application start and the spdk_pci_device_claim function still return true, that means multi application maybe probe same controller, Unexpect behavior or controller init hung maybe happen during controller colliding.

Is there special reason the need locate in '/tmp', if not, I suggest locate in '/var/run' directory. Need your comment!

Br,
Weifeng Su
_______________________________________________
SPDK mailing list -- spdk(a)lists.01.org
To unsubscribe send an email to spdk-leave(a)lists.01.org

#2 lore raw

Hi Jim,

Thanks for your comment!
I wonder can we call file system interface like 'chattr +i' after lock the lock file, That prevent user delete the file in ext4 file system.

BR,
Weifeng Su