From: Mark Tinguely <tinguely@sgi.com>
To: XFS Mailing List <xfs@oss.sgi.com>
Subject: [RFC] libxfs: adding attribute fork frees xfs_inode ptr
Date: Wed, 23 Apr 2014 16:04:35 -0500 [thread overview]
Message-ID: <20140423210445.700477624@sgi.com> (raw)
In-Reply-To: 20140423210034.892939354@sgi.com
[-- Attachment #1: xfsprogs-fix-dp-release-when-adding-attr-fork.patch --]
[-- Type: text/plain, Size: 1373 bytes --]
User space does not currently perform any attribute adding/deleting,
but if we do want to fix attributes or use them for parent inode
pointers, user space should support attributes.
The adding an attribute fork is done in an embedded transaction
inside xfs_attr_set_int(). The xfs_trans_commit in xfs_bmap_add_attrfork()
will free the xfs_inode pointer causing xfs_attr_calc_size() in
xfs_attr_set_int() to fail.
I don't see that we have any hold counts on the xfs_inode, so this is
a dirty FYI/RFC of a work around for this problem by calling xfs_iget()
to read back in the just freed inode.
---
libxfs/xfs_attr.c | 4 ++++
1 file changed, 4 insertions(+)
Index: b/libxfs/xfs_attr.c
===================================================================
--- a/libxfs/xfs_attr.c
+++ b/libxfs/xfs_attr.c
@@ -223,11 +223,15 @@ xfs_attr_set_int(
* (inode must not be locked when we call this routine)
*/
if (XFS_IFORK_Q(dp) == 0) {
+ xfs_ino_t ino = dp->i_ino;
int sf_size = sizeof(xfs_attr_sf_hdr_t) +
XFS_ATTR_SF_ENTSIZE_BYNAME(name->len, valuelen);
if ((error = xfs_bmap_add_attrfork(dp, sf_size, rsvd)))
return(error);
+ error = libxfs_iget(mp, NULL, ino, 0, &dp, 0);
+ if (error)
+ return(error);
}
/*
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next parent reply other threads:[~2014-04-23 21:05 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20140423210034.892939354@sgi.com>
2014-04-23 21:04 ` Mark Tinguely [this message]
2014-04-23 22:22 ` [RFC] libxfs: adding attribute fork frees xfs_inode ptr Dave Chinner
2014-04-24 17:11 ` Mark Tinguely
2014-04-24 20:59 ` Mark Tinguely
2014-04-25 5:40 ` Christoph Hellwig
2014-04-25 13:18 ` Mark Tinguely
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=20140423210445.700477624@sgi.com \
--to=tinguely@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;
as well as URLs for NNTP newsgroup(s).