Kouhei Sutou
null+****@clear*****
Wed Jun 5 18:39:05 JST 2013
Kouhei Sutou 2013-06-05 18:39:05 +0900 (Wed, 05 Jun 2013) New Revision: 1f1a77402e22a75ca74d488694cd584ac8566dc6 https://github.com/groonga/groonga/commit/1f1a77402e22a75ca74d488694cd584ac8566dc6 Message: Add missing lock for table creation It may fix a crash bug of mroonga: https://gist.github.com/y-ken/9a5d564d37a58e810abe Reported by Y.Kentaro. Thanks!!! Modified files: lib/db.c Modified: lib/db.c (+7 -0) =================================================================== --- lib/db.c 2013-06-05 18:37:26 +0900 (328cd9b) +++ lib/db.c 2013-06-05 18:39:05 +0900 (1b07e1a) @@ -870,6 +870,10 @@ grn_table_create(grn_ctx *ctx, const char *name, unsigned int name_size, } calc_rec_size(flags, &max_n_subrecs, &subrec_size, &subrec_offset, &key_size, &value_size); + { + grn_io *db_io; + db_io = grn_obj_io(db); + if (!grn_io_lock(ctx, db_io, 10000000)) { switch (flags & GRN_OBJ_TABLE_TYPE_MASK) { case GRN_OBJ_TABLE_HASH_KEY : res = (grn_obj *)grn_hash_create(ctx, path, key_size, value_size, flags); @@ -885,6 +889,9 @@ grn_table_create(grn_ctx *ctx, const char *name, unsigned int name_size, res = (grn_obj *)grn_array_create(ctx, path, value_size, flags); break; } + grn_io_unlock(db_io); + } + } if (res) { DB_OBJ(res)->header.impl_flags = 0; DB_OBJ(res)->header.domain = domain; -------------- next part -------------- HTML����������������������������...Download