rpc: use rw access when creating RPC lock file

It allows the users to specify the path to the RPC socket on a NFS
mounted filesystem.  This is necessary, because flock(2) on NFS requires
write access to place an exclusive lock.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: If197498ed5bdcb4e02c5f2f2b2c1ef388872c457
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14993
Reviewed-by: Jacek Kalwas <jacek.kalwas@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
This commit is contained in:
Konrad Sztyber 2022-10-14 16:06:22 +02:00 committed by Tomasz Zawadzki
parent f20b99bbb3
commit 1f3a6b0398

View File

@ -144,7 +144,7 @@ spdk_rpc_listen(const char *listen_addr)
return -1; return -1;
} }
g_rpc_lock_fd = open(g_rpc_lock_path, O_RDONLY | O_CREAT, 0600); g_rpc_lock_fd = open(g_rpc_lock_path, O_RDWR | O_CREAT, 0600);
if (g_rpc_lock_fd == -1) { if (g_rpc_lock_fd == -1) {
SPDK_ERRLOG("Cannot open lock file %s: %s\n", SPDK_ERRLOG("Cannot open lock file %s: %s\n",
g_rpc_lock_path, spdk_strerror(errno)); g_rpc_lock_path, spdk_strerror(errno));