xfs
[Top] [All Lists]

Re: [PATCH 2/2] xfsprogs: dont free xfs_inode until complete

To: Mark Tinguely <tinguely@xxxxxxx>
Subject: Re: [PATCH 2/2] xfsprogs: dont free xfs_inode until complete
From: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Date: Wed, 30 Apr 2014 08:14:31 -0700
Cc: xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <20140430135319.750775813@xxxxxxx>
References: <20140430134844.924376330@xxxxxxx> <20140430135319.750775813@xxxxxxx>
User-agent: Mutt/1.5.21 (2010-09-15)
On Wed, Apr 30, 2014 at 08:48:46AM -0500, Mark Tinguely wrote:
> Originally, the xfs_inode are released upon the first
> call to xfs_trans_cancel, xfs_trans_commit, or
> inode_item_done. This code used the log item lock field
> to prevent the release of the inode on the next call to
> one of the above functions. This is a unusual use of the
> log item lock field which is suppose to specify which lock
> is to be release on transaction commit or cancel. User
> space does not perform locking in transactions..
> 
> Unfortunately, this breaks any code that relies on multiple
> transaction operations. For example, adding an extended
> attribute to an inode that does not have an attribute fork
> will fail:
> 
>  # xfs_db -x XFS_DEVICE
>  xfs_db> inode INO_NUM
>  xfs_db> attr_set newattribute
> 
> This patch does the following:
>  1) Removes the iput from the transaction completion and
>     requires that the xfs_inode allocators call IRELE()
>     when they are done with the pointer. The real time
>     inodes are pointed to by the xfs_mount and have a longer
>     lifetime.

Makes sense, the kernel hasn't done an iput during transaction
completion for a long time.

>  2) Removes libxfs_trans_iput() because transaction entries
>     are removed in transaction commit and cancel.

Also matches the kernel and makes sense.

>  3) Removes libxfs_trans_ihold() which is an obsolete interface.

Ditto.

>  4) Removes the now unneeded ili_flags from the xfs_inode_log_item
>     structure.

ili_lock_flags, not ili_flags.  Given that we never lock inodes in
userspace there is no need to unlock them during transaction commit,
and no need to track this.  There's also no shared code that references
this field, so it can safely go.

The patch looks good to me, and having consistent behavior with the
kernel code is very useful to have!

Reviewed-by: Christoph Hellwig <hch@xxxxxx>

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