xfs
[Top] [All Lists]

inode/vnode/xfs_inode locking

To: linux-xfs@xxxxxxxxxxx
Subject: inode/vnode/xfs_inode locking
From: Daniel Moore <dxm@xxxxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 09 Aug 2000 14:20:27 +1000
Sender: owner-linux-xfs-announce@xxxxxxxxxxx
I'm a bit puzzled about what locking needs to be done when
handling inodes, vnodes and xfs_inodes.

struct vnode (vnode_t) is a hangover from IRIX, right? And
the both it and the xfs_inode_t are stored in the linux
struct inode, right?

As far as I can see, if I want to access stuff within an
inode, a vnode or an xfs_inode, I must hold the inode lock
(use iget, iput, igrab).

Is that the case?


Here's an example (my new code in xfs_ioctl.c simplified for the
example):


                struct nameidata        nd;

                path_init(path, 0, &nd);
                path_walk(path, &nd);
                vp = LINVFS_GET_VP(nd.dentry->d_inode);
                path_release(&nd);

The inode in question is held by the dentry in nd, so it's
ok to extract the vnode pointer with LINVFS_GET_VP. But when
I release the nameidata structure, the dentry is freed, and
therefore I'm expecting vp is unlocked.

Is there any way to grab the inode before calling path_release
or do I just have to defer doing the path_release until after
I'm done with the inode, xfs_inode & vnode?

I've got almost exactly the same problem when I use fget to
return a file from a fd and I want to hold onto the associated
inode, vnode etc.

Any clarification would be most welcome...

Ta
-----------------------------------------------------
 Daniel Moore                  dxm@xxxxxxx
 R&D Software Engineer         Phone: +61-3-98348209
 SGI Performance Tools Group   Fax:   +61-3-98132378
-----------------------------------------------------


<Prev in Thread] Current Thread [Next in Thread>