Whamcloud - gitweb
LU-8066 obdclass: don't copy ops structures in to new type. 87/35687/8
authorNeilBrown <neilb@suse.com>
Fri, 11 Oct 2019 01:26:06 +0000 (21:26 -0400)
committerOleg Drokin <green@whamcloud.com>
Fri, 20 Dec 2019 03:26:18 +0000 (03:26 +0000)
commitacd639bf0de0c39419dff94fd6d338283a1ddb24
treeda5aca095317eb3902a3499db6b1f0cd69b39194
parent0f3bec02fc5da0c5bb61eda482b5c954a00bf6bd
LU-8066 obdclass: don't copy ops structures in to new type.

The obd_ops and md_ops structures passed to class_register_type() are
read-only, and have a lifetime that is exceeds the lifetime of the
obd_type - they are static in a module which unregisters the type before
being unloaded.

So there is no need to copy the ops, just store a pointer.

Also mark all the structures as read-only to confirm they don't get
written. This is best-practice for structures of function pointers.

Linux-commit: 2233f57f1b95b9a85a3129ddcc2860ddbc4c2a94

Signed-off-by: NeilBrown <neilb@suse.com>
Change-Id: Id0be1477925e0c878e3edb6a9d892f3c89a8b19b
Reviewed-on: https://review.whamcloud.com/35687
Reviewed-by: Neil Brown <neilb@suse.de>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Yang Sheng <ys@whamcloud.com>
Reviewed-by: Shaun Tancheff <stancheff@cray.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
27 files changed:
lustre/include/lustre_dlm.h
lustre/include/obd.h
lustre/include/obd_class.h
lustre/lmv/lmv_obd.c
lustre/lod/lod_dev.c
lustre/lov/lov_obd.c
lustre/mdc/mdc_request.c
lustre/mdd/mdd_device.c
lustre/mdt/mdt_handler.c
lustre/mdt/mdt_mds.c
lustre/mgc/mgc_request.c
lustre/mgs/mgs_handler.c
lustre/obdclass/genops.c
lustre/obdclass/llog_test.c
lustre/obdecho/echo.c
lustre/obdecho/echo_client.c
lustre/obdecho/echo_internal.h
lustre/ofd/ofd_internal.h
lustre/ofd/ofd_obd.c
lustre/osc/osc_request.c
lustre/osd-ldiskfs/osd_handler.c
lustre/osd-zfs/osd_handler.c
lustre/osp/lwp_dev.c
lustre/osp/osp_dev.c
lustre/osp/osp_internal.h
lustre/ost/ost_handler.c
lustre/quota/qmt_dev.c