From: Christoph Hellwig <hch@infradead.org>
To: Alex Elder <aelder@sgi.com>
Cc: Christoph Hellwig <hch@infradead.org>, xfs@oss.sgi.com
Subject: Re: [PATCH] xfs: simplify xfs_trans_iget
Date: Fri, 28 Aug 2009 15:42:43 -0400 [thread overview]
Message-ID: <20090828194243.GA6204@infradead.org> (raw)
In-Reply-To: <1AB9A794DBDDF54A8A81BE2296F7BDFE83ABE9@cf--amer001e--3.americas.sgi.com>
On Fri, Aug 28, 2009 at 12:02:06PM -0500, Alex Elder wrote:
> This function was only ever called as a helper by xfs_trans_iget().
> And it does the same things as xfs_iget() does, but in a more
> restricted context. One difference I see is that this verifies
> the transaction pointers match--and if they do not, it returns NULL.
>
> In xfs_iget(), meanwhile, there is no such check. I'm not familiar
> enough with the transaction code to know what circumstances that
> might lead a hashed inode without a matching transaction pointer,
> but thought I'd point it out anyway in hopes you maybe did...
I'm always happy about people actually looking deep into the code in
reviews.
Let's got through the above case in detail:
To have i_tansp set the inode must be locked. So assuming we have an
inode in a transaction that is not your. We will no go on to the
xfs_iget once the xfs_inode_incore is gone. But as part of xfs_iget
we will lock the inode exclusively, which means we have to wait
until the other transaction unlocks the inode. Also if this was
for some reason no true we would immediately hit the ASSERT in
xfs_trans_ijoin which chcks that the i_transp pointer is NULL.
> > xfs_inode_item_init(ip, ip->i_mount);
> > iip = ip->i_itemp;
> > ASSERT(iip->ili_flags == 0);
> > - ASSERT(iip->ili_ilock_recur == 0);
> > - ASSERT(iip->ili_iolock_recur == 0);
>
> These are the only other references, and (assuming we've done
> a lot of testing with ASSERT() enabled) it is evident that
> these are always zero at this point. In any case, what this
> means is that xfs_trans_ijoin() must never be called after
> xfs_trans_iget() has been called on a hashed inode. Again,
> I'm not familiar enough with how we manage transactions to
> to verify by inspection this is the case, but I presume it is.
I think this is where the above invariant that an inode in a transaction
must always be locked kicks in again.
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2009-08-28 19:42 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-26 20:47 [PATCH] xfs: simplify xfs_trans_iget Christoph Hellwig
2009-08-28 17:02 ` Alex Elder
2009-08-28 19:42 ` Christoph Hellwig [this message]
2009-08-28 21:58 ` Alex Elder
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=20090828194243.GA6204@infradead.org \
--to=hch@infradead.org \
--cc=aelder@sgi.com \
--cc=xfs@oss.sgi.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox