Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 394195 - Portage will not work if underlying fs doesnt support proper locks
Summary: Portage will not work if underlying fs doesnt support proper locks
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks: 381649
  Show dependency tree
 
Reported: 2011-12-09 22:06 UTC by Alexey Shvetsov
Modified: 2011-12-14 23:30 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexey Shvetsov archtester gentoo-dev 2011-12-09 22:06:30 UTC
this is attempt to install prefix portage on cluster with $HOME on lustre2.0

emergelog(): [Errno 38] Function not implemented
emergelog(): [Errno 38] Function not implemented

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild  N     ] sys-apps/sed-4.2.1-r1  USE="-acl -nls (-selinux) -static" 879 kB

Total: 1 package (1 new), Size of downloads: 879 kB

Would you like to merge these packages? [Yes/No] 

>>> Verifying ebuild manifests

>>> Emerging (1 of 1) sys-apps/sed-4.2.1-r1
emergelog(): [Errno 38] Function not implemented
Traceback (most recent call last):
  File "/s/ls2/home/users/alexxy/prefix/usr/bin/emerge", line 44, in <module>
    retval = emerge_main()
  File "/s/ls2/home/users/alexxy/prefix/usr/lib/portage/pym/_emerge/main.py", line 2003, in emerge_main
    myopts, myaction, myfiles, spinner)
  File "/s/ls2/home/users/alexxy/prefix/usr/lib/portage/pym/_emerge/actions.py", line 438, in action_build
    retval = mergetask.merge()
  File "/s/ls2/home/users/alexxy/prefix/usr/lib/portage/pym/_emerge/Scheduler.py", line 1079, in merge
    rval = self._merge()
  File "/s/ls2/home/users/alexxy/prefix/usr/lib/portage/pym/_emerge/Scheduler.py", line 1433, in _merge
    self._main_loop()
  File "/s/ls2/home/users/alexxy/prefix/usr/lib/portage/pym/_emerge/Scheduler.py", line 1576, in _main_loop
    while self._schedule():
  File "/s/ls2/home/users/alexxy/prefix/usr/lib/portage/pym/_emerge/PollScheduler.py", line 104, in _schedule
    return self._schedule_tasks()
  File "/s/ls2/home/users/alexxy/prefix/usr/lib/portage/pym/_emerge/Scheduler.py", line 1615, in _schedule_tasks
    if q.schedule():
  File "/s/ls2/home/users/alexxy/prefix/usr/lib/portage/pym/_emerge/SequentialTaskQueue.py", line 55, in schedule
    task.start()
  File "/s/ls2/home/users/alexxy/prefix/usr/lib/portage/pym/_emerge/AsynchronousTask.py", line 24, in start
    self._start()
  File "/s/ls2/home/users/alexxy/prefix/usr/lib/portage/pym/_emerge/MergeListItem.py", line 91, in _start
    self._start_task(build, self._default_final_exit)
  File "/s/ls2/home/users/alexxy/prefix/usr/lib/portage/pym/_emerge/CompositeTask.py", line 146, in _start_task
    task.start()
  File "/s/ls2/home/users/alexxy/prefix/usr/lib/portage/pym/_emerge/AsynchronousTask.py", line 24, in start
    self._start()
  File "/s/ls2/home/users/alexxy/prefix/usr/lib/portage/pym/_emerge/EbuildBuild.py", line 89, in _start
    self._prefetch_exit(prefetcher)
  File "/s/ls2/home/users/alexxy/prefix/usr/lib/portage/pym/_emerge/EbuildBuild.py", line 140, in _prefetch_exit
    self._build_dir.lock()
  File "/s/ls2/home/users/alexxy/prefix/usr/lib/portage/pym/_emerge/EbuildBuildDir.py", line 45, in lock
    catdir_lock.start()
  File "/s/ls2/home/users/alexxy/prefix/usr/lib/portage/pym/_emerge/AsynchronousTask.py", line 24, in start
    self._start()
  File "/s/ls2/home/users/alexxy/prefix/usr/lib/portage/pym/_emerge/AsynchronousLock.py", line 47, in _start
    wantnewlockfile=True, flags=os.O_NONBLOCK)
  File "/s/ls2/home/users/alexxy/prefix/usr/lib/portage/pym/portage/locks.py", line 115, in lockfile
    locking_method(myfd, fcntl.LOCK_EX|fcntl.LOCK_NB)
IOError: [Errno 38] Function not implemented
emergelog(): [Errno 38] Function not implemented
Comment 1 Zac Medico gentoo-dev 2011-12-09 22:10:34 UTC
(In reply to comment #0)
> line 47, in _start
>     wantnewlockfile=True, flags=os.O_NONBLOCK)
>   File "/s/ls2/home/users/alexxy/prefix/usr/lib/portage/pym/portage/locks.py",
> line 115, in lockfile
>     locking_method(myfd, fcntl.LOCK_EX|fcntl.LOCK_NB)
> IOError: [Errno 38] Function not implemented

If then happens after applying this patch:

--- a/pym/portage/locks.py
+++ b/pym/portage/locks.py
@@ -148,7 +148,7 @@ def lockfile(mypath, wantnewlockfile=0, unlinkfile=0,
                                raise
                        if out is not None:
                                out.eend(os.EX_OK)
-               elif e.errno == errno.ENOLCK:
+               elif e.errno in (errno.ENOLCK, errno.ENOSYS):
                        # We're not allowed to lock on this FS.
                        os.close(myfd)
                        link_success = False

Then it means that hardlink_lockfile() is failing. That function doesn't get much testing, since most filesystems support real locking. I plan to make some tests for the hardlink_lockfile() case and see if I can make it work better.
Comment 2 Alexey Shvetsov archtester gentoo-dev 2011-12-09 22:14:56 UTC
With this patch it failed on install phase


>>> Installing (1 of 1) sys-apps/sed-4.2.1-r1
emergelog(): [Errno 9] Bad file descriptor
 * checking 13 files for package collisions
>>> Merging sys-apps/sed-4.2.1-r1 to /
Traceback (most recent call last):
  File "/s/ls2/home/users/alexxy/prefix/usr/lib/portage/pym/portage/dbapi/_MergeProcess.py", line 246, in _spawn
    prev_mtimes=self.prev_mtimes, counter=counter)
  File "/s/ls2/home/users/alexxy/prefix/usr/lib/portage/pym/portage/dbapi/vartree.py", line 4305, in merge
    counter=counter)
  File "/s/ls2/home/users/alexxy/prefix/usr/lib/portage/pym/portage/dbapi/vartree.py", line 3600, in treewalk
    self.vartree.dbapi._fs_lock()
  File "/s/ls2/home/users/alexxy/prefix/usr/lib/portage/pym/portage/dbapi/vartree.py", line 243, in _fs_lock
    self._fs_lock_obj = lockfile(self._conf_mem_file)
  File "/s/ls2/home/users/alexxy/prefix/usr/lib/portage/pym/portage/locks.py", line 115, in lockfile
    locking_method(myfd, fcntl.LOCK_EX|fcntl.LOCK_NB)
IOError: [Errno 38] Function not implemented

>>> Failed to install sys-apps/sed-4.2.1-r1, Log file:
Comment 3 Zac Medico gentoo-dev 2011-12-12 19:13:15 UTC
Looking at the hardlink_lockfile() code, it's obvious that it's broken for at least the following reasons:

  1) It lacks support for non-blocking locks
  2) It doesn't support the lockfile(wantnewlockfile=False) behavior

I'll go ahead and implement support for these, along with test cases.
Comment 6 Alexey Shvetsov archtester gentoo-dev 2011-12-14 15:11:19 UTC
Seems your patches works for me =) lustre still mounted without flock.
Comment 7 Zac Medico gentoo-dev 2011-12-14 23:30:29 UTC
This is fixed in 2.1.10.41 and 2.2.0_alpha81.