Re: [PATCH] lockfile.c: schedule remove_lock_file only once.

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

 



Sven Verdoolaege <skimo@xxxxxxxxxx> writes:

> Removing a lockfile once should be enough.

Yeah.  I wonder what we were smoking.  415e96c8 which introduces
the atexit to index.c does:

    int hold_index_file_for_update(struct cache_file *cf, const char *path)
    {
           sprintf(cf->lockfile, "%s.lock", path);
           cf->next = cache_file_list;
           cache_file_list = cf;
           if (!cf->next) {
                   signal(SIGINT, remove_lock_file_on_signal);
                   atexit(remove_lock_file);
           }
           return open(cf->lockfile, O_RDWR | O_CREAT | O_EXCL, 0600);
    }

whose intent is exactly "do this once, only for the first one".

The reason we do not use lk->next but instead check lk->on_list,
and the reason why we do not remove the lock from the list, are
described in 1084b845.

But your "fire atexit() once" fix is needed.  Thanks.

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux