[Omake] Re: [CUCS Bug 555] Should we use "sloppy" NFS-safe locking
in addition to lockf?
Jason Hickey
jyh at cs.caltech.edu
Wed Mar 15 17:27:48 PST 2006
Looks good to me,
Jason
Aleksey Nogin wrote:
> Jason,
>
> I am thinking about making the db_file field in the Omake_env.Static.t
> type (the field that would normally contain an fd for the .omc) into an
> option - so that if for some reason (such as a non-working lockf or an
> ro $HOME) we've failed to create the .omc, we can still continue, but
> without any caching. A partial patch is attached.
>
> What do you think?
>
> On 15.03.2006 15:59, Bugzilla - Please Use the Web to Reply wrote:
>
>> Reply at: http://cvs.cs.cornell.edu:12000/bugzilla/show_bug.cgi?id=555
>
>
>> ------- Additional Comments From daniel at peng.dyndns.org 2006-03-15
>> 18:59 Eastern -------
>> I think the problem is more serious than you suggest. I can't use
>> Omake _at
>> all_ because my home directory is mounted over NFS, and locking
>> fails. omake
>> gives this totally opaque error when I try to omake metaprl:
>>
>> *** omake error:
>> File Omake_builtin: line 0, characters 0-0
>> can't open object: /usr/lib/omake/Pervasives.om
>>
>> strace reveals what's going on:
>>
>> open("/home/dpeng/.omake/cache/usr/lib/omake/Pervasives.omc",
>> O_RDWR|O_CREAT|O_LARGEFILE, 0666) = 4
>> fcntl64(4, F_SETLKW64, {type=F_WRLCK, whence=SEEK_CUR, start=0,
>> len=1073741823},
>> 0xbffff22c) = -1 ENOLCK (No locks available)
>> write(2, "*** omake error:\n File Omake_b"..., 114*** omake error:
>> File Omake_builtin: line 0, characters 0-0
>> can't open object: /usr/lib/omake/Pervasives.om
>> ) = 114
>> exit_group(123) = ?
>>
>
>
>
> ------------------------------------------------------------------------
>
> Index: src/env/omake_env.ml
> ===================================================================
> --- src/env/omake_env.ml (revision 8889)
> +++ src/env/omake_env.ml (working copy)
> @@ -1025,7 +1025,7 @@
> * A .omc file.
> *)
> type t =
> - { db_file : Unix.file_descr;
> + { db_file : Unix.file_descr option;
> db_name : Node.t;
> db_digest : string;
> db_env : venv;
> @@ -1075,14 +1075,20 @@
> name
> in
> let name = name ^ ".omc" in
> - let target_name, target_fd =
> - try Omake_state.lock_cache_file dir name with
> + let target_fd =
> + try
> + let target_name, target_fd =
> + Omake_state.lock_cache_file dir name
> + in
> + if !debug_db then
> + eprintf "@[<v 3>Omake_db.create:@ %a --> %s@]@." pp_print_node source target_name;
> + Some target_fd
> + with
> Unix.Unix_error _
> | Failure _ ->
> - raise Not_found
> + eprintf "@[<v 3>OMake warning: could not create and/or lock a cache file for@ %s@]@." source_name;
> + None
> in
> - if !debug_db then
> - eprintf "@[<v 3>Omake_db.create:@ %a --> %s@]@." pp_print_node source target_name;
> { db_file = target_fd;
> db_name = source;
> db_digest = digest;
> @@ -1094,25 +1100,26 @@
> (*
> * Close the file.
> *)
> - let close info =
> - if !debug_db then
> - eprintf "Omake_db.close: %a at ." pp_print_node info.db_name;
> - Unix.close info.db_file
> + let close = function
> + { db_file = Some fd } ->
> + if !debug_db then
> + eprintf "Omake_db.close: %a at ." pp_print_node info.db_name;
> + Unix.close fd
> + | { db_file = None } ->
> + ()
>
> (*
> * Add the three kinds of entries.
> *)
> let add_ir info ir =
> - let { db_file = fd;
> - db_name = name;
> - db_digest = digest;
> - db_env = venv
> - } = info
> - in
> - if !debug_db then
> - eprintf "Omake_db.add_ir: %a at ." pp_print_node name;
> - venv_marshal venv (fun () ->
> - Lm_db.add fd (Node.absname name) ir_tag Omake_magic.ir_magic digest ir) ()
> + match info with
> + { db_file = Some fd; db_name = name; db_digest = digest; db_env = venv } ->
> + if !debug_db then
> + eprintf "Omake_db.add_ir: %a at ." pp_print_node name;
> + venv_marshal venv (fun () ->
> + Lm_db.add fd (Node.absname name) ir_tag Omake_magic.ir_magic digest ir) ()
> + | { db_file = None } ->
> + ()
>
> let add_object info obj =
> let { db_file = fd;
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> OMake-Devel mailing list
> OMake-Devel at metaprl.org
> https://lists.metaprl.org/mailman/listinfo/omake-devel
--
Jason Hickey http://www.cs.caltech.edu/~jyh
Caltech Computer Science Tel: 626-395-6568 FAX: 626-792-4257
More information about the OMake-Devel
mailing list