Unverified Commit 27f39efa by Stéphane Graber Committed by GitHub

Merge pull request #2526 from brauner/2018-08-14/fix_ongoing_create_check

lxccontainer: fix F_OFD_GETLK checks
parents 375121e4 ec74f3f8
...@@ -164,7 +164,10 @@ static int ongoing_create(struct lxc_container *c) ...@@ -164,7 +164,10 @@ static int ongoing_create(struct lxc_container *c)
lk.l_type = F_WRLCK; lk.l_type = F_WRLCK;
lk.l_whence = SEEK_SET; lk.l_whence = SEEK_SET;
lk.l_pid = -1; /* F_OFD_GETLK requires that l_pid be set to 0 otherwise the kernel
* will EINVAL us.
*/
lk.l_pid = 0;
ret = fcntl(fd, F_OFD_GETLK, &lk); ret = fcntl(fd, F_OFD_GETLK, &lk);
if (ret < 0 && errno == EINVAL) if (ret < 0 && errno == EINVAL)
...@@ -172,8 +175,9 @@ static int ongoing_create(struct lxc_container *c) ...@@ -172,8 +175,9 @@ static int ongoing_create(struct lxc_container *c)
close(fd); close(fd);
if (ret == 0 && lk.l_pid != -1) /* F_OFD_GETLK will not send us back a pid so don't check it. */
/* create is still ongoing */ if (ret == 0)
/* Create is still ongoing. */
return 1; return 1;
/* Create completed but partial is still there. */ /* Create completed but partial is still there. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment