[RFC] libxfs: adding attribute fork frees xfs_inode ptr

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx
http://oss.sgi.com/mailman/listinfo/xfs




[Index of Archives]     [Linux XFS Devel]     [Linux Filesystem Development]     [Filesystem Testing]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux