From: Timothy Shimmin <tes@sgi.com>
To: Dave Chinner <david@fromorbit.com>,
"xfs@oss.sgi.com" <xfs@oss.sgi.com>, xfs-dev <xfs-dev@sgi.com>
Subject: Re: Adding attr, inode reference query
Date: Tue, 07 Oct 2008 12:23:02 +1100 [thread overview]
Message-ID: <48EAB9F6.4090102@sgi.com> (raw)
In-Reply-To: <20081007005409.GD12509@disturbed>
Dave Chinner wrote:
> On Tue, Oct 07, 2008 at 11:04:32AM +1100, Barry Naujok wrote:
>> I'm doing a bit of debugging with attr creation in xfs_repair which uses
>> libxfs which has it's own simple cache/ref counting/transaction mechanism
>> for inodes and buffers.
>>
>> I came across a refcounting issue when adding an extended attribute to an
>> inode, calling xfs_attr_set_int (indirectly in Phase 6):
>> - if there are no extended attributes, a attr fork area is created within
>> the inode (calling xfs_bmap_add_attrfork). After this call in libxfs,
>> the inode is derefenced.
>> - if extended attributes already exist, the inode isn't dereferenced
>> after calling xfs_attr_set_int.
>>
>> I seem to have traced this down to xfs_bmap_add_attrfork not calling
>> xfs_trans_ihold after calling xfs_trans_ijoin like other similar functions.
>> BUT, it does call IHOLD(ip).
>
> The difference between the two is kinda subtle. IHOLD() increments
> the reference count to ensure the transaction commit doesn't drop
> the last reference to the inode when it unlocks it and hence
> cause us to enter reclaim in the commit code.
>
> OTOH, xfs_trans_ihold() holds the inode across the transaction
> commit so that it is still locked when xfs_trans_commit() completes.
> This is needed for rolling transactions to be able to continue
> across duplication and commit without needing to relock inodes.
>
Oh okay.
Want a reference held in both cases, but don't always want it locked
after commit.
One way, we take an extra reference and then drop it at commit,
the other we just don't drop the reference at commit.
--Tim
next prev parent reply other threads:[~2008-10-07 1:21 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-07 0:04 Adding attr, inode reference query Barry Naujok
2008-10-07 0:45 ` Timothy Shimmin
2008-10-07 0:54 ` Dave Chinner
2008-10-07 1:23 ` Timothy Shimmin [this message]
2008-10-07 1:30 ` Timothy Shimmin
2008-10-07 1:51 ` Dave Chinner
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=48EAB9F6.4090102@sgi.com \
--to=tes@sgi.com \
--cc=david@fromorbit.com \
--cc=xfs-dev@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