Re: OSTree locking fails sometimes



On Mon, Jan 14, 2019, at 12:16 PM, Stefan Agner wrote:
Hello,

[Hi, sorry about not replying earlier]

And get this every now and then:
"error: Locking repo exclusive failed: Resource temporarily unavailable"

Hmm.  So this boils down to do_repo_lock() which calls:

res = TEMP_FAILURE_RETRY (fcntl (fd, (flags & LOCK_NB) ? F_OFD_SETLK : F_OFD_SETLKW, &fl));

"Resource temporarily unavailable" maps to EAGAIN.

And this is NFS so as I understand it new fnctl locks don't work and we're falling back to flock().

One thing I also notice here is systemd's lockfile code canonicalizes
EAGAIN to EBUSY:

https://github.com/systemd/systemd/commit/cd2eb9e942#diff-3f132e31fd2d56e6f0692cfeec28b1f9R73

Which ironically I didn't copy over into glnx-lockfile.c. 

Now higher level code here is trying to check G_IO_ERROR_WOULD_BLOCK and glib does:

    /* EWOULDBLOCK == EAGAIN on most systems, but POSIX considers them distinct */
#if defined (EAGAIN) && (!defined (EWOULDBLOCK) || (EWOULDBLOCK != EAGAIN))
    case EAGAIN:
      return G_IO_ERROR_WOULD_BLOCK;
      break;
#endif


So...I am feeling though we're still missing some sort of EAGAIN canonicalization.

Can you file a bug for this? 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]