All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andreas Dilger <adilger@whamcloud.com>
To: lustre-devel@lists.lustre.org
Subject: [lustre-devel] [PATCH v2 07/29] lustre: obd: collect all resource releasing for obj_type.
Date: Wed, 22 May 2019 22:07:43 +0000	[thread overview]
Message-ID: <4617C98C-31F0-4773-97F3-54B2BCAF1E7A@whamcloud.com> (raw)
In-Reply-To: <alpine.LFD.2.21.1905221918410.26312@casper.infradead.org>

On May 22, 2019, at 12:51, James Simmons <jsimmons@infradead.org> wrote:
> 
> 
>>> int class_register_type(struct obd_ops *dt_ops, struct md_ops *md_ops,
>>> @@ -181,10 +163,17 @@ int class_register_type(struct obd_ops *dt_ops, 
>> struct md_ops *md_ops,
>>> 		return -EEXIST;
>>> 	}
>>> 
>>> -	rc = -ENOMEM;
>>> 	type = kzalloc(sizeof(*type), GFP_NOFS);
>>> 	if (!type)
>>> -		return rc;
>>> +		return -ENOMEM;
>>> +
>>> +	type->typ_kobj.kset = lustre_kset;
>>> +	rc = kobject_init_and_add(&type->typ_kobj, &class_ktype,
>>> +				  &lustre_kset->kobj, "%s", name);
>> 
>> I don't know that I would actually cause a problem, but I don't like
>> "add"ing and object (above) before fully initializing it (below).  So
>> I've kept the split from my version where kobject_init() happens early
>> and kobject_add() happens later.
>> I've included the other changes that you made.
>> 
>> Thanks,
>> NeilBrown
> 
> The reason I did it that way was to handle the server case down the road.
> So for the case when both client and server are on the same node, and yes
> people do such setups for testing this is important.
> 
> Consider the case we have both the lov and lod layer on a single node. 
> Both layers attempt to create "lov" obd_type. When the lov module loads 
> first then a complete obd_type is created. Once lod loads then it just 
> uses real lov obd_type and creates the needed symlinks.

We've had the "lov->lod" symlinks on servers since Lustre 2.4 or so (when
osd-zfs was first added).  We could just remove this compatibility, so
long as the test scripts were updated to always use "lod" on the server
and "lov" on the client (previously they shared the same "lov" code module
so the path was the same).  We don't need test script interop going back
further than that, so this should be OK.

Cheers, Andreas

> You end up with
> 
> ls -al /sys/fs/lustre/lov/
> total 0
> drwxr-xr-x  2 root root 0 May 22 14:27 .
> drwxr-xr-x 14 root root 0 May 22 14:27 ..
> lrwxrwxrwx  1 root root 0 May 22 14:27 lustre-MDT0000-mdtlov -> 
> ../lod/lustre-MDT0000-mdtlov
> lrwxrwxrwx  1 root root 0 May 22 14:27 lustre-MDT0002-mdtlov -> 
> ../lod/lustre-MDT0002-mdtlov
> 
> Plus the real lov obd devices.
> 
> Now if lod loads first then the lod module creates a "lov" obd_type
> using class_create_symlink() but is not fully initialized nor does
> it need to be. If the client lov module is present and it loads then
> it takes the "lov" obd_type create by the lod and finishes initializing
> it.
> 
> Looking at the final code and added in server case:
> 
>        type = class_search_type(name);
>        if (type) {
>                kobject_put(&type->typ_kobj);
> 		if (strcmp(name, LUSTRE_LOV_NAME) == 0 ||
>                    strcmp(name, LUSTRE_OSC_NAME) == 0)
>                        goto dir_exist;
> 		CDEBUG(D_IOCTL, "Type %s already registered\n", name);
>                return -EEXIST;
>        }
> 
>        type = kzalloc(sizeof(*type), GFP_NOFS);
>        if (!type)
>                return rc;
> 
>        type->typ_kobj.kset = lustre_kset;
>        kobject_init(&type->typ_kobj, &class_ktype);
> 
>        type->typ_dt_ops = dt_ops;  /* lov obd_type is never set to the 
> 				     * correct values if lod created it.
> 				     */
>        type->typ_md_ops = md_ops;
> 
>        rc = kobject_add(&type->typ_kobj, &lustre_kset->kobj, "%s", name);
>        if (rc)
>                goto failed;
> 
>        type->typ_debugfs_entry = debugfs_create_dir(type->typ_name,
>                                                     debugfs_lustre_root);
> dir_exit:
> 
> Now if this needed for the later module handling patches I guess we could
> do:
> 
> 	if (strcmp(name, LUSTRE_LOV_NAME) == 0 ||
>            strcmp(name, LUSTRE_OSC_NAME) == 0) {
> 		type->typ_dt_ops = dt_ops;
> 		type->typ_md_ops = md_ops;
> 		goto dir_exist;
> 	}
> 
> Is that the case?
> 
> 

Cheers, Andreas
--
Andreas Dilger
Principal Lustre Architect
Whamcloud

  reply	other threads:[~2019-05-22 22:07 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-20 12:50 [lustre-devel] [PATCH v2 00/29] More lustre patches James Simmons
2019-05-20 12:50 ` [lustre-devel] [PATCH v2 01/29] lustre: llite: ll_fault fixes James Simmons
2019-05-22  3:54   ` NeilBrown
2019-05-22 12:48     ` Patrick Farrell
2019-05-22 23:26       ` NeilBrown
2019-05-23  0:13         ` Patrick Farrell
2019-05-22 19:06     ` James Simmons
2019-05-20 12:50 ` [lustre-devel] [PATCH v2 02/29] lustre: llite: fix error in vvp_pgcache seqfile James Simmons
2019-05-20 12:50 ` [lustre-devel] [PATCH v2 03/29] lustre: llite: replace lli_trunc_sem James Simmons
2019-05-20 12:50 ` [lustre-devel] [PATCH v2 04/29] lustre: lov: use GFP_NOFS to allocate lo_entries James Simmons
2019-05-20 12:50 ` [lustre-devel] [PATCH v2 05/29] lustre: llite: don't use class_setup_tunables() James Simmons
2019-05-22  4:22   ` NeilBrown
2019-05-22 18:58     ` James Simmons
2019-05-20 12:50 ` [lustre-devel] [PATCH v2 06/29] lustre: embed typ_kobj in obd_type James Simmons
2019-05-22  5:20   ` NeilBrown
2019-05-20 12:50 ` [lustre-devel] [PATCH v2 07/29] lustre: obd: collect all resource releasing for obj_type James Simmons
2019-05-22  6:49   ` NeilBrown
2019-05-22 18:51   ` James Simmons
2019-05-22 22:07     ` Andreas Dilger [this message]
2019-06-01  0:38       ` James Simmons
2019-05-20 12:50 ` [lustre-devel] [PATCH v2 08/29] lustre: obd_type: use typ_kobj.name as typ_name James Simmons
2019-05-20 12:50 ` [lustre-devel] [PATCH v2 09/29] lustre: obd_type: discard obd_types linked list James Simmons
2019-05-20 12:50 ` [lustre-devel] [PATCH v2 10/29] lustre: obd_type: discard obd_type_lock James Simmons
2019-05-22  6:53   ` NeilBrown
2019-05-22 19:24     ` James Simmons
2019-05-20 12:50 ` [lustre-devel] [PATCH v2 11/29] lustre: obdclass: don't copy ops structures in to new type James Simmons
2019-05-20 12:50 ` [lustre-devel] [PATCH v2 12/29] lustre: obdclass: fix module load locking James Simmons
2019-05-20 12:50 ` [lustre-devel] [PATCH v2 13/29] lustre: convert rsi_sem to a spinlock James Simmons
2019-05-20 12:50 ` [lustre-devel] [PATCH v2 14/29] lustre: ldlm: discard varname in ldlm_pool James Simmons
2019-05-20 12:50 ` [lustre-devel] [PATCH v2 15/29] lustre: lprocfs: use log2.h macros instead of shift loop James Simmons
2019-05-20 12:50 ` [lustre-devel] [PATCH v2 16/29] lustre: handles: discard h_owner in favour of h_ops James Simmons
2019-05-20 12:50 ` [lustre-devel] [PATCH v2 17/29] lustre: handle: move refcount into the lustre_handle James Simmons
2019-05-20 12:51 ` [lustre-devel] [PATCH v2 18/29] lustre: discard OBD_FREE_RCU James Simmons
2019-05-20 12:51 ` [lustre-devel] [PATCH v2 19/29] lustre: portals_handle: rename ops to owner James Simmons
2019-05-20 12:51 ` [lustre-devel] [PATCH v2 20/29] lustre: portals_handle: remove locking from class_handle2object() James Simmons
2019-05-20 12:51 ` [lustre-devel] [PATCH v2 21/29] lustre: portals_handle: use hlist for hash lists James Simmons
2019-05-20 12:51 ` [lustre-devel] [PATCH v2 22/29] lustre: portals_handle: discard h_lock James Simmons
2019-05-20 12:51 ` [lustre-devel] [PATCH v2 23/29] lustre: remove unused fields from struct obd_device James Simmons
2019-05-20 12:51 ` [lustre-devel] [PATCH v2 24/29] lustre: obd_sysfs: error-check value stored in jobid_var James Simmons
2019-05-20 12:51 ` [lustre-devel] [PATCH v2 25/29] lustre: obdclass: discard process_quota_config James Simmons
2019-05-20 12:51 ` [lustre-devel] [PATCH v2 26/29] lustre: obdclass: remove unnecessary code from lustre_init_lsi() James Simmons
2019-05-20 12:51 ` [lustre-devel] [PATCH 27/29] lustre: ldlm: discard l_lock from struct ldlm_lock James Simmons
2019-05-20 12:51 ` [lustre-devel] [PATCH v2 28/29] lustre: ldlm: don't access l_resource when not locked James Simmons
2019-05-20 12:51 ` [lustre-devel] [PATCH v2 29/29] lustre: ldlm: drop SLAB_TYPESAFE_BY_RCU from ldlm_lock slab James Simmons

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4617C98C-31F0-4773-97F3-54B2BCAF1E7A@whamcloud.com \
    --to=adilger@whamcloud.com \
    --cc=lustre-devel@lists.lustre.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.