Configuration Locked

Gustavo Niemeyer gustavo at niemeyer.net
Mon Feb 6 15:35:41 PST 2006


Hey Eric,

> >Smart uses fcntl locking, which means that the only way to achieve
> >a locked Smart is with a running process. You don't have to remove
> >any lock files, just kill the process and you're done. If it's still
> >locked, look closer, there's still a running process.
>
> Then what does this code do?
> 
> class SysConfig(object):
> 
>    def __init__(self, root=()):
>        self._readonly = False
> 
>    def getReadOnly(self):
>        return self._readonly
> 
>    def setReadOnly(self, flag):
>        self._readonly = flag
> 
>    def assertWritable(self):
>        if self._readonly:
>            raise Error, _("Configuration is in readonly mode.")
> 
> After killing a hung smart session I had to write a script to open the 
> config, change it back to False and write it back out before I could use 
> smart without the --ignorelocks option.  And that was after a reboot, so 
> I don't think there were other processes still running.

As you're probably aware about, this is a method call, not a
configuration option.  It doesn't make any sense to say "open the
config, change it back to False and write it back out" in that
context.

If you want to understand the implementation, you should check where
the setReadOnly method is being used. If you do that, you'll figure
out that there's only one call to that method in the whole code base,
and that is after a self._pathlocks.lock call, which does the fcntl
locking.

Yes, I was telling the truth after all. Now, can you please explain
what have you changed in the config file with your script to make
it work?

-- 
Gustavo Niemeyer
http://niemeyer.net



More information about the Smart mailing list