dt_write_lock() is called for both the child and the parent dt_objects
when a directory is created. This triggers a false positive in
lockdep when running with CONFIG_LOCKDEP=y, as the structure
containing the lock and the name of the lock is the same, and so it
appears to be a recursive lock attempt based on lock class.
This gives the two locks different subclasses so lockdep can
differentiate between them.
Also, osd-zfs osd_object_{read,write}_lock() functions currently
ignore the subclass (role) provided by the caller, calling down_read()
instead of down_read_nested() for example.
Make osd_zfs use the _nested variants so the role takes effect.
Signed-off-by: Olaf Faaland <faaland1@llnl.gov>
Change-Id: Iab79feadfbd7d1a5a06749ecb9f6888b55a78d73
Reviewed-on: http://review.whamcloud.com/16957
Tested-by: Jenkins
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
if (rc)
GOTO(trans_stop, rc);
- dt_write_lock(env, dto, 0);
+ dt_write_lock(env, dto, LOS_CHILD);
if (dt_object_exists(dto))
GOTO(unlock, rc = 0);
rec->rec_fid = fid;
rec->rec_type = dto->do_lu.lo_header->loh_attr;
- dt_write_lock(env, parent, 0);
+ dt_write_lock(env, parent, LOS_PARENT);
rc = dt_insert(env, parent, (const struct dt_rec *)rec,
(const struct dt_key *)name, th, 1);
if (dti->dti_dof.dof_type == DFT_DIR)
#define LOS_MAGIC 0xdecafbee
+/**
+ * Used in __local_file_create() for object lock role
+ **/
+enum los_object_role {
+ LOS_PARENT,
+ LOS_CHILD,
+};
+
#endif
LASSERT(osd_invariant(obj));
- down_read(&obj->oo_sem);
+ down_read_nested(&obj->oo_sem, role);
}
static void osd_object_write_lock(const struct lu_env *env,
LASSERT(osd_invariant(obj));
- down_write(&obj->oo_sem);
+ down_write_nested(&obj->oo_sem, role);
}
static void osd_object_read_unlock(const struct lu_env *env,