lustre-devel-lustre.org archive mirror
 help / color / mirror / Atom feed
From: Andreas Dilger <adilger@whamcloud.com>
To: Sudheendra Sampath <sudheendra.sampath@gmail.com>
Cc: "lustre-devel@lists.lustre.org" <lustre-devel@lists.lustre.org>
Subject: Re: [lustre-devel] mdc_resource_inode_free()
Date: Thu, 31 Dec 2020 00:52:21 +0000	[thread overview]
Message-ID: <5481DEA0-3A35-44AC-81E4-F8684A3AF588@whamcloud.com> (raw)
In-Reply-To: <CABnqofyiOSkBVO4q1BfpMtN0AR3EO2gEsHruYdwYe+csEQShzw@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 1256 bytes --]

On Dec 22, 2020, at 13:25, Sudheendra Sampath <sudheendra.sampath@gmail.com<mailto:sudheendra.sampath@gmail.com>> wrote:

Hi,

I was trying to understand more about LDLM, specifically Lock Value Block (LVB's) and stumbled upon the following code block :

static int mdc_resource_inode_free(struct ldlm_resource *res)
{
        if (res->lr_lvb_inode)
                res->lr_lvb_inode = NULL;

        return 0;
}

Shouldn't the pointer (lr_lvb_inode) be freed before assigning it to NULL ?

Just curious to know.

The "lr_lvb_inode" pointer is a pointer to the VFS inode that is referencing a lock/resource:

int mdc_set_lock_data(struct obd_export *exp, const struct lustre_handle *lockh,
                      void *data, __u64 *bits)
{
        struct inode *new_inode = data;
        :
        lock->l_resource->lr_lvb_inode = new_inode;
}

The inode is allocated/freed separately by the VFS.  The lr_lvb_inode pointer is used to quickly find the VFS inode from a DLM resource, but does not take a reference on the inode itself.  Otherwise, the inode would always have an elevated reference count and would never be freed by the VFS.

Cheers, Andreas
--
Andreas Dilger
Principal Lustre Architect
Whamcloud







[-- Attachment #1.2: Type: text/html, Size: 4478 bytes --]

[-- Attachment #2: Type: text/plain, Size: 165 bytes --]

_______________________________________________
lustre-devel mailing list
lustre-devel@lists.lustre.org
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org

      reply	other threads:[~2020-12-31  0:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-22 20:25 Sudheendra Sampath
2020-12-31  0:52 ` Andreas Dilger [this message]

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=5481DEA0-3A35-44AC-81E4-F8684A3AF588@whamcloud.com \
    --to=adilger@whamcloud.com \
    --cc=lustre-devel@lists.lustre.org \
    --cc=sudheendra.sampath@gmail.com \
    --subject='Re: [lustre-devel] mdc_resource_inode_free()' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).